# "Fat" splines

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

## Recommended Posts

Hi, I've just got catmull-rom splines working, but I'd now like to use them as the format of my tracks in a racing game I'm making. I can get all the points, etc - but how can I make the splines "fatter." I basically need a way of finding 2 points that lie perpendicular to a point - if that makes sense. If anyone needs a diagram for explanation, I can happily provide you with one.

##### Share on other sites
Hey,

If you know a point on the curve and a tangent vector to the curve at that point, then finding the perpendicualr points you're after is just basic trig.

If you take the cross-product of tangent and up vectors at any point, you will get a perpendicualr vector. (If your track is flat, then this up vector would be [0,1,0] or alternatively you could use some other vector representing camber).

Your perpendicular points lie along this vector, and so finding them is just a matter of normalising and scaling by the desired width.

I did have a diagram that explained this, but my ftp was being arsey. Should be simple enough though :

1) find tangent,
2) cross product with up vector,
3) scale resulting vector by desired width.

Only thing with this naieve (sp?) approach is that for tight bends there is no guarentee that the perpendicular points will form a smooth curve without intersecting. Again a diagram would show this, but i can't upload from this PC.

Also just to warn you; i've no real knowledge of catmull-rom splines - this is just the most obvious approach that struck me at the time.

Cheers,
Ben

##### Share on other sites
Thats brilliant, I got it working now :)

1. 1
2. 2
3. 3
Rutin
15
4. 4
5. 5

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

• Total Topics
633679
• Total Posts
3013295
×