Archived

This topic is now archived and is closed to further replies.

Lantz

Generating splines from points (with normals)

Recommended Posts

(this is a follow up on this thread) If I have a set of points where each point also have a normal, how would I interpolate between them to generate a spline (without any kind of control points) that go through each point? What I want is to to be able get the position of a point and its normal over the entire spline. Also, will I need to generate one huge spline (with possibly hundred of points) or will it still fit together if I divide it into shorter splines with say like, 2-5 points per spline? I''ve found this but I''m not sure if that''s what I should use. Any suggestions, formulas, source code, links or thoughts on this would be great.

Share this post


Link to post
Share on other sites
This wont help you in your actual question, but another advantage of this approach is the AI of the other cars. Well not exactly the AI, but you can make the vehicles follow the track easily, so even if you don''t use the approach for drawing the track, you need to implement a similar system, assuming you want vehicles, or rockets(or whatever) to follow the track.

Share this post


Link to post
Share on other sites
If you want a spline to touch every point without using control points, i would suggest catmull-roll. It touches every point, except the first and last of your list of points.It needs at least 4 points to work. It doesn''t have an upper bound.
Even if you don''t want to use control points, perhaps you could use your normals already stored as control vector for a bezier curve.

One of the parameters of any spline can be the number of subdivisions you make for spline. This is the number of points you want each spline to be.

Share this post


Link to post
Share on other sites
Sounds interesting, you don''t happend to know about any good web page that deals with this matter? I probably should google around a bit more but if you know of any good resource that would be great.

Thanks,
Lantz

Share this post


Link to post
Share on other sites
quote:
Original post by billybob
catmull-rom and hermite splines go through the control points, i''m not sure what you want the normals to do though.


Well what I want to construct is a race track where the track is made up of points with normals. So for each point I have a normal which specifies what is "up" for that part of the track. So if I have one point with a normal that points straight up and the next one are tilted 45 degrees to the left I want the points inbetween (the points on the spline) to be interpolated so that the track slowly twists from the first points orientation to the second one''s.

Share this post


Link to post
Share on other sites
oh i see, you''d want to make two splines, one is the track positions itself, one is the normals. the normals one isn''t really a ''spline'' exactly, its more of just interpolating them between the points. catmull-rom is probably best for this, there is even a demo using catmull rom to make a huge space road. check this site out:

http://www.mvps.org/directx/articles/catmull/index.htm

Share this post


Link to post
Share on other sites