If I have an array of points and know the number of points, how can I create
a polygon object from the array? Somehow I need to expand the the array
into individual points. One way that I know would work is to have POV
write out a file of points and then use an #include. Is there some other,
easier way?
Thanks in advance.
From: Andrew
Subject: Re: Creating a Polygon from an Array of Points
Date: 13 Jan 2003 11:39:21
Message: <3e22ebb9$1@news.povray.org>
#declare Points = array [10] [1]
//Array is filled...
#declare Poly = polygon {10,
#declare loop = 0;
#while (loop < 10)
<Points [loop] [0], Points [loop] [1]>
#if (loop <9)
,
#end
#declare loop = loop + 1;
#end
}
This should do the trick. Here we assume that a 2d array called Points
holds the co-ordinates for each point. Points [n] [0] is the x value
for point n, and Points [n] [1] is the y value. Then it's simply a
matter of inserting these points into the polygon syntax (see the
manual). The if (loop<9) simply avoids putting a comma after the last
pair of co-ordinates.
"mmm" <mik### [at] comcastnet> wrote in message
news:web.3e22e6e18a8b9f44e2f87fad0@news.povray.org...
> If I have an array of points and know the number of points, how can I
create
> a polygon object from the array? Somehow I need to expand the the
array
> into individual points. One way that I know would work is to have POV> write out a file of points and then use an #include. Is there some
other,
> easier way?> Thanks in advance.>