3 math questions
Hello, I am working on a game (http://www.sourceforge.net/projects/capturetf/) and I have some questions. How can I:
1) Find the tangent to a cubic spline (the camera moves along a spline in the main menu and I want it to look the direction it moves)
2) Mirror a quaternion around an axis (the artists want to only make half the skeleton and have a program mirror it, each bone''s orientation is represented with a quaternion)
3) Interpolate between quaternions (for skeletal animation)
Any answers you have or resources you can point me to would be very helpful.
1. If I remember correctly, there are a set of basis functions corresponding to the derivatives of the primary basis functions that, when multiplied by your control points, give you the tangent at u. In my Bezier patch class, I used this method to calculate the normals, as the cross product of the two tangents at u,v.
Unfortunately, I don''t remember the formulas and don''t know where that code is :-( But abstractly, I think that''s how you would do it.
2. Not quite sure. Perhaps you could extract the angle/axis, mirror that, and construct a new quaternion from that?
3. What you want is slerp, or ''spherical linear interpolation'', which interpolates smoothly between two quaternions along the surface of the 4D unit sphere. The algorithm is described in, among other places, ''3D Math Primer'' and, I believe, ''Game Programming Gems 1''.
Unfortunately, I don''t remember the formulas and don''t know where that code is :-( But abstractly, I think that''s how you would do it.
2. Not quite sure. Perhaps you could extract the angle/axis, mirror that, and construct a new quaternion from that?
3. What you want is slerp, or ''spherical linear interpolation'', which interpolates smoothly between two quaternions along the surface of the 4D unit sphere. The algorithm is described in, among other places, ''3D Math Primer'' and, I believe, ''Game Programming Gems 1''.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement