POV-Ray : Newsgroups : povray.advanced-users : struggle with splines : Re: struggle with splines Server Time
6 Oct 2024 12:59:23 EDT (-0400)
  Re: struggle with splines  
From: Chris B
Date: 3 Oct 2006 18:20:06
Message: <4522e216$1@news.povray.org>
"Chrisir" <nomail@nomail> wrote in message 
news:web.4522d3275cb1df97a9bd07600@news.povray.org...
>
>
> Hello!
>
> I am just struggling with splines here.
> I have one spline then should go from P1
> to P2 (exactly), being modified by M1, M2 and M3.
>
> How can I make positively sure that my spline starts exactly
> always and definetly in P1 and ends exactly
> always and definetly in P2?
>
> I build the thing for various reasons as a macro.
> I start MySphere1, which uses MSpline.
>
> Please help.
>
> Thanks!
>
> Yours sincerely,
>
> Chris
>
>
>
>
> #macro MSpline(P1,P2,M1,M2,M3)
>
> // defines Spline
>
>  #declare MSpline1 = spline {
>    cubic_spline
>    -1,M1
>     0,P1
>     0.5,M2
>     1,P2
>     2,M3
>  }
> #end  // end of macro
>
> #macro MySphere1(P1,c1,P2,c2,M1,M2,M3) // c1 and c2 is for color.
>
>        // uses spline MSpline
>
>        #declare SphereRadius = 0.02;
>        #declare ctr = 0;
>
>        MSpline(P1,P2,M1,M2,M3);
>
>        #while (ctr < 1)
>        sphere {
>            MSpline1(ctr), SphereRadius
>            pigment { rgb c1 }
>          }
>          #declare ctr = ctr + 0.01;
>        #end   // end of while
>
> #end  // end of macro
>
>

If you specify "#while (ctr <= 1)", then I reckon it should end at P2, 
rather than one sphere before it gets to P2.

Regards,
Chris B.


Post a reply to this message

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