 |
 |
|
 |
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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
--
"Tim Nikias v2.0"
Homepage: <http://www.nolights.de>
Email: tim.nikias (@) nolights.de
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Ah... someone was quicker :-)
Of course I meant "tangents", not "normals" in my posting...
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"sascha" <sas### [at] users sourceforge net> wrote in message
news:4028e647$1@news.povray.org...
> Ah... someone was quicker :-)
>
> Of course I meant "tangents", not "normals" in my posting...
The 2nd derivative is the normal.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
> simplified:
>
> 3*(P2 - P1 + (P1 - 2*P2 - P3)*2*t + (P2*3 + P3*3 + P4 - P1)*t^2)
Simplified? ;-)
Uhm... Well, Sascha's approach worked quite well (now I just have to get it
work with more than one segment, but that's not the difficult part). To be
honest, I didn't really understand where you went with the derivative. Was a
long time ago that I had algebra in school, so I can't check if it's correct
or not, and since it looked so complicated, I took a first go with Sascha's
formula.
Still, enlighten me about this part:
> 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.
So, instead of using t, you want me to put a point into a function? What's
x? I got a little confused here and am not really sure what you were trying
to tell me. Thanks for the effort though!
Regards,
Tim
--
"Tim Nikias v2.0"
Homepage: <http://www.nolights.de>
Email: tim.nikias (@) nolights.de
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
[some complicated Math stuff abd derivative, Bernstein polynomials etc]
SNIP
> I hope this helps.
I did. Though that part about diffenciating the Bernstein polynomials, that
was a little above my head. Still, the other approach works fine and seems
to return actual normals, not just approximations. At least looks like that.
Regards and thanks a lot,
Tim
--
"Tim Nikias v2.0"
Homepage: <http://www.nolights.de>
Email: tim.nikias (@) nolights.de
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Ah, I take that back. It just approximates the normals, it doesn't properly
calculate them. I'll try to do something with that differenciating thingy
you mentioned at the end and return here later.
Regards,
Tim
--
"Tim Nikias v2.0"
Homepage: <http://www.nolights.de>
Email: tim.nikias (@) nolights.de
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
You're right, it should give you the correct values for the tangents.
It follows from the deCasteljau algorithm (do a google for it) which can be used to
compute positions and tangents on a bezier curve.
regards,
-sascha
Tim Nikias v2.0 wrote:
> [some complicated Math stuff abd derivative, Bernstein polynomials etc]
> SNIP
>
>>I hope this helps.
>
>
> I did. Though that part about diffenciating the Bernstein polynomials, that
> was a little above my head. Still, the other approach works fine and seems
> to return actual normals, not just approximations. At least looks like that.
>
> Regards and thanks a lot,
> Tim
>
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
No, it should work. Here's a part of a code I once wrote when playing with bezier
curves. What do you need the tangents for? Perhaps it's necessary to normalize them...
#default {
finish { ambient 1 }
}
#declare curve_size = 0.05;
#declare point_size = 0.20;
#declare col = color rgb <1,1,1>;
camera {
orthographic
location <0,0,-30>
look_at 0
}
#macro drawBezierCurve(p0,p1,p2,p3)
#local s = 0;
#while (s <= 1)
#local p = bezier(p0,p1,p2,p3,s);
#local n = dbezier(p0,p1,p2,p3,s);
sphere {
p,curve_size
pigment { color col }
}
cylinder {
p,p+vnormalize(n)*5,curve_size/2
pigment { color col }
}
#local s = s + 1/50;
#end
#end
#macro bezier(p0,p1,p2,p3,s)
#local B0 = (1 - s) * (1 - s) * (1 - s);
#local B1 = 3 * s * (1 - s) * (1 - s);
#local B2 = 3 * s * s * (1 - s);
#local B3 = s * s * s;
p0 * B0 + p1 * B1 + p2 * B2 + p3 * B3
#end
#macro bezier2(p0,p1,p2,s)
#local B0 = (1 - s) * (1 - s);
#local B1 = 2 * s * (1 - s);
#local B2 = s * s;
p0 * B0 + p1 * B1 + p2 * B2
#end
#macro dbezier(p0,p1,p2,p3,s)
#local n0 = p1 - p0;
#local n1 = p2 - p1;
#local n2 = p3 - p2;
bezier2(n0,n1,n2,s)
#end
#macro drawPoint(p)
sphere {
p,point_size
pigment { col }
}
#end
#macro drawLine(a,b)
cylinder {
a,b,curve_size
pigment { col }
}
#end
#macro setColor(c)
#declare col = color rgb c;
#end
#if (true)
#declare A = <-10,-5>;
#declare B = <-5,5>;
#declare C = <5,5>;
#declare D = <10,-5>;
setColor(<1,0,0>)
drawPoint(A)
drawPoint(B)
drawPoint(C)
drawPoint(D)
setColor(<0,0,1>)
drawBezierCurve(A,B,C,D)
#end
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Hm, the differenciating formulas at the end don't seem to work, I get pretty
weird results with that... I'll look if Chris's formula works. And if that
doesn't do it, I'll have to fumble around a little more, I guess.
Regards,
Tim
--
"Tim Nikias v2.0"
Homepage: <http://www.nolights.de>
Email: tim.nikias (@) nolights.de
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Okay, it DOES work. Made a mistake somewhere, should've double checked
before dropping the idea... Anyways, thanks, works fine now. (I'm a little
tired at the moment, had to get up early for an exam, but now I'm back to
POVing, yay! :-)
Regards,
Tim
--
"Tim Nikias v2.0"
Homepage: <http://www.nolights.de>
Email: tim.nikias (@) nolights.de
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
In article <40291025$1@news.povray.org>,
"Tim Nikias v2.0" <tim.nikias (@) nolights.de> wrote:
> > simplified:
> >
> > 3*(P2 - P1 + (P1 - 2*P2 - P3)*2*t + (P2*3 + P3*3 + P4 - P1)*t^2)
>
> Simplified? ;-)
A simplified version of:
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
> Uhm... Well, Sascha's approach worked quite well (now I just have to get it
> work with more than one segment, but that's not the difficult part). To be
> honest, I didn't really understand where you went with the derivative. Was a
> long time ago that I had algebra in school, so I can't check if it's correct
> or not, and since it looked so complicated, I took a first go with Sascha's
> formula.
Well, as far as I can tell, the second method Sascha gave is identical
to the one I gave, though expressed a bit differently. I'm not sure
what's going on with the first method...but I think it's mathematically
equivalent, just a shortcut. I'm going to have to look at it further...
> Still, enlighten me about this part:
>
> > 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.
>
> So, instead of using t, you want me to put a point into a function? What's
> x? I got a little confused here and am not really sure what you were trying
> to tell me. Thanks for the effort though!
Instead of using t for what?
You asked for a tangent line to a spline segment and gave an equation
for that segment. f() is that equation, f'() is the derivative I gave.
The equation I gave is the equation for a line tangent to the spline at
t == p, with x being the horizontal axis. x*f'(p) - p*f'(p) + f(p) gives
a line tangent to f() at f(p).
To find a line tangent to a curve at a given point, you need to know the
slope of the curve at that point. The slope is just the rate of change,
the first derivative of the function. x*f'(p) is a line through (0, 0)
parallel to the tangent line. Subtract p*f'(p) so it equals 0 at (p, 0),
under the desired point, and add f(p) to bring it up to the curve at
that point. The final equation would be:
x*f'(p) - p*f'(p) + f(p) == (x - p)*f'(p) + f(p) ==
(x - p)*3*(P2 - P1 + (P1 - 2*P2 - P3)*2*p + (P2*3 + P3*3 + P4 -
P1)*p^2)) + P1*(1 - p)^3 + P2*3*(1 - p)^2*p - P3*3*p^2*(1 - p) + P4*p^3
Where p is the point along the spline where you want the tangent line.
The result of this equation is the height at x of the line tangent to
the spline at p.
--
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
In article <402902af@news.povray.org>,
"David Wallace" <dar### [at] earthlink net> wrote:
> > Of course I meant "tangents", not "normals" in my posting...
>
> The 2nd derivative is the normal.
And the first derivative is the tangent. Sascha just got the terms
switched.
--
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
> 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?)
3*(P2 - P1 + (P1 - 2*P2 + P3)*2*t + (-P1 + P2*3 - P3*3 + P4)*t^2)
Andrel
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
In article <402### [at] hotmail com>,
andrel <a_l### [at] hotmail com> wrote:
> > 3*(P2 - P1 + (P1 - 2*P2 - P3)*2*t + (P2*3 + P3*3 + P4 - P1)*t^2)
> >
> > (somebody want to check that?)
> 3*(P2 - P1 + (P1 - 2*P2 + P3)*2*t + (-P1 + P2*3 - P3*3 + P4)*t^2)
Well, that doesn't work. The resulting lines are close, but not quite
tangent. My results look right, any errors are small ones.
--
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
> Well, as far as I can tell, the second method Sascha gave is identical
> to the one I gave, though expressed a bit differently. I'm not sure
> what's going on with the first method...but I think it's mathematically
> equivalent, just a shortcut. I'm going to have to look at it further...
It works, now that I've cleaned the code and found some stupid mistakes I
made... As I understand it, instead of interpolating between four points
with a cubic, I interpolate with three points with a squared function. I
guess there's some more fundamental background behind this (perhaps googling
Bernstein might help, who knows), but I'm not in the mood right now to dig
into math. Perhaps tomorrow, when I'm less lazy and getting more and excited
with Povray again.
SNIP [some Math Stuff]
Ah, now I understood what you were aiming at. Yes, that should work, too.
But honestly, that "shortcut", as you called it, looks nice and slick in
code, whereas the "simplified" model looks pretty ugly. Unless... Taking a
long shot here, but I guess you could adjust the formula so that it ends up
looking like the one Sascha gave...
Ah well, tomorrow is time for math-fun. Today, my brain is already spent
(well, most of it).
Regards,
Tim
--
"Tim Nikias v2.0"
Homepage: <http://www.nolights.de>
Email: tim.nikias (@) nolights.de
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
In article <40294052$1@news.povray.org>,
"Tim Nikias v2.0" <tim.nikias (@) nolights.de> wrote:
> It works, now that I've cleaned the code and found some stupid mistakes I
> made... As I understand it, instead of interpolating between four points
> with a cubic, I interpolate with three points with a squared function.
Well, yes, the derivative of the cubic spline is a quadratic function.
It doesn't interpolate between those three points though...its value at
one of those points is not the value of that point, it is the slope of
the tangent line at that point. It appears to be something like a
quadratic interpolation of the tangents formed by the control points...
> Ah, now I understood what you were aiming at. Yes, that should work, too.
> But honestly, that "shortcut", as you called it, looks nice and slick in
> code, whereas the "simplified" model looks pretty ugly. Unless... Taking a
> long shot here, but I guess you could adjust the formula so that it ends up
> looking like the one Sascha gave...
Again, that was only a simplified expression of the equation of the
derivative. The term "simplified" has nothing to do with how simple it
is compared to other solutions.
B0(t) = (1 - t)^2
B1(t) = 2*t*(1 - t)
B2(t) = t^2
n0 = p1 - p0
n1 = p2 - p1
n2 = p3 - p2
n(t) = n0*B0(t) + n1*B1(t) + n2*B2(t)
=
(p1 - p0)*(1 - t)^2 + (p2 - p1)*2*t*(1 - t) + (p3 - p2)*t^2
But this does not work at all...
--
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Christopher James Huff wrote:
> B0(t) = (1 - t)^2
> B1(t) = 2*t*(1 - t)
> B2(t) = t^2
>
> n0 = p1 - p0
> n1 = p2 - p1
> n2 = p3 - p2
>
> n(t) = n0*B0(t) + n1*B1(t) + n2*B2(t)
> =
> (p1 - p0)*(1 - t)^2 + (p2 - p1)*2*t*(1 - t) + (p3 - p2)*t^2
>
> But this does not work at all...
>
Sure it does!
Take a look at the image at http://192.94.226.61/decasteljau.png
it shows a bezier curve defined by p0,p1,p2,p3 and the deCasteljau construction
of point P at t = 3/4 (just as an example).
The tangent through P is, as we can see, the vector b - a.
Ok, let's take a closer look:
first, let's construct the points x,y and z
x = p0(1-t) + p1t
y = p1(1-t) + p2t
z = p2(1-t) + p3t
now we can construct a and b
a = x(1-t) + yt =
= p0(1-t)^2 + p1t(1-t) + p1(1-t)t + p2t^2 =
= p0(1-t)^2 + p1*2t(1-t) + p2t^2
b = y(1-t) + zt =
= p1(1-t)^2 + p2t(1-t) + p2(1-t)t + p3t^2 =
= p1(1-t)^2 + p2*2t(1-t) + p3t^2
our tangent is b - a =
= p1(1-t)^2 + p2*2t(1-t) + p3t^2 - p0(1-t)^2 - p1*2t(1-t) - p2t^2 =
= (p1-p0)(1-t)^2 + (p2-p1)*2t(1-t) + (p3-p2)t^2
Q.E.D
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Christopher James Huff wrote:
> In article <402### [at] hotmail com>,
> andrel <a_l### [at] hotmail com> wrote:
>
>
>>>3*(P2 - P1 + (P1 - 2*P2 - P3)*2*t + (P2*3 + P3*3 + P4 - P1)*t^2)
>>>
>>>(somebody want to check that?)
>>
>>3*(P2 - P1 + (P1 - 2*P2 + P3)*2*t + (-P1 + P2*3 - P3*3 + P4)*t^2)
>
>
> Well, that doesn't work. The resulting lines are close, but not quite
> tangent.
Are you sure? I have used this myself and when I used it
the tangents were correct. Note also the symmetries in the
coefficient, the binomial coeeficients and the nice alternating
signs. I think the original error may be in the line:
> P2*3*(2*(1 - t)*(-1)*t + (1 - t)2) -
In my deriviation the final '-' is a '+'. BTW, I derived the
equations in the same way as you did. Well, of course, we both
have the same sort of math training I suspect :).
completely aside:
I had to compute the tangents when trying to
understand where some of my apparently discontinuous
normals in bezier patches come from. To check what I
would expect against the POV source I manually
constructed a subdivision in smooth triangles. For
this I needed the local normal in the vertices of the
subdivided patch. The result was nearly identical to
the POV version and remaining differences the result
of round off errors. Conclusion: there is nothing
wrong with mor mine nor POVs calculations. I only
still have these images with discontinuous normals
in bezier patches that I can prove to be continuous.
In short: I an still absolutely confused about this.
But that is life I suspect :)
To be continued someday, but todat I have to work
a bit first.
> My results look right, any errors are small ones.
>
What equations did you use in the end?
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
In article <402### [at] hotmail com>,
andrel <a_l### [at] hotmail com> wrote:
> Are you sure? I have used this myself and when I used it
> the tangents were correct. Note also the symmetries in the
> coefficient, the binomial coeeficients and the nice alternating
> signs. I think the original error may be in the line:
> > P2*3*(2*(1 - t)*(-1)*t + (1 - t)2) -
> In my deriviation the final '-' is a '+'. BTW, I derived the
> equations in the same way as you did. Well, of course, we both
> have the same sort of math training I suspect :).
The one at the very end? That was in the original equation:
P1*(1 - t)^3 +
P2*3*(1 - t)^2*t -
P3*3*t^2*(1 - t) +
P4*t^3
If that's wrong, than the original equation is too. If you're talking
about something in that term, the Maxima result is: 3*P2*(1 - t)^2 -
6*P2*(1 - t)*t
=
3*P2*((1 - t)^2 - 2*(1 - t)*t)
=
3*P2*(-2*(1 - t)*t + (1 - t)^2)
Which agrees with my result.
As for training, I'm currently slogging my way through Calculus II, and
am mainly self-taught. I'm still mainly teaching myself, due to the fact
that the instructor can't speak clear English or write legibly. I'm also
taking Numeric Analysis, which may cover splines later this semester.
> > My results look right, any errors are small ones.
> >
> What equations did you use in the end?
a():=0.1; b():=0.9; c():=0.2; d():=1;
(Defined as functions because I couldn't figure out how to define them
as variables in Maxima...damned annoying program, with practically
useless documentation.)
f(t):=a()*(1 - t)^3 + b()*3*(1 - t)^2*t - c()*3*t^2*(1 - t) + d()*t^3;
fd(t):=3*(b() - a() + (a() - 2*b() - c())*2*t + (b()*3 + c()*3 + d() -
a())*t^2);
tgt(t, p):= (t - p)*fd(p) + f(p);
plot2d([f(t), tgt(t, 0.2), tgt(t, 0.5), tgt(t, 0.9)], [t, 0, 1]);
--
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Christopher James Huff wrote:
> In article <402### [at] hotmail com>,
> andrel <a_l### [at] hotmail com> wrote:
>
>
>>Are you sure? I have used this myself and when I used it
>>the tangents were correct. Note also the symmetries in the
>>coefficient, the binomial coeeficients and the nice alternating
>>signs. I think the original error may be in the line:
>> > P2*3*(2*(1 - t)*(-1)*t + (1 - t)2) -
>>In my deriviation the final '-' is a '+'. BTW, I derived the
>>equations in the same way as you did. Well, of course, we both
>>have the same sort of math training I suspect :).
>
>
> The one at the very end? That was in the original equation:
> P1*(1 - t)^3 +
> P2*3*(1 - t)^2*t -
> P3*3*t^2*(1 - t) +
> P4*t^3
>
> If that's wrong, than the original equation is too.
Sorry, I did not check all your equations, I should have.
You are absolutely right here, your original equation
is wrong. There should not be a minus there either ;)
> If you're talking
> about something in that term, the Maxima result is:
I had never heard of Maxima, just googled it.
Perhaps I give it a try someday.
off-topic: Mostly I do the math required for POV by hand.
For years I did not do as much math as I do now. Sometimes
I even try to convince people that POV is an interesting
kind of application for learning math at a highschool level.
You often want to achieve some goal and the only way to do
it is sit down and do the equations. Along the same line,
if someone asked me why that should learn math at highschool
one of my answers is: to be able to create realworld
objects in POV!
Andrel
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
In article <402### [at] hotmail com>,
andrel <a_l### [at] hotmail com> wrote:
> > If that's wrong, than the original equation is too.
> Sorry, I did not check all your equations, I should have.
> You are absolutely right here, your original equation
> is wrong. There should not be a minus there either ;)
Well, that would explain why my equation works for finding tangents to
it, but yours doesn't. Thought it looked odd...
> off-topic: Mostly I do the math required for POV by hand.
Mostly I program the computer to do it for me. I'm terrible at that kind
of thing, always making arithmetic errors and simple little stuff like
that...at least it wasn't me this time.
> For years I did not do as much math as I do now. Sometimes
> I even try to convince people that POV is an interesting
> kind of application for learning math at a highschool level.
> You often want to achieve some goal and the only way to do
> it is sit down and do the equations. Along the same line,
> if someone asked me why that should learn math at highschool
> one of my answers is: to be able to create realworld
> objects in POV!
It is a very good way of learning how the math applies to and relates to
the real world, or at least approximations of it.
--
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Tim Nikias v2.0 wrote:
> so, I've got the following formula to calculate Bezier-Splines:
...
> Anyways, I need to calculate the direction/tangent of the spline at any
> given position.
...
I suggest that you go googling for "Frenet Frames"
Look for web pages similar to this norwegian one:
http://tinyurl.com/27xap
Tor Olav
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|
 |