|
![](/i/fill.gif) |
In article <4028beda$1@news.povray.org>,
"Tim Nikias v2.0" <tim.nikias (@) nolights.de> 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)
> 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?
Okay...your function is this, P1..P4 being the spline values, t being
the spline time parameter:
P1*(1 - t)^3 +
P2*3*(1 - t)^2*t -
P3*3*t^2*(1 - t) +
P4*t^3
The slope of the tangent is simply the derivative, the rate of change at
the given point. Unless I've screwed up the math somewhere, that would
be:
P1*3*(1 - t)^2*(-1) +
P2*3*(2*(1 - t)*(-1)*t + (1 - t)^2) -
P3*3*(2*t*(1 - t) - t^2) +
P4*3*t^2
simplified:
3*(P2 - P1 + (P1 - 2*P2 - P3)*2*t + (P2*3 + P3*3 + P4 - P1)*t^2)
(somebody want to check that?)
The tangent line at point p would be:
x*f'(p) - p*f'(p) + f(p)
where f() is the spline function, and f'() is its derivative.
--
Christopher James Huff <cja### [at] earthlink net>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: <chr### [at] tag povray org>
http://tag.povray.org/
Post a reply to this message
|
![](/i/fill.gif) |