POV-Ray : Newsgroups : povray.advanced-users : Spline length/constant speed along spline. : Re: Spline length/constant speed along spline. Server Time
30 Jul 2024 02:16:47 EDT (-0400)
  Re: Spline length/constant speed along spline.  
From: Josh English
Date: 19 May 2000 14:46:19
Message: <39258BF5.E067B5E3@spiritone.com>
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."


Post a reply to this message

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