POV-Ray : Newsgroups : povray.unofficial.patches : MegaPOV : passing spline name to macro : MegaPOV : passing spline name to macro Server Time
30 Jun 2024 19:39:26 EDT (-0400)
  MegaPOV : passing spline name to macro  
From: Fabien Mosen
Date: 23 Mar 2003 16:24:00
Message: <3e7e25f0$1@news.povray.org>
I have a problem.  The simple scene below works perfectly in P3.5,
but stops with an error in MegaPOV 1.0, which seems to expect
some kind of parenthesis after the spline's name.  I've read MP's
docs without result.

Fabien.

//-------------------------------------
#include "colors.inc"
#include "rand.inc"

#declare R2=seed(0);

//macro to create a random spline
#macro RandSpline (NbPoints,Taille)
  #local I = 0;
  #while (I < 1)
  #local Pt = Taille*VRand(R2);
  #local Pt = Pt+<I*200,0,0>;
   I,Pt
  #local I=I+(1/NbPoints);
  #end
#end

//macro to "draw" a line along a spline
#macro FollowSpline (Spl,NbElem,Rad1)
union {
  #local Pas = (1/NbElem);
  #local I = 0;
  #while (I < 1)
   #local Pt1 = Spl(I);
   #local Pt2 = Spl(I+Pas);
   #if (Pt1.x != Pt2.x)
    cylinder {Pt1 Pt2 Rad1*0.5}
   #end
  #local I=I+Pas;
  #end
}
#end

//creation of the random spline
#declare SplCam = spline {natural_spline RandSpline (10,30)}

//"physical" representation of that spline, this is where it stops
FollowSpline (SplCam,100,1)


Post a reply to this message

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