POV-Ray : Newsgroups : povray.advanced-users : objects along a curve... ?! Server Time
25 Nov 2024 05:29:21 EST (-0500)
  objects along a curve... ?! (Message 1 to 6 of 6)  
From:  Light Beam 
Subject: objects along a curve... ?!
Date: 25 Jul 2003 09:34:36
Message: <3f2131ec@news.povray.org>
Hello,
    How to place objects along a curve with same distance between them ?
    Thx.


Post a reply to this message

From: ABX
Subject: Re: objects along a curve... ?!
Date: 25 Jul 2003 09:50:08
Message: <k6d2iv0uah08bme52unnsh1ugh34nfrq8s@4ax.com>
On Fri, 25 Jul 2003 15:34:34 +0200, "_Light_Beam_" <s.f### [at] tiscalifr> wrote:
> Hello,
>    How to place objects along a curve with same distance between them ?
>    Thx.

I hope this example will help you:

#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 = sphere{0 .1 pigment{rgb 1}};

#declare Step=MySplineLength/30;

#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

From:  Light Beam 
Subject: Re: objects along a curve... ?!
Date: 28 Jul 2003 12:42:52
Message: <3f25528c$1@news.povray.org>
Thank you ! I'll try...


Post a reply to this message

From:  Light Beam 
Subject: Re: objects along a curve... ?!
Date: 28 Jul 2003 12:44:00
Message: <3f2552d0$1@news.povray.org>
Ok ! It works !


Post a reply to this message

From:  Light Beam 
Subject: But...
Date: 28 Jul 2003 12:49:40
Message: <3f255424@news.povray.org>
How to dislabe the "banking" in the curves ? Just puting Y-oriented objects
for example ?


Post a reply to this message

From: ABX
Subject: Re: But...
Date: 28 Jul 2003 12:59:19
Message: <3claivou9ps0pq6kb3pig2es8bor27c2il@4ax.com>
On Mon, 28 Jul 2003 18:49:39 +0200, "_Light_Beam_" <s.f### [at] tiscalifr> wrote:
> How to dislabe the "banking" in the curves ? Just puting Y-oriented objects
> for example ?

I'm not familiar with "banking" term but I suppose your question is related to
call of Spline_Trans macro which is macro documented in manual. See
http://www.povray.org/documentation/view/281/

HTH

ABX


Post a reply to this message

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