equidistant point inside a spline

BlitzMax Forums/BlitzMax Beginners Area/equidistant point inside a spline

hub(Posted 2006) [#1]
Hi !
i know how to draw a spline, but in my game i need equidistant points along the path ! Is there a formulae to do this ? i'm crap with math !
Thanks for your help

from my ingame code : spline
		For Local a:Float=0 To 1 - .01 Step .01    
			t.x[Index] = x1*(1-a)^3 + 3*vx1*(1-a)^2*a + 3*vx2*(1-a)*a^2 + x2*a^3
			t.y[Index] = y1*(1-a)^3 + 3*vy1*(1-a)^2*a + 3*vy2*(1-a)*a^2 + y2*a^3
			Index = Index + 1
		Next

Note that you can see the problem if you download my game, press f2 during the introscreen (cheat mode) and with the arrows keys choose level 10. (
http://www.bayre.com/zigwigwis/
to download click on 'telecharger')


ImaginaryHuman(Posted 2006) [#2]
As you draw the lines, count how many pixels are in the line, or work out how distant the points are apart, and split them if needed.?


hub(Posted 2006) [#3]
Thanks

MyStep# = 0.0
a# = 0
index = 0
While a < 1
		  
a = a + MyStep
	
t.x[Index] = x1*(1-a)^3 + 3*vx1*(1-a)^2*a + 3*vx2*(1-a)*a^2 + x2*a^3
t.y[Index] = y1*(1-a)^3 + 3*vy1*(1-a)^2*a + 3*vy2*(1-a)*a^2 + y2*a^3
	
vx#= -3 * x1 * (1-a)^2 + 3 * vx1 * (1-a) * ((1-a)-2*a) + 3 * vx2 * a * (2*(1-a)-a) + x2 * 3 * a^2
vy#= -3 * y1 * (1-a)^2 + 3 * vy1 * (1-a) * ((1-a)-2*a) + 3 * vy2 * a * (2*(1-a)-a) + y2 * 3 * a^2
d#=Sqr(vx * vx + vy * vy)
MyStep# = Speed/d
Index = Index + 1
				
Wend


Thanks to Warpy :
http://www.blitzbasic.com/codearcs/codearcs.php?code=1523