POV-Ray : Newsgroups : povray.general : spline length? Server Time
6 Aug 2024 12:20:23 EDT (-0400)
  spline length? (Message 1 to 10 of 12)  
Goto Latest 10 Messages Next 2 Messages >>>
From: Barron Gillon
Subject: spline length?
Date: 4 Apr 2002 19:48:20
Message: <3cacf454@news.povray.org>
Is there any built in way to find the exact length of a spline in POV 3.5?
A linear spline would be easy enough, but with the curves it may be a bit
more difficult...  Surely POV has some intrnal function to figure it out,
but is there a way to find the length of a random spline at run-time?


Post a reply to this message

From: Mark Wagner
Subject: Re: spline length?
Date: 5 Apr 2002 01:19:54
Message: <3cad420a@news.povray.org>
Barron Gillon wrote in message <3cacf454@news.povray.org>...
>Is there any built in way to find the exact length of a spline in POV 3.5?
>A linear spline would be easy enough, but with the curves it may be a bit
>more difficult...  Surely POV has some intrnal function to figure it out,
>but is there a way to find the length of a random spline at run-time?

POV-Ray doesn't know or care about the length of a spline.  In fact, I don't
know if it's even possible to calculate the exact length of a cubic or
natural spline.

--
Mark


Post a reply to this message

From: Chris Colefax
Subject: Re: spline length?
Date: 5 Apr 2002 01:28:48
Message: <3cad4420@news.povray.org>
Barron Gillon wrote in message <3cacf454@news.povray.org>...
>Is there any built in way to find the exact length of a spline in POV 3.5?

Mark Wagner <mar### [at] gtenet> replied:
> POV-Ray doesn't know or care about the length of a spline.  In fact, I
don't
> know if it's even possible to calculate the exact length of a cubic or
> natural spline.

I don't believe it is - from my studies of splines a while back it seems the
integration of the relevant functions just isn't possible.  The easiest way
to find a spline's length, then, is probably sampling linear distances at
steps along the spline.  Also, a rough approximation can be calculated using
the bezier hull length.  My own Spline Macro File
(http://www.geocities.com/ccolefax) uses both methods to allow returning the
length of splines and other features like constant-speed traversing of
spline paths.


Post a reply to this message

From: Warp
Subject: Re: spline length?
Date: 5 Apr 2002 06:07:19
Message: <3cad8567@news.povray.org>
Chris Colefax <chr### [at] tagpovrayorg> wrote:
> The easiest way
> to find a spline's length, then, is probably sampling linear distances at
> steps along the spline.

  Isn't the main problem with this that it always returns a value which
is too small? (Although usually it doesn't matter as long as it's close
enough to the true value...)

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

From: Jan Walzer
Subject: Re: spline length?
Date: 5 Apr 2002 08:46:54
Message: <3cadaace@news.povray.org>
"Warp" <war### [at] tagpovrayorg> wrote:
>   Isn't the main problem with this that it always returns a value which
> is too small? (Although usually it doesn't matter as long as it's close
> enough to the true value...)

probably ...
because, if you do a linear-interpolation between the two points,
it is quite uncertain, that the way-on-spline is shorter ...   No?


Post a reply to this message

From: Warp
Subject: Re: spline length?
Date: 5 Apr 2002 10:20:57
Message: <3cadc0d8@news.povray.org>
Jan Walzer <jan### [at] lzernet> wrote:
> because, if you do a linear-interpolation between the two points,
> it is quite uncertain, that the way-on-spline is shorter ...   No?

  A line is the shortest distance between two points. This means that any
other path is longer. Thus the spline can never be shorter than the linear
estimate. As a spline seldom consists of straight lines (except for the
linear spline), it's always longer than the linear estimate.

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

From: Gleb
Subject: Re: spline length?
Date: 5 Apr 2002 10:35:00
Message: <3cadc424$1@news.povray.org>
"Chris Colefax" <chr### [at] tagpovrayorg> wrote in message
news:3cad4420@news.povray.org...
> to find a spline's length, then, is probably sampling linear distances at
> steps along the spline.  Also, a rough approximation can be calculated
using
> the bezier hull length.

Is it the same approximation method as mentioned in
http://research.microsoft.com/~hollasch/cgindex/curves/cbezarclen.html  ?

Regards,

Gleb


Post a reply to this message

From: Jan Walzer
Subject: Re: spline length?
Date: 5 Apr 2002 10:51:38
Message: <3cadc80a@news.povray.org>
"Warp" <war### [at] tagpovrayorg> wrote:
> > because, if you do a linear-interpolation between the two points,
> > it is quite uncertain, that the way-on-spline is shorter ...   No?
>
>   A line is the shortest distance between two points. This means that any
> other path is longer. Thus the spline can never be shorter than the linear
> estimate. As a spline seldom consists of straight lines (except for the
> linear spline), it's always longer than the linear estimate.

seems we're telling each other to be right ...


Post a reply to this message

From: John VanSickle
Subject: Re: spline length?
Date: 5 Apr 2002 13:36:42
Message: <3CADEFA0.F3015659@hotmail.com>
Chris Colefax wrote:
> 
> I don't believe it is - from my studies of splines a while back it
> seems the integration of the relevant functions just isn't possible.

A quadratic spline

  P(x) = Ax^2 + Bx + C

has the derivative in x of

  dP(x)/dx = 2Ax + B

which has a magnitude of

  sqrt( 4(A.A)x^2 + 4(A.B)x + (B.B) ),

which can be integrated over x (the integral is in my calc book).

A cubic spline,

  P(x) = Ax^3 + Bx^2 + CX + D

Will have a quadratic derivative in x, namely

  dP/dx = 3Ax^2 + 2Bx + C

The magnitude of which is

  |dP/dx| = sqrt( 9(A.A)x^4  + 12(A.B)x^3 +  4(B.B)x^2 +  6(A.C)x^2
     +  4(B.C)x +   (C.C) )

Dunno if this can be integrated over x.  Taylor's expansion might
provide a clue to the integral.

Regards,
John
-- 
Rusty is rendering!


Post a reply to this message

From: Warp
Subject: Re: spline length?
Date: 6 Apr 2002 07:41:55
Message: <3caeed12@news.povray.org>
Jan Walzer <jan### [at] lzernet> wrote:
> seems we're telling each other to be right ...

  I wasn't saying "no, you are wrong, it's this way". I was just profundizing
in the subject. :)

-- 
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}//  - Warp -


Post a reply to this message

Goto Latest 10 Messages Next 2 Messages >>>

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