diva.sketch.parser2d
Class OverlapRelation
java.lang.Object
|
+--diva.sketch.parser2d.DirectedRelation
|
+--diva.sketch.parser2d.OverlapRelation
- public class OverlapRelation
- extends DirectedRelation
Calculate the percentage of one of the rectangles
that overlaps the other. Divide the area of the
intersection by the area of the "which" rectangle
specified in the constructor.
- Version:
- $Revision: 1.1 $
Constructor Summary |
OverlapRelation(int which)
Specify which percentage to calculate, using either the
DirectedRelation.FIRST_RECT or DirectedRelation.SECOND_RECT
constants. |
Method Summary |
double |
apply(java.awt.geom.Rectangle2D r1,
java.awt.geom.Rectangle2D r2)
Return the percentage of area of whichever rectangle was
specified in the constructor that overlaps with the other
rectangle. |
java.lang.String |
getName()
The name of this relation. |
java.lang.String |
toString()
Print out the contents of this relation. |
Methods inherited from class java.lang.Object |
,
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
OverlapRelation
public OverlapRelation(int which)
- Specify which percentage to calculate, using either the
DirectedRelation.FIRST_RECT or DirectedRelation.SECOND_RECT
constants.
apply
public double apply(java.awt.geom.Rectangle2D r1,
java.awt.geom.Rectangle2D r2)
- Return the percentage of area of whichever rectangle was
specified in the constructor that overlaps with the other
rectangle.
- Overrides:
- apply in class DirectedRelation
getName
public java.lang.String getName()
- The name of this relation.
- Overrides:
- getName in class DirectedRelation
toString
public java.lang.String toString()
- Print out the contents of this relation.
- Overrides:
- toString in class java.lang.Object