#### Archived

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

# formula for splines?

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

## Recommended Posts

I need to interpolate points that are fairly far spaced to form a curved surface. Is there a quick, easy math formula for this? I mean, say I have 10 evenly spaced points, at heights that vary. How would I find a bunch of points in between to form a smooth curve? (PS this is for my terrain engine, how would I port this to 3d, but if you don''t know, a 2d formula is perfectly OK, I''m smart enough to figger it out) Thanks! ~BenDilts( void );

##### Share on other sites
I wrote a tutorial on how to do this on my site. It''s probably pretty hard to follow cause i''m *really* bad at explaining things :-( but there''s source included.. The problem with splines is there isn''t just 1 equation to solve / plug things into. For each new point you add to the curve, you add another 4 equations to a system of simultaneous equations that needs to be solved. A curve through 4 points you need to solve a system of 12 equations in 12 variables. For 8 points it''s a system of 28 equations in 28 variables. The hardest part is setting up and solving these systems (which I do in the source, but kinda gloss over in the tutorial).

http://www.thepeel.com/void/tutorials/gfxtut4-splines.htm

JS
http://www.thepeel.com/void

##### Share on other sites
If you're doing terrain, why don't you just join the points with straight lines. If you do this in 3D you'll get mesh and these can be triangles, and than gouraud shade it with avg normals you get smooth looking terrain, even if they are really straight lines. of course this is best if you view the terrain from far away.

this is what I mean.

Edited by - jho on July 19, 2000 4:18:16 AM

##### Share on other sites
sorry I misread I keep thinking you have every point of your terrain defined in a high resolution height map already. Yeah to interpolate those points you need to write a spline evaluator.. like the OpenGL one. What I like to do is add a random offset to make my terrain jaggy.

1. 1
2. 2
3. 3
4. 4
Rutin
17
5. 5

• 13
• 14
• 9
• 9
• 9
• ### Forum Statistics

• Total Topics
632927
• Total Posts
3009242
• ### Who's Online (See full list)

There are no registered users currently online

×