![](/i/fill.gif) |
![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Could you give me the form of the function (this mathematical form)?
Thanks,
Fabian.
>
> I wrote:
> > Due to the maths involved, there is no known way to calculate the exact
> > length of a cubic spline. The best method is usually to sum the linear
> > distances between a number of steps along the spline - obviously, the more
> > steps, the more accurate the result (at the cost of speed)...
>
> Fabian BRAU <Fab### [at] umh ac be> wrote:
> > If you know the exact form of the function (the spline) you
> > can calculate the length of the spline, this involve a simple integrale.
> > Actually this is what you do approximately by using straight line
> > between point.
>
> Yes, it seems obvious that you could integrate the spline function to find
> the exact length. But like I said, there is simply no known way *to*
> integrate the function. To create my Spline Macro File I searched and
> re-searched the web for the right formulas, and also started from first
> principals to derive the functions myself, before attempting (without
> success) the necessary integration in MathCAD. I guess it shows that there
> are limits to our knowledge of mathematics....
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Hi Andrew,
OK, with a little thought the problem reduces down to finding the
integral of the square-root of a fourth order polynomial, ie:
int(sqrt(A*t^4 + B*t^3 + C*t^2 + D*t + E), t);
where A to E are scalars derived from the coefficients of the x, y and z
cubic functions. So if you can get an analytic integration of this
please make it known ... I couldn't figure it out ...
Bye for now,
Mike Andrews.
Andrew Clinton wrote:
>
> Michael,
>
> Ahh, I was thinking of this, but thought that maybe one could take the magnitude of
> the vector returned by that (terribly ugly) formula to get the distance traveled. I
> understand how this is done with vectors now (there is a good page at
> http://iq.orst.edu/mathsg/vcalc/arc/arc.html)
>
> Thanks for clarifying
> Andrew C
>
> Michael Andrews wrote:
>
> > Hi Andrew,
> >
> > This is the length of a simple parametric spline where a, b, c and d are
> > scalars, yes?
> >
> > The problem is that it would usually be used to produce a spline in 3d,
> > so a, b, c and d would be 3-component vectors. This would probably add a
> > whole new level of complexity, something like
> >
> > f_x := a_x * t^3 + b_x * t^2 + c_x * t + d_x ;
> > f_y := a_y * t^3 + ... ;
> > f_z := ... ;
> >
> > int(sqrt(diff(f_x,t)^2 + diff(f_y,t)^2 + diff(f_z,t)^2),t) ;
> >
> > Try feeding that to Maple and see if it chokes :-)
> >
> > Bye for now,
> > Mike Andrews.
> >
> > Andrew Clinton wrote:
> > >
> > > Exact length of a cubic f(x) = a*x^3 + b*x^2 + c*x + d:
> > > http://www.eng.uwaterloo.ca/~ajclinto/test.html
> > >
> > > assuming you have x=0 and x=1 as the bounds of the segment (and maybe a=1) it
> > > would become SLIGHTly simpler, but I still doubt whether there would be any
> > > practical use for this mess.
> > >
> > > Andrew C
> > >
> > > "Tony[B]" wrote:
> > >
> > > > How can I get an exact/closely approximated measure of the distance traveled
> > > > along a spline and the total length of it? I am using a cubic_spline in
> > > > MegaPOV.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Fabian BRAU <Fab### [at] umh ac be> wrote:
> Could you give me the form of the function (this mathematical form)?
Here is the way I derived the basic cubic spline function, the constraints
being the two end-points and two end-tangents of the curve segment (known as
a Hermite curve). The various cubic interpolating splines (e.g.
Catmull-Rom, cardinal, Bezier, Kochanek-Bartels/TCB) can be easily converted
to this simple definition, where p(t) returns the posiition (p) at the time
(t, with 0 <= t <= 1).
Let p(t) be cubic polynomial => p(t) = a*t^3 + b*t^2 + c*t + d
Let end-points be P0 and P1 => p(0) = P0, p(1) = P1
Let end-tangents be T0 and T1 => p'(0) = T0, p'(1) = T1
=> P0 = d
P1 = a + b + c + d
T0 = c
T1 = 3*a + 2*b + c
Solve for a, b, c, d:
a = 2*(P0 - P1) + T0 + T1
b = 3*(P1 - P0) - 2*T0 - T1
c = T0
d = P0
Subsitute a, b, c, d into p(t), giving general Hermite curve:
=> p(t) = (2*(P0 - P1) + T0 + T1)*t^3 + (3*(P1 - P0) - 2*T0 - T1)*t^2
+ T0*t + P0
= T0 * (t^3 - 2*t^2 + t) + P0*(2*t^3 - 3*t^2 + 1) +
P1*(3*t^2 - 2*t^3) + T1*(t^3 - t^2)
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |