POV-Ray : Newsgroups : povray.general : Spline parameters : Re: Spline parameters Server Time
30 Jul 2024 12:20:04 EDT (-0400)
  Re: Spline parameters  
From: Peter Hertel
Date: 24 Feb 2009 12:25:00
Message: <web.49a42cf2cf14bf602611931b0@news.povray.org>
"twister" <twi### [at] o2pl> wrote:
> Where will I find some helpful informationa about spline declarations?
> Because otherwise I don't know what I do. Thanks in advance.

Hi!
Have you read the documentation? - 2.3.1.1.1  Understanding The Concept of
Splines That's what made it click for me, as Chris B says.
I believe your problem might be related to the invisible control/shape points in
non-linear splines. Anyway, here's some example code on how I like to use
splines. I hope it's helpful.

-Peter


camera{location <3,1,-4> look_at <2,1,0>}
light_source{<1,2,-3>,1}

#local SP = 3; // SplinePoints
// Number of visible/real points in spline (not counting 0)
// Increase this as you increase the points in the spline
// declaration below, and it will automatically place the
// points in an evenly space between 0 and 1.

#local Resolution = 0.01;
// Increase/decrease to pick out less/more points from the
// spline. Try 0.1 or even 0.3-clock*0.25 and command line:
// +k +kff99

#declare Snake = spline{
cubic_spline
-1/SP,<-1,0,-1>, // Shape/control point

0/SP,<0,0,0>,
1/SP,<1,1,0>,
2/SP,<2,1,1>,
3/SP,<3,0,0>,

(SP+1)/SP,<4,-1,-1> // Shape/control point
}

// And now, a small while loop to demonstrate.
#local Variable = 0;
#while (Variable < 1)

        #local Point = Snake(Variable);

        sphere{Point,0.1 pigment {rgb y}}

        #ifdef(Point2)
                cylinder{Point,Point2,0.1 pigment {rgb y}}
        #end

        #local Point2 = Point;


#local Variable = Variable+Resolution;
#end


Post a reply to this message

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