POV-Ray : Newsgroups : povray.general : Cubic spline question Server Time
6 Aug 2024 21:38:16 EDT (-0400)
  Cubic spline question (Message 8 to 17 of 17)  
<<< Previous 7 Messages Goto Initial 10 Messages
From: Kari Kivisalo
Subject: Re: Cubic spline question
Date: 17 Feb 2002 03:04:19
Message: <3C6F644A.5E797131@engineer.com>
Mark Wagner wrote:

> 1) The function is constructed from a number of cubic polynomial pieces
> 2) The function is continuous
> 3) The first derivative of the function is continuous
> 4) The second derivative of the function is continuous
> 5) The function passes through all control points
> 6) The second derivative of the function is zero at the first and last
> control points

I can verify that cubic_spline in beta 11 meets these specifications.
Differences between splines through random 3D point sets produced by spline{}
and my lspline3 macro are too small to be noticed.


_____________
Kari Kivisalo


Post a reply to this message

From: Rune
Subject: Re: Cubic spline question
Date: 17 Feb 2002 03:56:46
Message: <3c6f704e@news.povray.org>
"Mark Wagner" wrote:
> I am getting quite tired of repeatedly having to
> defend my decision on how cubic splines work.
> Rune, for the record, this is the third time I
> have explained this to you.

I didn't know that, because the way the cubic splines have been worked have
been changing many times.

I acknowledge that I there's many things in this issue I don't know, so
that's why I asked. Ok, so the splines in the spline{} are indeed cubic
splines, just a different type than the splines used in prisms, which are
also labeled cubic splines.

> Rune, if you'll look at the image you attached to the post
> "Yet another spline bug", posted on 8/29/01 in the
> povray.pre-beta.binaries group, you'll see what happens
> when you produce a curve by this method. From looking at
> the code for the prism object, it appears that this is the
> method used by that object.

Sorry, but the sharp corners in the image I posted on 8/29/01 in the
povray.pre-beta.binaries group were caused by a buggy implementation rather
than the spline type itself. FYI prisms do not have such sharp corners.

Here are the problems I have with the current situation:

Cubic splines are a broad class of spline types, yet in both prisms and
spline{} it means a very specific spline. This wouldn't matter so much if it
was the same one in all features of POV-Ray, but to have the word
cubic_spline mean different things in different context is very inconsistent
and is bound to cause confusion.

The natural cubic splines are very difficult to control. Once you have
gotten one segment to look just right, it can be ruined by any of the next
control points added. One serious result of this is that it's nearly
impossible to make a smoothly closed (looping) spline. When using the spline
type in prisms there's an easy rule to follow which is that the first three
an last points should be identical. But with natural cubic splines I have
yet to succeed to make a loop. Can anybody explain how to do it? Perhaps it
would be a good idea if it was explained in the documentation how to make a
smoothly closed spline with this spline type. It would be very relevant!

The best solution in my opinion would be to call the natural cubic spline by
another name maybe "natural_cubic_spline" and then also have support for the
cubic spline type used in prisms, which is easier to control. But of course,
as usual the answer is "please code it yourself" so I guess there's no hope
of seeing that implemented.

Rune
--
3D images and anims, include files, tutorials and more:
Rune's World:    http://rsj.mobilixnet.dk (updated Feb 16)
POV-Ray Users:   http://rsj.mobilixnet.dk/povrayusers/
POV-Ray Webring: http://webring.povray.co.uk


Post a reply to this message

From: Mark Wagner
Subject: Re: Cubic spline question
Date: 17 Feb 2002 06:06:41
Message: <3c6f8ec1$1@news.povray.org>
Rune wrote in message <3c6f704e@news.povray.org>...
>Here are the problems I have with the current situation:
>
>Cubic splines are a broad class of spline types, yet in both prisms and
>spline{} it means a very specific spline. This wouldn't matter so much if
it
>was the same one in all features of POV-Ray, but to have the word
>cubic_spline mean different things in different context is very
inconsistent
>and is bound to cause confusion.

If I knew for certain what sort of cubic spline is used in "prism", I'd be
able to duplicate it and add it as another type of pure spline.

