POV-Ray : Newsgroups : povray.general : Regular Polygons & Prisms : Re: Regular Polygons & Prisms Server Time
11 Aug 2024 07:18:40 EDT (-0400)
  Re: Regular Polygons & Prisms  
From: Andrea Ryan
Date: 7 Oct 1999 16:18:29
Message: <37FCFF25.F69CC0B5@global2000.net>
Yay! It worked! I rendered a regular pentagon! But... there's still a little problem.
I used the following code:

#if (-0.000000000000000244921<=vec.u<=0.000000000000000244921)
#declare vec=<0,1>;
#end

and the first three vectors were <0,1> when there should be only one at the beginning.

The second and third vectors had negative numbers in them.


The last vector didn't match the first one. I want them to be alike so there would be
no warnings. I might use the quadratic and cubic splines after adding the control
points. If a prism using quadratic or cubic splines is not closed, POV-Ray will
generate a error message.

Brendan Ryan

Remco de Korte wrote:

> 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.