POV-Ray : Newsgroups : povray.general : Regular Polygons & Prisms : Re: Regular Polygons & Prisms Server Time
11 Aug 2024 07:17:38 EDT (-0400)
  Re: Regular Polygons & Prisms  
From: Andrea Ryan
Date: 8 Oct 1999 22:21:43
Message: <37FEA5C0.9A6CDFB7@global2000.net>
Thanks! It works for any prisms. I rendered a 1000-gon in 2 minutes and 22 seconds.
It looked like a cylinder. :-)
Brendan Ryan

Remco de Korte wrote:

> Andrea Ryan wrote:
> >
> > After a little testing, I found that the macro worked fine for prisms with
> > a odd number of sides, but it doesn't work prisms that have an even number
> > of sides.
> > I think the problem is in this code:
> >
> > #local rotation_no = 0;
> > #while (rotation_no<sides)
> > #local angle_of_rotation = 360/sides;
> > #local temp_vec=vrotate(<0,1,0>,<0,1,angle_of_rotation*rotation_no>);
> > #local vec=<temp_vec.y,temp_vec.z>;
> > #local rotation_no = rotation_no+1;
> > //the stuff that writes to the data file
> > #end
> >
> > When a prism with a even number of sides is created, one of the points has
> > a coordinate with an incorrect sign. Thanks for your help.
> > Brendan Ryan
> >
> > Andrea Ryan wrote:
> >
>
> I don't know exactly what caused your problem but the code above has some typos.
>
> Here is what I made of it:
>
> #declare sides=5;
>
> prism {
>   linear_sweep
>   linear_spline
>   -0.5,
>    0.5,
>   sides+1,
>
> #local rotation_no = 0;
> #while (rotation_no<sides)
> #local angle_of_rotation = 360/sides;
> //#local temp_vec=vrotate(<0,1,0>,<0,1,angle_of_rotation*rotation_no>);
> #local temp_vec=vrotate(<0,1,0>,<0,0,angle_of_rotation*rotation_no>);
> //#local vec=<temp_vec.y,temp_vec.z>;
> #local vec=<temp_vec.x,temp_vec.y>;
> #if (rotation_no=0)
>   #declare vec0=vec;
> #end
> vec,
> #local rotation_no = rotation_no+1;
> #end
> vec0
> pigment{rgb 1}
> rotate x*90
> }
>
> When I tried this it worked fine.
>
> Remco


Post a reply to this message

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