POV-Ray : Newsgroups : povray.beta-test : Spline inconsistencies Server Time
30 Jul 2024 06:29:58 EDT (-0400)
  Spline inconsistencies (Message 25 to 34 of 54)  
<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>
From: Warp
Subject: Re: Spline inconsistencies
Date: 22 Feb 2002 05:20:44
Message: <3c761b7b@news.povray.org>
Rune <run### [at] mobilixnetdk> wrote:
> But for basic spline usage, the syntax and use is much easier with the
> spline{} feature.

  I strongly disagree.
  Suppose that you are making a spline with evenly-distributed time values:

spline
{ cubic_spline
  0, <1,1,1>
  .25, <2,2,2>
  .5, <3,3,3>
  .75, <4,4,4>
  1, <5,5,5>
}

  You test this and you decide that you want one point more between <3,3,3>
and <4,4,4>.
  Oops! Now you have to modify *all* the time values to get them again
evenly-distributed. You end up doing something like this:

spline
{ cubic_spline
  0/5, <1,1,1>
  1/5, <2,2,2>
  2/5, <3,3,3>
  3/5, <3.5,3.5,3.5>
  4/5, <4,4,4>
  5/5, <5,5,5>
}

  Every time you add or remove a point, you have to modify *all* the time
values to get the desired result.
  If you do this long enough, you'll get tired and automatize a bit:

#declare Points = array[6]
{ <1,1,1>, <2,2,2>, <3,3,3>, <3.5,3.5,3.5>, <4,4,4>, <5,5,5> }

spline
{ cubic_spline
  #declare Ind = 0;
  #declare EndInd = dimension_size(Points, 1)-1;
  #while(Ind <= EndInd)
    Ind/EndInd, Point[Ind]
    #declare Ind = Ind+1;
  #end
}

  But with an existing macro you can achieve the same thing with a lot less
work. For example:

#declare Points = array[6]
{ <1,1,1>, <2,2,2>, <3,3,3>, <3.5,3.5,3.5>, <4,4,4>, <5,5,5> }

CreateSpline(Points)

  Using the current spline syntax is certainly not "much easier". In fact,
it's a lot more tedious and difficult.

-- 
#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

From: Warp
Subject: Re: Spline inconsistencies
Date: 22 Feb 2002 05:21:21
Message: <3c761ba0@news.povray.org>

> Your ideas could be simple realized via macros.

  How?

-- 
#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:
Subject: Re: Spline inconsistencies
Date: 22 Feb 2002 05:39:28
Message: <9v6c7uca2nlhh53kjqq66a993scqra9pj1@4ax.com>
On 22 Feb 2002 05:21:21 -0500, Warp <war### [at] tagpovrayorg> wrote:
>W?odzimierz ABX Skiba <abx### [at] babilonorg> wrote:
> > Your ideas could be simple realized via macros.
>
>  How?

#version 3.5;
#include "strings.inc"

#macro Make_List()
  #local N=dimension_size(Array,1);
  #local C=N;
  #while(C)
    #local C=C-1;
    From+C*(To-From)/(N-1) Array[C]
  #end
#end

#macro Distribution(From,To,Array)
  spline{Make_List()}
#end

#macro Add_Distribution(Spline,From,To,Array)
  #declare Spline=spline{Spline Make_List()}
#end

// create spline with first distribution
#local Spline=Distribution(0,1,array[3]{<0,0,0><1,0,0><2,1,0>})
// add distribution to spline
// note you can mix ranges, overwrite and mix
Add_Distribution(Spline,1,2,array[3]{<2,1,0><3,2,1><2,2,2>})

// testing

#debug VStr((Spline(0)))
#debug "\n"
#debug VStr((Spline(.5)))
#debug "\n"
#debug VStr((Spline(1)))
#debug "\n"
#debug VStr((Spline(1.5)))
#debug "\n"
#debug VStr((Spline(2)))
#debug "\n"

// ABX


Post a reply to this message

From:
Subject: Re: Spline inconsistencies
Date: 22 Feb 2002 06:03:48
Message: <pn8c7uktkb6mkbi0ibcr732ndapmv4j59b@4ax.com>

wrote:
>// note you can mix ranges, overwrite and mix

// mix, overwrite and overlap

