POV-Ray : Newsgroups : povray.general : Regular Polygons & Prisms : Re: Regular Polygons & Prisms Server Time
11 Aug 2024 01:21:55 EDT (-0400)
  Re: Regular Polygons & Prisms  
From: Remco de Korte
Date: 7 Oct 1999 05:42:06
Message: <37FC6B23.BD8C7DAA@xs4all.nl>
Andrea Ryan wrote:
> 
> I used your code but it still made 3d vectors. The last point should be the same
> as the first one. This is the code that creates the vectors.
> 
> #fopen data "data.inc" append
> #local rotation_no = 0;
> #while (rotation_no<=sides)
> #local angle_of_rotation = 360/sides;
> #local temp_vec=vrtotate(<0,1,0>,<0,0,angle_of_rotation*rotation_no>);
> #local vec=<temp_vec.x,temp_vec.y>;
> #local rotation_no = rotation_no+1;
> #write (data, "",vec,"")
> #end

I'm not sure I understand where it went wrong.
The temp_vec is a 3D-vector from which you derive vec as a 2D-vector.
I tried this and I got a file with 2D-vectors (after fixing a small typo).
I agree the last point should be the same as the first and indeed in my file the
first was: <0,1> while the last was <2.44921e-016,1>. I don't know if this
really bothers you, but 2.44921e-016 is might close to 0. If you'd really like
to avoid it you could put in something like:
#if (vec.u<.0000001) 
  #declare vec=0; 
#end
Not very elegant, but efficient enough. It won't really matter for the resulting
scene.

Bye,

Remco


Post a reply to this message

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