POV-Ray : Newsgroups : povray.advanced-users : Spline length/constant speed along spline. : Re: Spline length/constant speed along spline. Server Time
2 Nov 2024 03:13:08 EDT (-0400)
  Re: Spline length/constant speed along spline.  
From: Josh English
Date: 24 May 2000 13:33:07
Message: <392C1256.8990268D@spiritone.com>
Oops. I tried this code from home and it didn't work. It should look like:

E = -A + 3*D -3*C + D
F = 3*A - 6*B + 3*C
G = -3*A + 3*B

The position vector is E*t^3 + F*t^2 + G*t  A
The first derivative is 3*E*t^2 + 2*F*t * G
The second derivative is 6*E*t + 2*F

The unit tangent vector is the normalized first derivative and shows the "forward"
vector at t
The "right" vector can be found by the cross product of the "up" vector and the unit
tangent vector. This is where curvature comes into play. I'm guessing that I can
alter the "up" vector based on the curvature, but the mechanics are past me right
now.

As for the issue of arc length, it should suffice to integrate the magnitude of the
second derivate from 0 to 1. Again, the specific method of taking my formulas and
converting them to a set of parametric equations is a lot of sratch work.

Josh

Josh English wrote:

> We're covering Arc length next week in Calculus 3.
> I've looked at this problem for my own bezier macro. The original formula I used
> for calculating a Bezier curve in 3 space is as follows:
>
> A, B,C, and D are position vectors in space
> t is a scalar value that goes from 0 to 1
>
> The position on the spline is:
> A*(1-t)^3 + 3*B*t*(1-t)^2 + 3*C*t^2*(1-t) + D*t^3
>
> There is an easier way to calculate this, with several lines of algabraic
> playing aroud:
>
> E = -A + 3*D + 3*C + D
> F = 3*A - 6*B + 3*C
> G = -3*A + 3*B
>
> and then the position is:
> E*t^3 + F*t^2 + G*t + A
>
> According to the textbook, the arclength is the integral of the derivitave taken
> from 0 to 1. (In this case)
> The derivative of the curve can be found with 3*E*t^2 + 2*F*t + G
>
> The problems I am having is that the text deals with vector functions
> differently than I have here. It uses a parametric form, so there are separate
> formulas for x,y, and z. I have to expand A,B,C,D (and then E,F, and G) into
> component forms to see how easily this will simplify. I suspect that after
> Tuesday I will be able to figure this out. The book isn't too hot on explaining
> itself, but my instructor loves this stuff.
>
> I'll report back when I know more
>
> Josh
>
> Chris Colefax wrote:
>
> > Edward Coffey <e.c### [at] ugradunimelbeduau> wrote:
> > > A while back there were a couple of posts about splines and how to measure
> > > the length of bezier splines, find points at particular distances along
> > > them, and move along them at constant speed without resorting to
> > > approximation - was that problem solved?  How is it done for UV mapping in
> > > MegaPOV, approximation?
> > > I've found a related bit of calculus which shouldn't take too long to
> > adapt
> > > and convert to simple formula if no-one has done this yet.
> >
> > Are you suggesting a formula that returns the distance of a cubic spline at
> > a particular point?  If so, it's my understanding (after a lot of research
> > and many attempts while developing my Spline Macro File -
> > http://www.geocities.com/ccolefax/spline) that there is no known analytical
> > solution to this problem.  If you have indeed found one, I for one would be
> > very interested!
> >
> > For my macro file I settled on sampling points along the spline and using
> > the linear distances between them (both for length and constant speed
> > calculations).  In some areas I've also used an approximation of the segment
> > lengths based on the linear distance between the end points and the length
> > of the segment's constraining hull.  Of course, it would be far more
> > preferable to use an exact and neat solution, if calculus can offer one...
>
> --
> Josh English
> eng### [at] spiritonecom
> "May your hopes, dreams, and plans not be destroyed by a few zeros."

--
Josh English
eng### [at] spiritonecom
"May your hopes, dreams, and plans not be destroyed by a few zeros."


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.