POV-Ray : Newsgroups : povray.general : Cubic spline question Server Time
6 Aug 2024 21:36:04 EDT (-0400)
  Cubic spline question (Message 11 to 17 of 17)  
<<< Previous 10 Messages Goto Initial 10 Messages
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 10 Messages Goto Initial 10 Messages

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