- #1
RagingPineapple
- 21
- 0
I'm using a bézier curve in a Computer Game I'm working on that has four points:
p0 (start point)
p1 (directional helper for p0)
p2 (directional helper for p3)
p3 (end point)
I nabbed the drawing formula from Wikipedia and it works fine.
I have some problems though.
I really need to obtain the length of the curve, accurate to within a pixel or two if possible. I also need to be able to take the length and convert it to t.
This is necessary because fixed jumps in t (for example, incrementing it by 0.1 every frame) does not result in jumps of a fixed distance in pixels. If we were to plot dots along the curve at every 0.1 on t, the dots would not be equally spaced.
My ultimate, evil, master plan is to obtain the length of my curve, divide the length by a certain number of steps, find t for each step, and then use t to plot the X and Y coordinates of objects which follow the curve.
That'd be groovy, but I don't know how easy it'd be. Also, I managed to understand the Wiki's Bézier explanation, but I'm not too au fait with Mathematical Notation, so some explanations may be needed, heh.
Bézier curves for dummies! Someone should so write that...
p0 (start point)
p1 (directional helper for p0)
p2 (directional helper for p3)
p3 (end point)
I nabbed the drawing formula from Wikipedia and it works fine.
I have some problems though.
I really need to obtain the length of the curve, accurate to within a pixel or two if possible. I also need to be able to take the length and convert it to t.
This is necessary because fixed jumps in t (for example, incrementing it by 0.1 every frame) does not result in jumps of a fixed distance in pixels. If we were to plot dots along the curve at every 0.1 on t, the dots would not be equally spaced.
My ultimate, evil, master plan is to obtain the length of my curve, divide the length by a certain number of steps, find t for each step, and then use t to plot the X and Y coordinates of objects which follow the curve.
That'd be groovy, but I don't know how easy it'd be. Also, I managed to understand the Wiki's Bézier explanation, but I'm not too au fait with Mathematical Notation, so some explanations may be needed, heh.
Bézier curves for dummies! Someone should so write that...