POV-Ray : Newsgroups : povray.beta-test : Spline inconsistencies : Re: Spline inconsistencies Server Time
30 Jul 2024 06:22:09 EDT (-0400)
  Re: Spline inconsistencies  
From: Warp
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

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