|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.infomatiq.jsi.Rectangle
Currently hardcoded to 2 dimensions, but could be extended.
Field Summary | |
static int |
DIMENSIONS
Number of dimensions in a rectangle. |
float[] |
max
array containing the minimum value for each dimension; ie { min(x), min(y) } |
float[] |
min
array containing the maximum value for each dimension; ie { max(x), max(y) } |
Constructor Summary | |
Rectangle(float[] min,
float[] max)
Constructor. |
|
Rectangle(float x1,
float y1,
float x2,
float y2)
Constructor. |
Method Summary | |
void |
add(Rectangle r)
Computes the union of this rectangle and the passed rectangle, storing the result in this rectangle. |
float |
area()
Compute the area of this rectangle. |
boolean |
containedBy(Rectangle r)
Determine whether this rectangle is contained by the passed rectangle |
boolean |
contains(Rectangle r)
Determine whether this rectangle contains the passed rectangle |
Rectangle |
copy()
Make a copy of this rectangle |
float |
distance(Point p)
Return the distance between this rectangle and the passed point. |
float |
distance(Rectangle r)
Return the distance between this rectangle and the passed rectangle. |
boolean |
edgeOverlaps(Rectangle r)
Determine whether an edge of this rectangle overlies the equivalent edge of the passed rectangle |
float |
enlargement(Rectangle r)
Calculate the area by which this rectangle would be enlarged if added to the passed rectangle. |
boolean |
equals(java.lang.Object o)
Determine whether this rectangle is equal to a given object. |
float |
furthestDistance(Rectangle r)
Return the furthst possible distance between this rectangle and the passed rectangle. |
boolean |
intersects(Rectangle r)
Determine whether this rectangle intersects the passed rectangle |
boolean |
sameObject(java.lang.Object o)
Determine whether this rectangle is the same as another object Note that two rectangles can be equal but not the same object, if they both have the same bounds. |
void |
set(float[] min,
float[] max)
Sets the size of the rectangle. |
void |
set(float x1,
float y1,
float x2,
float y2)
Sets the size of the rectangle. |
java.lang.String |
toString()
Return a string representation of this rectangle, in the form: (1.2, 3.4), (5.6, 7.8) |
Rectangle |
union(Rectangle r)
Find the the union of this rectangle and the passed rectangle. |
Methods inherited from class java.lang.Object |
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int DIMENSIONS
public float[] max
public float[] min
Constructor Detail |
public Rectangle(float x1, float y1, float x2, float y2)
x1
- coordinate of any corner of the rectangley1
- (see x1)x2
- coordinate of the opposite cornery2
- (see x2)public Rectangle(float[] min, float[] max)
min
- array containing the minimum value for each dimension; ie { min(x), min(y) }max
- array containing the maximum value for each dimension; ie { max(x), max(y) }Method Detail |
public void set(float x1, float y1, float x2, float y2)
x1
- coordinate of any corner of the rectangley1
- (see x1)x2
- coordinate of the opposite cornery2
- (see x2)public void set(float[] min, float[] max)
min
- array containing the minimum value for each dimension; ie { min(x), min(y) }max
- array containing the maximum value for each dimension; ie { max(x), max(y) }public Rectangle copy()
public boolean edgeOverlaps(Rectangle r)
public boolean intersects(Rectangle r)
r
- The rectangle that might intersect this rectangle
public boolean contains(Rectangle r)
r
- The rectangle that might be contained by this rectangle
public boolean containedBy(Rectangle r)
r
- The rectangle that might contain this rectangle
public float distance(Point p)
p
- Point to find the distance to
public float distance(Rectangle r)
r
- Rectangle to find the distance to
public float furthestDistance(Rectangle r)
public float enlargement(Rectangle r)
r
- Rectangle to union with this rectangle, in order to
compute the difference in area of the union and the
original rectanglepublic float area()
public void add(Rectangle r)
r
- Rectangle to add to this rectanglepublic Rectangle union(Rectangle r)
r
- The rectangle to union with this rectanglepublic boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public boolean sameObject(java.lang.Object o)
o
- The object to compare with this rectangle.public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |