For Programmers: Free Programming Magazines  


Home > Archive > Java Help > February 2005 > comparing 2 java.awt.geom.area's









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author comparing 2 java.awt.geom.area's
iSyncLtd@hotmail.com

2005-02-27, 3:59 am



you can compare an Area to a Rectangle using:

Area a;
Rectangle r;

(boolean) a.instrects( r );


but how can a compare two area's two each other that are not exact
rectagles?

(don't say compare one area to the bounds of another because i need
more accuarcy then that)

Patricia Shanahan

2005-02-27, 3:59 am

iSyncLtd@hotmail.com wrote:

>
> you can compare an Area to a Rectangle using:
>
> Area a;
> Rectangle r;
>
> (boolean) a.instrects( r );
>
>
> but how can a compare two area's two each other that are not exact
> rectagles?
>
> (don't say compare one area to the bounds of another because i need
> more accuarcy then that)
>


Not tested, so use the idea at your own risk:

public static boolean intersects(Area a, Area b){
Area c = (Area)a.clone();
c.intersect(b);
return !c.isEmpty();
}

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com