--
Mark


Post a reply to this message

From: ingo
Subject: Re: Cubic spline question
Date: 17 Feb 2002 06:41:54
Message: <Xns91B8817AE8F1Cseed7@povray.org>
On 2002 02 17, you wrote in povray.general:

> If I knew for certain what sort of cubic spline is used in "prism",
> I'd be able to duplicate it and add it as another type of pure
> spline. 
> 

If I understand the source right it indeed is a Catmull-Rom spline:

 CatMul Rom basis Matrix (hits every input vector)
 As T goes from 0 to 1 you go from n to n+1
          n-1      n   n+1   n+2
   T^3     -1     +3    -3    +1     /
   T^2     +2     -5     4    -1    /
   T^1     -1      0     1     0   /  2 (divisor)
   T^0      0      2     0     0  /


In that case, could you use the spheresweep code?

Also IMO in the spheresweep the camul_rom_spline keyword should be 
replaced by cubic_spline. In the docs we can then make clear that what 
is 
called a cubic spline in POV-Ray is the catmull-rom spline.


I posted a basic file on splines, that shows the matrices and the their 
in:

Newsgroups: povray.binaries.tutorials
Subject: Splines.bas
From: ingo <ing### [at] homenl>
Message-ID: <Xns### [at] povrayorg>
Date: 17 Feb 2002 06:35:16 -0500
Xref: news.povray.org povray.binaries.tutorials:1289


Ingo

p.s. (sorry Mark, hit a wrong button, so you also got it by mail)


Post a reply to this message

From: Rune
Subject: Re: Cubic spline question
Date: 17 Feb 2002 07:07:17
Message: <3c6f9cf5@news.povray.org>
"Mark Wagner" wrote:
> If I knew for certain what sort of cubic spline is used
> in "prism", I'd be able to duplicate it and add it as
> another type of pure spline.

I'm very happy to hear that.

I hope Ingo's reply is of help to you. I myself know something about splines
as a user, but my knowledge of splines from a developer's point of view is
rather limited.

Rune
--
3D images and anims, include files, tutorials and more:
Rune's World:    http://rsj.mobilixnet.dk (updated Feb 16)
POV-Ray Users:   http://rsj.mobilixnet.dk/povrayusers/
POV-Ray Webring: http://webring.povray.co.uk


Post a reply to this message

From: Rune
Subject: Re: Cubic spline question
Date: 17 Feb 2002 07:07:22
Message: <3c6f9cfa@news.povray.org>
"ingo" wrote:
> Also IMO in the spheresweep the camul_rom_spline keyword
> should be replaced by cubic_spline. In the docs we can
> then make clear that what is called a cubic spline in
> POV-Ray is the catmull-rom spline.

I agree this would be a good idea.

However, another option would be to use the keyword catmull_rom_spline
everywhere that spline type is used, including in prisms. That might be a
more logical choice if more than one type of cubic splines are implemented
in POV-Ray. cubic_spline used in prisms should still be a valid keyword for
backwards compatibility, but should work the same way as catmull_rom_spline.

