Catmull-Rom track with loop

Started by
1 comment, last by Lantz 20 years, 11 months ago
Check these weird images out: loop pic another loop pic Hi there. Ive been experimenting with creating a race track with the help of catmull-rom interpolation. For every small segment I calculate the tangent for it. Then I need the a right-vector to be able to construct the geometry. I get this by first taking the cross product of the tangent and [0 0 1] (to get the z-axis to be the up vector), then I rotate that vector by X degrees (every segment has a calculated orientation). This all works nice, except when I tried to make a loop (and I think I would get the same if i were to make the track go upside-down). At two points in the loop the track swings around 180 degrees very quickly and that isnt what I want, really. Does anyone know how to solve this? I suspect I need to change [0 0 1] to [0 0 -1] when the track goes upside down, but how do I determine when it does? Lantz [edited by - Lantz on May 5, 2003 12:28:54 PM]
Advertisement
One way is to have a second spline specifying your up direction at all times. This also has the advantage of easily being able to create banked tracks.
Hmm yea I guess that could be pretty smart. Although it may not be as simple to make the tracks with that as I probably will do them manually in some text-file or something. Right now I have a set of points where each point have an associated angle and that''s pretty easy to use when designing the tracks.

Does anyone else have any suggestion?

This topic is closed to new replies.

Advertisement