Note also I didn't write spline type in any place becouse it can be forced at
calculation stage.

The only thing I wonder about splines - why they are designed with { when they
are just vector functions.

And one feature request (it best fits in this thread): result is a vector -
why not allow to influence dimension of this result with dimension if input ?
I mean why not allow 2D or 5D vectors in input list ? First entry in spline
could describe dimension of result just like for arrays. This could extend
spline for use with rgbtf values and many other applications.

ABX


Post a reply to this message

From: Christoph Hormann
Subject: Re: Spline inconsistencies
Date: 22 Feb 2002 06:06:53
Message: <3C76264B.ABF23562@gmx.de>
Warp wrote:
> 
> [...]
> 
>   I personally find the spline include files so much more useful than I'll
> probably never be using the internal ones.
>   It won't be a step back for me.

And what about spline functions?

Not being able to use splines in isosurface functions would be really bad
IMO.

Christoph

-- 
POV-Ray tutorials, IsoWood include,                 
TransSkin and more: http://www.tu-bs.de/~y0013390/  
Last updated 21 Feb. 2002 _____./\/^>_*_<^\/\.______


Post a reply to this message

From: Warp
Subject: Re: Spline inconsistencies
Date: 22 Feb 2002 06:16:10
Message: <3c76287a@news.povray.org>

> #local Spline=Distribution(0,1,array[3]{<0,0,0><1,0,0><2,1,0>})
> Add_Distribution(Spline,1,2,array[3]{<2,1,0><3,2,1><2,2,2>})

  That's quite longer. And it needs you to repeat points (<2,1,0> above).
  Compare to the equivalent in my proposal:

#local Spline=spline{ {0,<0,0,0>} <1,0,0> {1,<2,1,0>} <3,2,1> {2,<2,2,2>} }

(And that {1,<2,1,0>} could just be <2,1,0>, but I wanted it to be completely
equivalent to your example.)

-- 
#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: Warp
Subject: Re: Spline inconsistencies
Date: 22 Feb 2002 06:18:24
Message: <3c762900@news.povray.org>
Christoph Hormann <chr### [at] gmxde> wrote:
> Not being able to use splines in isosurface functions would be really bad
> IMO.

  How do you use splines in isosurface functions?

-- 
#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

From:
Subject: Re: Spline inconsistencies
Date: 22 Feb 2002 06:28:28
Message: <aeac7u4rl4m01ud3gt5idacjkn4le16tpf@4ax.com>
On 22 Feb 2002 06:16:10 -0500, Warp <war### [at] tagpovrayorg> wrote:
> That's quite longer.

But possible in simple way. And anybody can modify this macro to distribute
points of array with parameter distributed other way (t^2, sqrt(t)).

> And it needs you to repeat points (<2,1,0> above).

Well, is this realy problem ? You can create main keys as variables. There is
many solutions in POV basad on storing things in variables.

> Compare to the equivalent in my proposal:
> #local Spline=spline{ {0,<0,0,0>} <1,0,0> {1,<2,1,0>} <3,2,1> {2,<2,2,2>} }

looks like alternative and interesting solution

ABX


Post a reply to this message

From: Christoph Hormann
Subject: Re: Spline inconsistencies
Date: 22 Feb 2002 06:29:33
Message: <3C762B9C.992660DD@gmx.de>
Warp wrote:
> 
>   How do you use splines in isosurface functions?
> 

http://www.povray.org/working-docs/id000141.html#6_1_6_3
http://www.econym.demon.co.uk/isotut/more.htm

Christoph

-- 
POV-Ray tutorials, IsoWood include,                 
TransSkin and more: http://www.tu-bs.de/~y0013390/  
Last updated 21 Feb. 2002 _____./\/^>_*_<^\/\.______


Post a reply to this message

From:
Subject: Re: Spline inconsistencies
Date: 22 Feb 2002 06:34:41
Message: <n4bc7u0diq1nj83l4d1mj4g304v57fo8vg@4ax.com>
On 22 Feb 2002 06:18:24 -0500, Warp <war### [at] tagpovrayorg> wrote:
>  How do you use splines in isosurface functions?

http://news.povray.org/0fm17ucj8h2rpb7u6ia5r5kuvd7ql58jb2%404ax.com

ABX


Post a reply to this message

<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>

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