POV-Ray : Newsgroups : povray.general : how do I make a closed spline? : Re: how do I make a closed spline? Server Time
6 Aug 2024 16:56:01 EDT (-0400)
  Re: how do I make a closed spline?  
From:
Date: 17 Feb 2002 06:08:47
Message: <7g2v6usa948nojl7tsqncosg81rr4ed7b7@4ax.com>
On Sun, 17 Feb 2002 09:55:16 +0100, "Rune" <run### [at] mobilixnetdk>
wrote:
> Using the cubic spline in the spline{} feature in POV-Ray 3.5, which rules
> should I follow in order to get a smoothly closed spline?

considering that answer posted in
http://news.povray.org/3c6df3f6%241%40news.povray.org
is true then : if you want closed smooth spline drawed from M1 to Mn where M1
and Mn are inputs of spline then create spline with below rules:

spline{
cubic_spline
M0,V0
M1,V1
M2,V2
.............. // other points
Mn-1,V0 // note -1 is decreasing of idex n, not decreasing of value Mn
Mn,V1
Mn+1,V2  // note +1 is increasing of idex n, not increasing of value Mn
}

and additional conditions:
M1-M2=Mn-Mn+1 // +1 is again index increasing not value increasing
M1-M0=Mn-Mn-1 // as above but abou decreasing
M0<M1<M2<Mn-1<Mn<Mn+1 
and in other points list you can't have Mi index in rande M0..M2 or Mn-1..Mn+1

NOTE I'm not sure it is realy true, I just wrote it according to
http://news.povray.org/3c6df3f6%241%40news.povray.org
but looks smoth in below example:

#version 3.5;
light_source{-4+9*y 1}
camera{}

#local N=6;
#local A=array[N];
#local MinR=1;
#local MaxR=2;
#local R=.1;
#local S=seed(0);
#local Step=0.005;

#local Spline=spline{
  cubic_spline
  #local C=N;
  #while(C)
    #local C=C-1;
    #local A[C]=vrotate((rand(S)*(MaxR-MinR)+MinR)*x,z*C*360/N);
    C,A[C],
  #end
  -1,A[N-1],
  N,A[0]
  N+1,A[1]
};

#local C=N;
#while(C>0)
  sphere{Spline(C) R translate z*4 pigment{rgb 1}}
  #local C=C-Step;
#end

ABX


Post a reply to this message

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