edu.mit.sketch.ddg
Class PositionConstraint

java.lang.Object
  extended by edu.mit.sketch.ddg.Constraint
      extended by edu.mit.sketch.ddg.BinaryRelationshipConstraint
          extended by edu.mit.sketch.ddg.PositionConstraint
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class PositionConstraint
extends BinaryRelationshipConstraint
implements java.io.Serializable

This class represents the relative position constraints (like "above") for lines, ellipses, and groups.

PositionConstraint.java Created: Sat Nov 21 18:26:00 2001

Author:
Olya Veselova
See Also:
Serialized Form

Field Summary
static int ABOVE
           
static int ABOVE_CENTERED
           
static int BELOW
           
static int INSIDE
           
static int INSIDE_BOX
           
static int INSIDE_CENTERED
           
static int LEFT
           
static int LOWER_LEFT
           
static int LOWER_RIGHT
           
static int NUM_CONSTRAINTS
          Total number of possible constraints (to allow iterating over the names)
static int RIGHT
           
static int RIGHT_CENTERED
           
static int UPPER_LEFT
           
static int UPPER_RIGHT
           
 
Constructor Summary
PositionConstraint()
          Constructs an empty constraint graph.
PositionConstraint(int name)
          Constructs an empty constraint graph.
PositionConstraint(java.lang.String name)
          Constructs an empty constraint graph.
 
Method Summary
 void addConstraints(java.util.HashMap primToGeomParts, double[][] obstruction, PrimitiveList primitives)
          Infer the constraints from the users stroke geom parts and add them to the constraint graph.
 void addConstraints(java.util.HashMap primToGeomParts, GroupingTree group)
          Recursively looks at pairs of groups in the tree and initializes the relationship constraints.
static double boxPosition(GeometricObject o1, GeometricObject o2, int position)
          Returns the confidence of a given spatial relationship between objects just based on their bounding box and center
 boolean centered()
          Whether the constraint is centered
 java.lang.Object clone()
          Clone the constraint
static double constraintConfidence(DrawnObject object1, DrawnObject object2, int name)
          Returns the confidence that a given (by the name) constraint holds
static double constraintConfidence(Ellipse e1, Ellipse e2, int name)
          Returns the confidence that the constraint with the given name holds between two primitives
static double constraintConfidence(Ellipse e1, Line l2, int name)
          Returns the confidence that the constraint with the given name holds between two primitives
static double constraintConfidence(Line l1, Ellipse e2, int name)
          Returns the confidence that the constraint with the given name holds between two primitives
static double constraintConfidence(Line l1, Line l2, int name)
          Returns the confidence that the constraint with the given name holds between two primitives
static double constraintRelevance(DrawnObject object, DrawnObject object2, int name)
          Returns the relevance of a given (by the name) constraint
 java.lang.String name()
          Name of the constraint type
 boolean orientationInvariant()
          Returns true if the constraint is orinetation invariant
 
Methods inherited from class edu.mit.sketch.ddg.Constraint
constraintGraph, labelledEdgeList, mergeIn, print, removeLowConfidence, removeLowRelevance, renamePrimitives, sameAs, setConstraintGraph, subgraph
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ABOVE

public static final int ABOVE
See Also:
Constant Field Values

RIGHT

public static final int RIGHT
See Also:
Constant Field Values

BELOW

public static final int BELOW
See Also:
Constant Field Values

LEFT

public static final int LEFT
See Also:
Constant Field Values

UPPER_RIGHT

public static final int UPPER_RIGHT
See Also:
Constant Field Values

UPPER_LEFT

public static final int UPPER_LEFT
See Also:
Constant Field Values

LOWER_RIGHT

public static final int LOWER_RIGHT
See Also:
Constant Field Values

LOWER_LEFT

public static final int LOWER_LEFT
See Also:
Constant Field Values

ABOVE_CENTERED

public static final int ABOVE_CENTERED
See Also:
Constant Field Values

RIGHT_CENTERED

public static final int RIGHT_CENTERED
See Also:
Constant Field Values

INSIDE

public static final int INSIDE
See Also:
Constant Field Values

INSIDE_CENTERED

public static final int INSIDE_CENTERED
See Also:
Constant Field Values

INSIDE_BOX

public static final int INSIDE_BOX
See Also:
Constant Field Values

NUM_CONSTRAINTS

public static final int NUM_CONSTRAINTS
Total number of possible constraints (to allow iterating over the names)

See Also:
Constant Field Values
Constructor Detail

PositionConstraint

public PositionConstraint()
Constructs an empty constraint graph.


PositionConstraint

public PositionConstraint(int name)
Constructs an empty constraint graph.


PositionConstraint

public PositionConstraint(java.lang.String name)
Constructs an empty constraint graph.

Method Detail

orientationInvariant

public boolean orientationInvariant()
Returns true if the constraint is orinetation invariant

Specified by:
orientationInvariant in class BinaryRelationshipConstraint

addConstraints

public void addConstraints(java.util.HashMap primToGeomParts,
                           double[][] obstruction,
                           PrimitiveList primitives)
Infer the constraints from the users stroke geom parts and add them to the constraint graph. HashMap: type of key: Primitive, type of value: GeometricObject


addConstraints

public void addConstraints(java.util.HashMap primToGeomParts,
                           GroupingTree group)
Recursively looks at pairs of groups in the tree and initializes the relationship constraints.


boxPosition

public static double boxPosition(GeometricObject o1,
                                 GeometricObject o2,
                                 int position)
Returns the confidence of a given spatial relationship between objects just based on their bounding box and center


constraintConfidence

public static double constraintConfidence(DrawnObject object1,
                                          DrawnObject object2,
                                          int name)
Returns the confidence that a given (by the name) constraint holds


constraintConfidence

public static double constraintConfidence(Line l1,
                                          Line l2,
                                          int name)
Returns the confidence that the constraint with the given name holds between two primitives


constraintConfidence

public static double constraintConfidence(Ellipse e1,
                                          Ellipse e2,
                                          int name)
Returns the confidence that the constraint with the given name holds between two primitives


constraintConfidence

public static double constraintConfidence(Line l1,
                                          Ellipse e2,
                                          int name)
Returns the confidence that the constraint with the given name holds between two primitives


constraintConfidence

public static double constraintConfidence(Ellipse e1,
                                          Line l2,
                                          int name)
Returns the confidence that the constraint with the given name holds between two primitives


constraintRelevance

public static double constraintRelevance(DrawnObject object,
                                         DrawnObject object2,
                                         int name)
Returns the relevance of a given (by the name) constraint


name

public java.lang.String name()
Name of the constraint type

Specified by:
name in class BinaryRelationshipConstraint

centered

public boolean centered()
Whether the constraint is centered


clone

public java.lang.Object clone()
Clone the constraint

Specified by:
clone in class BinaryRelationshipConstraint