diva.sketch.parser2d
Class OverlapRelation

java.lang.Object
  extended by diva.sketch.parser2d.OverlapRelation
All Implemented Interfaces:
Relation

public class OverlapRelation
extends Object
implements Relation

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.10 $
Author:
Michael Shilman (michaels@eecs.berkeley.edu)

Field Summary
static String NAME
          The name that this relation goes by in text form.
 
Constructor Summary
OverlapRelation()
           
 
Method Summary
 double apply(SceneElement e1, SceneElement e2)
          Return the ratio of the area of the intersection of the given elements to the area of the first rectangle.
 String getName()
          The name of this relation.
 String toString()
          Print out the contents of this relation.
 String toString(String e1Name, String e2Name)
          Pretty print the relation in the grammar format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NAME

public static String NAME
The name that this relation goes by in text form.

Constructor Detail

OverlapRelation

public OverlapRelation()
Method Detail

apply

public double apply(SceneElement e1,
                    SceneElement e2)
Return the ratio of the area of the intersection of the given elements to the area of the first rectangle.

Specified by:
apply in interface Relation

getName

public String getName()
The name of this relation.

Specified by:
getName in interface Relation

toString

public String toString(String e1Name,
                       String e2Name)
Pretty print the relation in the grammar format.

Specified by:
toString in interface Relation

toString

public String toString()
Print out the contents of this relation.

Overrides:
toString in class Object


Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.