In spline{} and sphere_sweep{} the keyword cubic_spline shouldn't be allowed
at all (as there's no backwards compatibility issue), and instead the
keywords catmull_rom_spline and perhaps natural_cubic_spline or something
like that should be used instead.

This is just a suggestion.

Rune
--
3D images and anims, include files, tutorials and more:
Rune's World:    http://rsj.mobilixnet.dk (updated Feb 16)
POV-Ray Users:   http://rsj.mobilixnet.dk/povrayusers/
POV-Ray Webring: http://webring.povray.co.uk


Post a reply to this message

From: Mark Wagner
Subject: Re: Cubic spline question
Date: 18 Feb 2002 00:38:00
Message: <3c709338@news.povray.org>
ingo wrote in message ...
>On 2002 02 17, you wrote in povray.general:
>
>> If I knew for certain what sort of cubic spline is used in "prism",
>> I'd be able to duplicate it and add it as another type of pure
>> spline.
>>
>
>If I understand the source right it indeed is a Catmull-Rom spline:

I've looked up some information on Catmull-Rom splines on the Internet, and
it looks like they fit properties 1, 2, 3, and 5 from my earlier list.
Catmull-Rom splines do not, however, have a continuous second derivative.
Since part of the reason I implemented cubic splines the way I did was to
get a function with a continuous second derivative, I won't replace the
existing cubic splines with Catmull-Rom splines.  It should, however, be
easy enough to add Catmull-Rom interpolation to the various spline
interpolation methods.

--
Mark


Post a reply to this message

From:
Subject: Re: Cubic spline question
Date: 18 Feb 2002 05:49:21
Message: <j4j17u0sbm72id5dffh7bnsr9g9cu92f1k@4ax.com>
On Fri, 15 Feb 2002 23:20:56 +0100, "Rune" <run### [at] mobilixnetdk>
wrote:
> I'm getting confused by cubic splines.

Rune, In general I agree with you that one spline_type_name should always
produce the same shape apart from place of use. When name specifies not exact
type but class of types then perhaps it's good idea to modify name. I think it
could be great when the way how splines are defined would be somehow unified
(for example I don't understand why I have to write number of points for
splines in objects while I haven't to in splin{} syntax - I prefer spline{}
behaviour in this case). I think also it could be great when all places where
some splines can be used would accept all builded types of splines. I'm even
so radical in this that I think it could be great if ttfs could be imported as
splines and avilable for anything and then create object as prism. But it
sounds more like modeller not raytracer :-)

If you really need to have spline and lathe/prism with the same shape then
there is no problem (as advenced user as you shouldn't have problems with
obvious creation with mesh). Anyway, I prepared some iso-conversion example
for other confused users less advanced than you.

Iso-lathe has all features of lathe{} except it can't have more than two
values for the same y (in basic form, perhaps after modifications this
limitations could be removed). Rendering of this iso-lathe alone is rather
fast.

Iso-prism (or rather parametric-prism) has no inside and is always open but
spline can be not closed. Rendering of this prism clone is rather slow.

Script available at:
http://news.povray.org/3oj17ukbdclmo92oljkd1pisr6ubsaasf2%404ax.com
Preview available at:
http://news.povray.org/0fm17ucj8h2rpb7u6ia5r5kuvd7ql58jb2%404ax.com

ABX
--
disc{z,-z 5#macro O()asc(substr("-+((1*(,1,/.-,*/(,&.323/'1"e,1))*.1-4#declare
e=e-1;#end#local e=26;pigment{#local g=function(_){ceil(_)-_}function#local//X
k=function{pattern{object{sphere_sweep{linear_spline 13#while(e>0)<O(),O()//AB
>.01#end}}}}{k(g(atan2(x,y)),g(ln((y+x)^2+1e-5)),0)}}finish{ambient 1}}//POV35


Post a reply to this message

From:
Subject: Re: Cubic spline question
Date: 18 Feb 2002 06:05:58
Message: <bmn17ugj054v0el2jed8jbnfpkkvjbhjnc@4ax.com>
On 17 Feb 2002 06:41:54 -0500, ingo <ing### [at] homenl> wrote:
> I posted a basic file on splines, that shows the matrices

Interesting, in the file you posted in the list of spline types there is an
entry:

Spline10:  IType=10 : GOTO Spline  ' Bezier (quadratic)

In 3.5 we have two tokens: bezier_spline and quadratic_spline - is it
situation when the same shape is produced under different names? Or is
quadratic_spline class of splines just like cubic_spline ?

ABX


Post a reply to this message

From: ingo
Subject: Re: Cubic spline question
Date: 18 Feb 2002 07:40:18
Message: <Xns91B98B62B3B1Fseed7@povray.org>

Skiba wrote: 

> In 3.5 we have two tokens: bezier_spline and quadratic_spline - is it
> situation when the same shape is produced under different names?

No, the bezier used in POV-Ray is cubic.

> Or is quadratic_spline class of splines just like cubic_spline ?

Yes

An interesting introduction on splines:
http://www.ddt.pwp.blueyonder.co.uk/evgeny/Intro/Intro.htm

Ingo


Post a reply to this message

<<< Previous 7 Messages Goto Initial 10 Messages

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