POV-Ray : Newsgroups : povray.general : Star Macro : Re: Star Macro Server Time
11 Aug 2024 05:11:54 EDT (-0400)
  Re: Star Macro  
From: Chris Colefax
Date: 11 Oct 1999 20:26:17
Message: <38028029@news.povray.org>
Brendan Ryan <ary### [at] global2000net> wrote:
> I tried to divide every other vector by ptmove but it didn't work. This
code
> rotates and moves the odd numbered points and just rotates the even
numbered
> points. The code is in a while loop. Rotation_no and point_no both get
added
> to one at the end.
> Brendan Ryan
>
> #local determine = (point_no/2)-int(point_no/2);
> #switch (determine)
> #case (0.5)  file://odd numbered point
> #local vec =vrotate(<0,1,0>,<0,0,(angle_of_rotation*rotation_no)>/ptmove);
> #break
> #case (0) file://even numbered point
> #local vec=vrotate(<0,1,0>,<0,0,angle_of_rotation*rotation_no>);
> #break
> #end

As Kevin pointed out, what you've divided is the rotation angle, so every
second point will be *rotated* half as much as it should be (still at the
same radius), rather than scaled.  Also, the switch you've used is not
necessary, as you can actually use a counter variable that increments in
steps other than 1, eg:

#macro star_prism (Sides, StarFactor, Height1, Height2)
  #local RotAngle = 360/Sides;
  prism {linear_sweep linear_spline Height1, Height2, Sides+1, x,
    #local Count = 0.5; #while (Count < Sides)
      vrotate (x/StarFactor, y*RotAngle*Count),
    #local Count = Count + 0.5;
      vrotate (x, y*RotAngle*Count),
    #local Count = Count + 0.5; #end
    x}
#end


Post a reply to this message

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