comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: intersection/union of two polygons
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: intersection/union of two polygons [message #33741 is a reply to message #33736] Thu, 23 January 2003 08:10 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Roberto Monaco (rmonaco@coresw.com) writes:

> Does anyone know where I can find intersection and union between two
> polygons in IDL?
>
> Ideally a function that returns the polygon resulting of the intersection
> (union) of the input polygons. If not, the area (intersection / union) would
> be helpful.

If the polygons are in the same plane, and you want
a purely graphical solution (in the sense of pixel
values), then you could try this:

1. Find the indices in each polygon with POLYFILLV.

2. Find the intersection or union of the two indices
vectors with SetIntersection or SetUnion from my
web page:

http://www.dfanning.com/tips/set_operations.html

You will probably have to add some rudimentary error
checking to the programs you find here.

3. Find the boundary around this set of pixels with
Find_Boundary. (And, possibly, Label_Region if there
is more than one contiguous region in the union. Ben
Tupper has send me a program that does this automatically,
I think, if I can find it in the chaos around here. Let
me know if you think you need it.)

http://www.dfanning.com/programs/find_boundary.pro

Find_Boundary can return the area as well as the perimeter,
in addition to specifying the polygon of the result.

This idea may not be anything like what you want, but
the advantage is that it is simple. :-)

Cheers,

David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Windows XP graphics problem
Next Topic: Re: David's new tip articles

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Thu Oct 09 20:25:37 PDT 2025

Total time taken to generate the page: 1.35900 seconds