# building an orthogonal 3D basis out of a single hermite spline?

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

## Recommended Posts

Hi all, Well i've been stuck on this problem for a while... I'm trying to build a path where mesh can move along, i'd like the mesh to head towards the tangent of the spline at all times. However i'm stuck with "discontinuity" problems, my basis is sunddenly switching 90 degrees in random directions at half of the hermite knot distances it seems... :/ Here is the code that i use currently: ________________________________________________________ vec3d BaseZ = position->getD( t ); // first derivate vec3d BaseX = position->getD2( t ); // second derivate vec3d BaseY = BaseZ ^ BaseX; BaseX.normalize(); BaseY.normalize(); BaseZ.normalize(); BaseZ = BaseX ^ BaseY; BaseX = BaseY ^ BaseZ; BaseY = BaseZ ^ BaseX; matrix3 baseMatrix; baseMatrix.set( BaseX, BaseY, BaseZ ); baseMatrix = baseMatrix.inverse(); ________________________________________________________ any help or links really appreciated :)

##### Share on other sites
After normalization, BaseX and BaseY are unit length vectors but they are not necessarily perpendicular. BaseZ = Cross(BaseX,BaseY) will be a unit length vector *only when BaseX and BaseY are unit length*. After your three cross product evaluations, the three vectors are mutually perpendicular but not necessarily unit length.

If you have to use your approach, the last cross product is not necessary:
BaseZ = position->getD(t);BaseX = position->getD2(t);BaseY = BaseZ ^ BaseX;BaseZ = BaseX ^ BaseY;BaseX = BaseY ^ BaseZ;BaseX.normalize();BaseY.normalize();BaseZ.normalize();

This produces unit-length and mutually orthogonal vectors.

Typical approaches to a "coordinate frame" along a curve. First is the Frenet-Serret frame. The tangent T(t) = X'(t)/|X'(t)|. The normal and binormal are computed using curvature and torsion. Second is a frame based on having a preferred "up" vector U, where you are required never to allow the tangent to point in the up or down directions. Compute T(t) as in the Frenet-Serret frame. Compute binormal B(t) = Cross(T(t),U)/Length(Cross(T(t),U)). Compute normal N(t) = Cross(B(t),T(t)).

1. 1
2. 2
3. 3
Rutin
15
4. 4
khawk
14
5. 5
frob
12

• 9
• 11
• 11
• 23
• 12
• ### Forum Statistics

• Total Topics
633661
• Total Posts
3013226
×