[futurebasic] recording points in a plotted polygon

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : January 2002 : Group Archive : Group : All Groups

From: "Hayden G. Coon" <hgcoon@...>
Date: Tue, 08 Jan 2002 09:25:19 -0500
Greetings from Snowy Maine:
     Robert and Tedd were both kind enough to respond to my query about
recording points produced in drawing a polygon; they were both most helpful,
however, I still haven't figured out how to solve (efficiently) my problem.  I
know the vertices of a polygon that I wish to plot on the screen (it is a closed
figure - most often a hexagon consisting of straight line segments - vertex to
vertex to +...).  This can be accomplished easily with the PLOT x,y TO y1,y1 TO
x2,y2+... and this works fine for me. However, I need to know and record the
coordinates of each point that is traversed (colored) on the screen during the
PLOT command.  Robert submitted a nice program that generates an anti-aliased
line from point x,y to x1,y1 and these can be recorded as they pass through the
calculation.  But this takes about 100X as much time as simply doing the PLOT
x,y to x1,y1 etc.and that is just for generating the points/lines not even
recording them. Tedd has submitted the ingenious use of the OPENPOLY and using
the points storred in its Handle& - however, when I use this program, the handle
seems to contain only the vertices of a polygon made by repeated calls to LINETO
x,y and not the intervening points that I need.  It is not really clear to me
what information is recorded in the POLYHandle in Tedd's program besides the
vertices.  A mouse drawn figure contains many points, apparently more than the
number of obvious vertices, but figures of different size often contain counter
intuitive numbers of points (a larger figure may contain fewer points than a
smaller one). My conclusion is that the OPENPOLY is storing points at witch the
direction changes (vertices).  Certainly it doesn't store each point along the
perimiter of the polygon which is what I want.
     I guess my question comes down to: can we break into the code for the PLOT
x,y to x1,y1... command and retrieve the points that are generated and copy them
into a waiting array?  Clearly the Plot command "knows" (calculates) the
intervening points as well as the x,y vertices and inserts their color/position
into the screen structure and it does so about 100X faster than we can simulate
with IF statements in FB^3 (Robert's program).  It has been 30 years since I did
assembler coding, but a factor of 100X in my simulation program would be worth
some effort.  Any guidance in starting this search will be much appreciated.   
     Thanks,  Hayden



> '--------- polygon program - should run "as is" ---
> Subject: 
>          Storing/retrieving data in/from a polygon
>     Date: 
>          Mon, 7 Jan 2002 08:08:48 -0500
>    From: 
>          tedd <tedd@...>
>      To: 
>          futurebasic@...
> 
> 
> 
> Hi gang:
> 
> I was asked recently to show a way to store/retrieve data in/from a 
> polygon. The following is my example:
> 
> ftp://ftp.futurebasic.org/FutureBasic/dropbox/polyArrayExample.sit
> 
> Any comments welcomed.
> 
> tedd
> 
> -- 
> http://sperling.com