Need help with finding perimeters of bounded areas

Howard Spindel Howard.Spindel at p8.f14.n105.z1.FIDONET.ORG
Sun Oct 15 04:16:30 AEST 1989


> From: miller at unicom.UUCP (Gregory S Miller)
> Date: 12 Oct 89 02:37:36 GMT
> Organization: Science Computer Center, College of Marin,
> Kentfield CA
> Message-ID: <135 at unicom.UUCP>
> Newsgroups: comp.lang.c,comp.lang.lisp,comp.ai
>
>
>
> Consider an area A on an euclidean plane surface.  Inside A
> are an arbitrary number of lines that "fill out" A.  That
> is,
> A is defined not by a perimeter, but rather as a filled
> object (
> negative versus positive images...).
>
> Now each line has a diameter D(i) where i is an subscript
> telling
> which line we`re referring.  It is perfectly reasonable that
> the lines
> may overlap.  Since they overlap, one could use a lot of
> lines with
> small diameters or a smaller number with larger diameters
> and still
> produce the same area A.
>
> Problem: Given the area A, find the perimeter - eliminate
> all lines
> inside A and leave just the outline.  A is "given"
> by a
> list of vectors with a diameter (ie. start/end
> point with
> diameter).
>
You don't say whether the area has any concavities or not.  If not,
the following brute force idea may work - I didn't spend a whole lot
of time thinking it through.
Make 4 lists.  List 1 is the minimum X coordinate seen for a given Y,
List 2 is the maximum X coordinate for a given Y, List 3 is the
minimum Y coordinate seen for a given X, List 4 is the maximum Y
coordinate seen for a given X.  Your arrays will have to be large
enough to hold an entry for each possible X and Y intercept.
Scan convert each line.  For each point encountered while scan
converting compare against the minima/maxima saved in the tables
and replace if new minima/maxima are found.
When all lines have been scan converted the lists should contain
the coordinates of each point along the edge of the desired area.
 
Eschew Sesquipedalian Obfuscation!
Usenet:     Howard.Spindel at p8.f14.n105.z1.FIDONET.ORG
Fidonet:    1:105/14.8


--  
Howard Spindel - via FidoNet node 1:105/14
	    UUCP: ...!{uunet!oresoft, tektronix!reed}!busker!14.8!Howard.Spindel
	    ARPA: Howard.Spindel at p8.f14.n105.z1.FIDONET.ORG



More information about the Comp.lang.c mailing list