|
![](/i/fill.gif) |
Ok, first let's rewrite the bezier formula:
p(t) = p0 * B0(t) + p1 * B1(t) + p2 * B2(t) + p3 * B3(t)
where p0,p1,p2,p3 are the bezier control points and
B0(t) = (1-t)^3
B1(t) = 3 * t * (1-t)^2
B2(t) = 3 * t^2 * (1-t)
B3(t) = t^3
(Bernstein polynomials)
this is a cubic bezier spline.
The normals should be quadratic, just calculate
n0 = p1 - p0
n1 = p2 - p1
n2 = p3 - p2
and
B0(t) = (1-t)^2
B1(t) = 2 * t * (1-t)
B2(t) = t^2
the normal at t is
n(t) = n0 * B0(t) + n1 * B1(t) + n2 * B2(t)
I'm not sure if these are the true normals or just approximations, I'd have to check.
Anyway, you can always calculate the true normals by differenciating the Bernstein
polynominals B0(t),B1(t),B2(t),B3(t), so
dB0/dt = -3(1-t)^2
dB1/dt = -6t(1-t) + 3(1-t)^2
dB2/dt = -3t^2 + 6t(1-t)
dB3/dt = 3t^2
...
I hope this helps.
-Sascha
Tim Nikias v2.0 wrote:
> so, I've got the following formula to calculate Bezier-Splines:
>
> Point_1*pow(1-Mover,3)+
> Point_2*3*pow(1-Mover,2)*Mover-
> Point_3*3*pow(Mover,2)*(1-Mover)+
> Point_4*pow(Mover,3)
>
> (I guess that formula should be known around pro's, but I've posted it here
> to make descriptions easier. Mover is the value that runs from 0 to 1 from
> beginning to end of the spline-segment, where one segment is made of four
> points: starting- and end-point, and two control-points).
>
> Anyways, I need to calculate the direction/tangent of the spline at any
> given position. I'm somehow stuck, probably because my head is still filled
> with the last exam I just wrote. Any help, or links?
>
> Thanks in advance,
> Tim
>
Post a reply to this message
|
![](/i/fill.gif) |