|
![](/i/fill.gif) |
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] iname com
* be done and why... * http://www.enst.fr/~jberger
* Then do it. *
*******************************
Post a reply to this message
|
![](/i/fill.gif) |