[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Intersecting geometric shapes

Joe Means, means@fsl.orst.edu writes:

>   I need to calculate the area of intersecting geometric shapes.
>  Right now a circle and rectangle.  Does nayone know of code to
>  do this?
	How accurately do you need to do this, and is there any
danger you will end up needing to deal with concave shapes
or shapes with holes in (most forests have far to many holes
in them these days :-).

	IDL's object graphics has a 'tessalator' object which
will take a general polygon and give you back a set of
triangles.  Finding the area of two intersecting triangles
can be solved exactly with algebra, so if you loop through
the sets of triangles from both your shapes you will get a
more accurate answer than if you use a graphical method. 
The only downside is that with complicated shapes you will
have to loop through all unique permutations of a large
number of triangles, which can take, literally, forever.

	Mind you, I recently needed to calculate the area of a
set of blobs which were easy for the human eye to spot, but
very hard for an automated routine to identify.  Since I
only had to do the job once, I printed out image, weighed
the peice of paper, cut out all the blobs and weighed them
seperately.  It worked.