Jump to content
  • Advertisement
Sign in to follow this  
dawberj3

Frenet frame on bezier curve

This topic is 4828 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a bezier curve and i need to calculate the vector perpendicular to the tangent (binormal?) at regular intervals along the curve. Ive googled frenet frames and most of the sites come up with stupid explanations that make no sense at all. Can anyone point me in the right direction to a decent source or whether there is a better way to do what i want? Thx

Share this post


Link to post
Share on other sites
Advertisement
if youre talking about THE vector peripendiculat to the tangent, ill assume its a 2d case.

if you evaluate your beziers using decasteljeu steps (==good idea), omit the last step and the difference between the remaining two points is your tangent vector.

otherwise, you could rewrite from its bezier form to a standard polynomal form, so you can find the tangent by just differentiating and evaluating.

once you have the tangent, finding the normal should be pretty easy.

Share this post


Link to post
Share on other sites
Quote:
Original post by dawberj3
I am working in 3D.


well, that doesnt really change anything, except for this:

Quote:

once you have the tangent, finding the normal should be pretty easy.

instead of really easy, it becomes impossibe. finding a normal still wouldnt be that hard, but youll first need to find the tangent vector anyway.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
You may want to look into parrallel transport frame....

Share this post


Link to post
Share on other sites
As someone else mentioned, the unique tangent to a Bezier curve at any particular point is given by the derivative of the position.

In a Frenet frame, there actually is a definition for the normal to the curve -- it's the derivative of the tangent vector (or second derivative of the position). The normal points inward with respect to the direction in which the curve is bending and lies in the osculating plane. (The is no normal if the curve happens to be going in a straight line.)

In the context of curves, there is also a binormal vector which is given by the cross product of the tangent and the normal. The same terminology does not carry over to tangent space on a surface, in which there is a bitangent vector that is given by the cross product of the normal and the tangent.

If you have the book Mathematics for 3D Game Programming and Computer Graphics, you can find more information in Section 15.8.

-- Eric Lengyel

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by Eric Lengyel
As someone else mentioned, the unique tangent to a Bezier curve at any particular point is given by the derivative of the position.


The word "unique" is not correct. A point on a Bezier curve has infinitely many tangent vectors. If you require the tangent vectors to be unit length, there are two at each point.

Quote:

In a Frenet frame, there actually is a definition for the normal to the curve -- it's the derivative of the tangent vector (or second derivative of the position).


Two problems. Use of "the" normal implies uniqueness. This is also not correct. And the variable of the differentiation must be specified; in this case it needs to be the arc length parameter s for the curve. If X(t) is the parametric equation for the curve, the arc length parameter is a function of t, say s(t). A unit-length tangent vector is T = dX/ds = (dX/dt)/(ds/dt). That is, you compute the t-derivative X'(t) = dX/dt and normalize it. Thus, ds/dt = |X'(t)|, the length of the t-derivative of X(t). This is the speed of a particle traveling along the curve at time t. Let X"(t) = d(dX/dt)/dt be the second derivative of the curve. If X(t) denotes the position of a particle at time t, X'(t) is the velocity and X"(t) is the acceleration. Let s'(t) denote the derivative ds/dt and let s"(t) = d(ds/dt)/dt be the second derivative with respect to t.

Let T(s) denote the tangent as a function of the arc length parameter and let N(s) denote the Frenet normal vector. The relationship is dT/ds = k(s)*N(s), where k(s) is defined to be the curvature and N(s) is a unit-length normal vector. You can compute dT/ds from the equation for T: dT/ds = d(dX/ds)/ds = (s'(t)*X"(t) - s"(t)*X'(t))/(s'(t))^2. The expression A^2 means A*A. The formula uses the chain rule from calculus.

Now about the problem with "uniqueness". The quantity dT/ds is unique according to its definition mentioned previously. However, notice that dT/ds = k(s)*N(s) = [-k(s)]*[-N(s)]. You have the same two-valued problem as with unit-length tangent vectors. You might choose curvature k(s) and normal N(s), but someone else chooses curvature -k(s) and normal -N(s). Generally, it is not always possible to compute a smoothly varying Frenet normal vector. (The problem is one of topology, where even-dimensional spaces support the smoothness, but odd-dimensional spaces do not.)

The usual choice is k(s) = |Cross(X'(t),X"(t))|/|X'(t)|^3, so curvature is a nonnegative quantity. As stated, you may compute it without having to know the relationship between s and t. Moreover, N(s) = (|X'(t)|^2*X"(t)-Dot(X'(t),X"(t))*X'(t))/(|X'(t)|*|Cross(X'(t),X"(t))), which is also computable without knowing how s and t are related.

The torsion of the curve is m = (Dot(X'(t),Cross(X"(t),X'''(t))/|Cross(X'(t),X"(t))|^2, again computable in terms of t only.

The binormal is B(s) = Cross(T(s),N(s)).

The Frenet frame relationships are: dT/ds = k(s)*N(s), dN/ds = -k(s)*T(s)+m(s)*B(s), and dB/ds = -m(s)*N(s). These are described in terms of arc length s, but the equations stated earlier allow you to compute T, N, B, k, and m in terms of the original curve parameter t.

Quote:

The normal points inward with respect to the direction in which the curve is bending and lies in the osculating plane. (The is no normal if the curve happens to be going in a straight line.)


"Points inward" is difficult to quantify for a 3D curve. The normal vector construction has problems when the speed is zero or when the velocity and acceleration vectors (of a particle traveling along the curve) are perpendicular. The latter condition happens for a particle traveling along a straight line, but can also happen instantaneously (points of inflection, so to speak). These are a physical way of stating that problems occur when the denominator in the expression for normal N is zero.

Quote:

The same terminology does not carry over to tangent space on a surface, in which there is a bitangent vector that is given by the cross product of the normal and the tangent.


For surfaces, you have the Darboux frame. Again you say "the normal" and "the tangent", implying uniqueness, but the uniqueness is not there. If N is a unit-length normal, so is -N. You have infinitely many choices for tangent vectors at a point. Once you choose *a* unit-length tangent T at the point, a bitangent B is one of *two* unit-length vectors perpendicular to both N and T. The attempt to construct "special" tangent vectors manifests itself in differential geometry (principal directions and principal curvatures).

All these details might seem like "nitpicks", but in practice when you compute these quantities, you have to understand the constraints and limitations. No different than worrying about things like right-handed vs. left-handed cross products or which direction about an axis does a positive angle correspond to in a rotation.

Share this post


Link to post
Share on other sites
Of course, all of your detailed explanations are correct. I go into the same details in my book, but just didn't think it was necessary here.

When I was talking about tangent space relative to a surface, I meant in the context of the usual meaning around here -- the space whose basis vectors are aligned to the texture map, assuming that the texture coordinate gradients are non-vanishing. (Somebody posted a link above to my code for generating these.)

Share this post


Link to post
Share on other sites
well this is the TNB frame well all know from calc, there a reason we call it standard, cus we cancalculate it uniquely.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!