POV-Ray : Newsgroups : povray.general : Star Macro : Re: Star Macro Server Time
11 Aug 2024 05:12:14 EDT (-0400)
  Re: Star Macro  
From: Jerome M  BERGER
Date: 11 Oct 1999 21:20:29
Message: <38028CCE.98B99F4C@enst.fr>
Chris Colefax wrote:
> 
> 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
	Actually, you could even use directly  the angle as a counter, which
should be faster (no multiplication):

#macro star_prism (Sides, StarFactor, Height1, Height2)
  #local RotAngle = 180/Sides;
  #local EndAngle = 360-RotAngle/2; // to avoid rounding problems
  prism {
    linear_sweep linear_spline Height1, Height2, Sides+1, x,
    #local Angle = 0;
    #while (Angle < EndAngle)
      vrotate (<1/StarFactor, 0, 0>, <0, Angle, 0>),
      #local Angle = Angle + RotAngle;
      vrotate (x, <0, Angle, 0>),
      #local Count = Angle + RotAngle;
    #end
    x
  }
#end

		Jerome

-- 
*******************************

* they'll tell you what can't * mailto:ber### [at] inamecom
* be done and why...          * http://www.enst.fr/~jberger
* Then do it.                 *
*******************************


Post a reply to this message

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