Simple Spline Tutorial
 
ive been needing to make a spline routine so that i could approximate any point on the curve at any subpoint. so instead of a curve that has 16 subdivisions i can say i want to be at point 45/768 on the curve... so the curve will always be perfectly smooth.

here is the tutorial from the Zero GTR section. i've used this technique many times since i wrote the original code, and am still very satisfied with the output.



first you have a set of reference points (white points in the corners). the green dots mark the 1/2 way point between each corner. we are going to build a curve between each green dot sinking into the corner.
--



each interpolation draws a sub line from between the first green dot and the corner to between the corner and the 2nd green dot. in this picture we are looking at the 50% dot. so it draws a line from 50% between the green dot and the corner to 50% between the corner and the next 1/2 point, then draws a green dot at the 50% point on this new line. say we wanted to draw the 20% point, we would find the line that is 20% up from the 1/2 point to 20% away from the corner to the 2nd half way point, and draw a dot at the 20% point on this new line... do this enough times and you can see the curve start appearing
---







Downloads
Spline Test 2KB http://syn9.thehideoutgames.com/zga/devlog/splinetest.bas