POV-Ray : Newsgroups : povray.bugreports : polygon with overlap Server Time
22 Nov 2024 03:55:29 EST (-0500)
  polygon with overlap (Message 1 to 2 of 2)  
From: Le Forgeron
Subject: polygon with overlap
Date: 4 Jan 2011 15:22:00
Message: <4d238168$1@news.povray.org>
Greetings,

Can someone check if I made any error on the following script:
It should render [step] nested polygons of [num] sides.
But the rendered picture is bogus for me (both 3.6 & 3.7).
I searched the bugs site, but found no match for polygon.


#default { texture { pigment { rgb 1 }finish { ambient 1.0} } }

camera { orthographic
	up 3.5*y
  right 3.5*x*image_width/image_height
  location  <0,0,-4>
  look_at   <0,0,0>
}

#declare num=5;
#declare step=5;
#macro aa(xx,yy,a)

polygon { (num+1)*step,
#local j=0.70;
#while(j>0.01)
#local i=0;
#while(i<num+1)
  j*< cos(i*2*pi/num),sin(i*2*pi/num),0>
#local i=i+1;
#end
#local j=j-0.7/step;
#end
translate <xx-0.0,yy,0>
 }
#end

aa(0,0,0)


Post a reply to this message

From: clipka
Subject: Re: polygon with overlap
Date: 4 Jan 2011 15:36:26
Message: <4d2384ca$1@news.povray.org>
Am 04.01.2011 21:21, schrieb Le_Forgeron:
> Greetings,
>
> Can someone check if I made any error on the following script:
> It should render [step] nested polygons of [num] sides.
> But the rendered picture is bogus for me (both 3.6&  3.7).
> I searched the bugs site, but found no match for polygon.

Apparently the polygon code requires start and end points to /exactly/ 
match in order to recognize the end of a "sub-polygon"; you can work 
around this with the following change:

> #default { texture { pigment { rgb 1 }finish { ambient 1.0} } }
>
> camera { orthographic
> 	up 3.5*y
>    right 3.5*x*image_width/image_height
>    location<0,0,-4>
>    look_at<0,0,0>
> }
>
> #declare num=5;
> #declare step=5;
> #macro aa(xx,yy,a)
>
> polygon { (num+1)*step,
> #local j=0.70;
> #while(j>0.01)
> #local i=0;
> #while(i<num+1)
>    j*<  cos(i*2*pi/num),sin(i*2*pi/num),0>

replace this with

      j*<  cos(mod(i,num)*2*pi/num),sin(mod(i,num)*2*pi/num),0>

> #local i=i+1;
> #end
> #local j=j-0.7/step;
> #end
> translate<xx-0.0,yy,0>
>   }
> #end
>
> aa(0,0,0)

I'd consider it a bug nonetheless.


Post a reply to this message

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