POV-Ray : Newsgroups : povray.general : Help on Splines : Re: Help on Splines Server Time
1 Aug 2024 16:27:16 EDT (-0400)
  Re: Help on Splines  
From: Mike Williams
Date: 20 Jul 2005 13:11:33
Message: <M$3QgEA9Mo3CFwJH@econym.demon.co.uk>
Wasn't it Chrisir who wrote:
>
>
>Hello!
>
>I am looking for a function that helps me with splines.
>
>I want to give the function the ***exact*** start point (x1,y1,z1) and end
>point (x2,y2,z2) of an spline and the height (h) of it - nothing more.
>

>
>All other things should be figured out by the function.
>The spline stands in a right angle to plane below.
>
>
>The stuff in the function should be something similar to what you see below
>the message.
>A sphere i moved along the spline.
>
>The Problem is to get the points ***exactly*** to a given start and end
>position (x,y,z). I'd line to begin the first sphere exact at (above) the
>star-point xyz.
>
>I really like to have a functon doing it.

How about a macro? As well as the start and end point, I've added a
Height parameter because it would be tricky to adjust the height with a
"scale" operation if the start and end point were at different heights.


#macro USpline(P1,P2,Height)
  spline {
    cubic_spline
    -1,P1-y
     0,P1
     0.5, (P1+P2/2 + y*Height)
     1,P2
     2,P2-y
  }
#end

#declare MSpline = USpline(<-.87,1.05,-.85>, <.64, 1.1,.6>, 0.5)

#declare ctr = 0;
#while (ctr < 1)
  sphere {
    MSpline(ctr), .05
    pigment { rgb <0.5,1,0> }
  }
  #declare ctr = ctr + 0.01;
#end


-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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