POV-Ray : Newsgroups : povray.general : Place and orient objects along spline : Re: Place and orient objects along spline Server Time
21 May 2024 06:32:45 EDT (-0400)
  Re: Place and orient objects along spline  
From: Andrew Cocker
Date: 5 Sep 2002 10:10:00
Message: <3d7765b8$1@news.povray.org>
Hi once more :-)

Thankyou. I shall try this and hopefully I'll manage ok.

...but I 'may' be back.. ;-)

All the best,

Andy Cocker

"ABX" <abx### [at] abxartpl> wrote in message
news:ttoenucoq6fcgkun57la24s9ia4ij5o573@4ax.com...
> On Thu, 5 Sep 2002 14:24:01 +0100, "Andrew Cocker" <mai### [at] andrewcockercouk>
> wrote:
> > Hi ABX,
>
> Hi again :-)
>
> > Ok, I've just spent an hour or two trying to get these macros to work
>
> Yes, there was two mistakes I somehow left and there was actually one (already
> know) 3.5 bug influence. Try below complete scene:
>
> #include "transforms.inc"
> #include "shapes.inc"
> #include "strings.inc"
>
> #macro Time_To_Length_Converter(Spline,Min,Max,Accuracy)
>   #local Conversion=function{spline{
>     #local Last=Spline(Min);
>     #local Length=0;
>     #local C=Min;
>     #while (C<=Max)
>       #local C=min(C,Max);
>       #local Point=Spline(C);
>       #local Length=Length+vlength(Point-Last);
>       #local Last=Point;
>       C , <1,0,0>*Length
>       #local C=C+Accuracy;
>     #end
>   }};
>   function(T){Conversion(T).x}
> #end
>
> #macro Spline_With_Linear_Movement(Spline,Min,Max,Accuracy)
>   spline{
>     #local Last=Spline(Min);
>     #local Length=0;
>     #local C=Min;
>     #while (C<=Max)
>       #local C=min(C,Max);
>       #local Point=Spline(C);
>       #local Length=Length+vlength(Point-Last);
>       #local Last=Point;
>       Length , Point+<0,0,0>
>       #local C=C+Accuracy;
>     #end
>   }
> #end
>
> #declare MySpline = spline {
>    cubic_spline
>    -1,<-1,1,0>,
>    0,<0,1,0>,
>    0.3, <2,0.7,-2>,
>    0.6,<3,-0.8,-3>,
>    0.85,<0,-0.8,-3.5>,
>    1,<-1,-0.8,-3.72>,
>    1.1,<-2,-0.8,-3.75>
>   }
>
> #declare MySplineLinear = Spline_With_Linear_Movement(MySpline,0,1,0.001);
> #declare f_MySplineLength = Time_To_Length_Converter(MySpline,0,1,0.001);
> #declare MySplineLength = f_MySplineLength(1);
>
> #declare MyObject = cone {0 .2 <0,0,.2> 0.15 pigment{rgb 1}};
>
> #declare Step=MySplineLength/20;
>
> #declare All=union{
>   #declare Count=0;
>   #while (Count<=MySplineLength-Step)
>     object {
>       MyObject
>       pigment { rgb <1,.3,.7>}
>       Spline_Trans(MySplineLinear, Count, y, 0.1, 0.1)
>     }
>     #declare Count=Count+Step;
>   #end
>   rotate x*90
> }
>
> object{
>   Center_Object(All,1)
>   translate z*5
> }
>
> background{1}
> light_source{y*100 1}
>
>
> ABX


Post a reply to this message

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