public class P2DBoundingBox extends java.lang.Object implements P2DBoundingBoxInterface
| Modifier and Type | Field and Description |
|---|---|
protected java.awt.geom.Point2D.Double |
lower |
protected java.awt.geom.Point2D.Double |
upper |
static java.lang.String |
version |
protected double |
xFactor |
protected double |
xOffset |
protected double |
yFactor |
protected double |
yOffset |
| Constructor and Description |
|---|
P2DBoundingBox()
The default constructor.
|
P2DBoundingBox(double lx,
double ly,
double ux,
double uy)
The constructor receiving the edges of the bounding box.
|
P2DBoundingBox(P2DBoundingBoxInterface box)
The constructor receiving a bounding box.
|
P2DBoundingBox(java.awt.geom.Point2D lower,
java.awt.geom.Point2D upper)
The constructor receiving the lower and upper corner of the box.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
clone()
Return a copy of this box.
|
P2DBoundingBoxInterface |
closestIntersection(P2DBoundingBoxInterface[] bounds)
Finds closest bounding object which intersects this bounding box
|
boolean |
contains(P2DBoundingBoxInterface box)
Checks whether the complete bounding box is inside this one.
|
boolean |
contains(java.awt.geom.Point2D p)
Test for intersection with a point
|
boolean |
equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one.
|
double |
getArea()
Returns the square of the enclosed area.
|
double |
getHeight()
Retrieves the height of the box.
|
java.awt.geom.AffineTransform |
getInverseTransform()
Get the transformation for this boundingbox.
|
java.awt.geom.Point2D |
getLower()
Get the reference to the lower vector.
|
void |
getLower(java.awt.geom.Point2D lower)
Get the lower vector.
|
java.awt.geom.Rectangle2D |
getRectangle()
Retrieves the rectanlge defined by this box.
|
P2DBoundingBoxInterface |
getScaledBoundingBox()
Get the scaled bounding box.
|
double |
getScaledHeight()
Retrieves the scaled height of the box.
|
java.awt.geom.Point2D |
getScaledLower()
Get the lower scaled vector.
|
void |
getScaledLower(java.awt.geom.Point2D lower)
Get the lower scaled vector.
|
java.awt.geom.Point2D |
getScaledUpper()
Get the upper scaled vector.
|
void |
getScaledUpper(java.awt.geom.Point2D upper)
Get the upper scaled vector.
|
double |
getScaledWidth()
Retrieves the scaled width of the box.
|
java.awt.geom.AffineTransform |
getTransform()
Get the inverse transformation.
|
java.awt.geom.Point2D |
getUpper()
Get the reference to the upper vector.
|
void |
getUpper(java.awt.geom.Point2D upper)
Get the upper vector.
|
java.lang.String |
getVersion()
Return the version string of the FWK component.
|
double |
getWidth()
Retrieves the width of the box.
|
double |
getXFactor()
Get the scale of the bounding box in X direction.
|
double |
getXOffset()
Get the offset of the bounding box in X direction.
|
java.awt.geom.AffineTransform |
getXTransform()
Get the transformation for this boundingbox in x direction.
|
double |
getYFactor()
Get the scale of the bounding box in Y direction.
|
double |
getYOffset()
Get the offset of the bounding box in Y direction.
|
java.awt.geom.AffineTransform |
getYTransform()
Get the transformation for this boundingbox in y direction.
|
boolean |
intersects(P2DBoundingBoxInterface bounds)
Test for intersection with another bounds object
|
boolean |
intersects(P2DBoundingBoxInterface[] bounds)
Test for intersection with an array of bounds objects
|
boolean |
intersects(P2DBoundingBoxInterface[] bounds,
P2DBoundingBoxInterface newBoundBox)
Test for intersection with an array of bounds objects
|
boolean |
intersects(P2DBoundingBoxInterface bounds,
P2DBoundingBoxInterface newBoundBox)
Test for intersection with another bounding box
|
boolean |
intersects(java.awt.geom.Point2D v)
Test for intersection with a point
|
java.awt.geom.Point2D |
inverseTransformPoint(java.awt.geom.Point2D p)
Transform the point.
|
boolean |
isInside(P2DBoundingBoxInterface box)
Checks whether the this box is inside the given unscaled box.
|
static void |
main(java.lang.String[] args) |
void |
move(double xDiff,
double yDiff)
Move the box.
|
void |
release()
Release the object.
|
void |
setHeight(double height)
Set the height of the box.
|
void |
setLower(java.awt.geom.Point2D lower)
Set the lower vector.
|
void |
setOffset(double xOffset,
double yOffset)
Scale the bounding box to the given values.
|
void |
setScale(double xFactor,
double yFactor)
Scale the bounding box to the given values.
|
void |
setUpper(java.awt.geom.Point2D upper)
Set the upper vector.
|
void |
setWidth(double width)
Set the width of the box.
|
void |
setXScale(double offset,
double scale)
Scale the bounding box in X direction.
|
void |
setYScale(double offset,
double scale)
Scale the bounding box in Y direction.
|
java.lang.String |
toString()
returns the string representation of the box.
|
java.awt.geom.Point2D |
transformPoint(java.awt.geom.Point2D p)
Transform the point.
|
public static final java.lang.String version
protected java.awt.geom.Point2D.Double lower
protected java.awt.geom.Point2D.Double upper
protected double xFactor
protected double yFactor
protected double xOffset
protected double yOffset
public P2DBoundingBox()
public P2DBoundingBox(java.awt.geom.Point2D lower,
java.awt.geom.Point2D upper)
public P2DBoundingBox(P2DBoundingBoxInterface box)
public P2DBoundingBox(double lx,
double ly,
double ux,
double uy)
lx - The lower x value.ly - The lower y value.ux - The upper x value.uy - The upper y value.public java.lang.String getVersion()
FwkInterfacegetVersion in interface FwkInterfacepublic void release()
release in interface FwkInterfacepublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic java.lang.Object clone()
clone in class java.lang.Objectpublic P2DBoundingBoxInterface closestIntersection(P2DBoundingBoxInterface[] bounds)
closestIntersection in interface P2DBoundingBoxInterfaceboundsObjects - is an array of bounds objectspublic double getArea()
getArea in interface P2DBoundingBoxInterfacepublic boolean intersects(P2DBoundingBoxInterface bounds)
intersects in interface P2DBoundingBoxInterfacepublic boolean intersects(P2DBoundingBoxInterface[] bounds)
intersects in interface P2DBoundingBoxInterfacepublic boolean intersects(P2DBoundingBoxInterface[] bounds, P2DBoundingBoxInterface newBoundBox)
intersects in interface P2DBoundingBoxInterfaceboundsObjects - is an array of bounds objectsnewBoundBox - is the new bounding box which is the intersection of the boundsObject and this BoundingBoxpublic boolean intersects(P2DBoundingBoxInterface bounds, P2DBoundingBoxInterface newBoundBox)
intersects in interface P2DBoundingBoxInterfaceboundsObject - is another bounding objectnewBoundBox - - is the new bounding box which is the intersection of the boundsObject and this BoundingBoxpublic boolean intersects(java.awt.geom.Point2D v)
public boolean contains(java.awt.geom.Point2D p)
contains in interface P2DBoundingBoxInterfacepublic boolean contains(P2DBoundingBoxInterface box)
contains in interface P2DBoundingBoxInterfacepublic java.awt.geom.Point2D getUpper()
getUpper in interface P2DBoundingBoxInterfacegetLower(Point2D)public java.awt.geom.Point2D getLower()
getLower in interface P2DBoundingBoxInterfacegetLower(Point2D)public void getLower(java.awt.geom.Point2D lower)
getLower in interface P2DBoundingBoxInterfacelower - The vector that receives the lower value.public void getUpper(java.awt.geom.Point2D upper)
getUpper in interface P2DBoundingBoxInterfaceupper - The vector that receives the upper value.public void setLower(java.awt.geom.Point2D lower)
setLower in interface P2DBoundingBoxInterfacelower - The vector that will be the new lower value.public void setUpper(java.awt.geom.Point2D upper)
setUpper in interface P2DBoundingBoxInterfaceupper - The vector that will be the new upper value.public P2DBoundingBoxInterface getScaledBoundingBox()
getScaledBoundingBox in interface P2DBoundingBoxInterfacepublic java.awt.geom.Point2D getScaledUpper()
getScaledUpper in interface P2DBoundingBoxInterfacepublic java.awt.geom.Point2D getScaledLower()
getScaledLower in interface P2DBoundingBoxInterfacepublic void getScaledUpper(java.awt.geom.Point2D upper)
getScaledUpper in interface P2DBoundingBoxInterfaceThe - upper value.public void getScaledLower(java.awt.geom.Point2D lower)
getScaledLower in interface P2DBoundingBoxInterfacepublic double getWidth()
getWidth in interface P2DBoundingBoxInterfacepublic double getHeight()
getHeight in interface P2DBoundingBoxInterfacepublic double getScaledWidth()
getScaledWidth in interface P2DBoundingBoxInterfacepublic double getScaledHeight()
getScaledHeight in interface P2DBoundingBoxInterfacepublic void setWidth(double width)
setWidth in interface P2DBoundingBoxInterfacewidth - The widthpublic void setHeight(double height)
setHeight in interface P2DBoundingBoxInterfaceheight - The heightpublic java.awt.geom.Rectangle2D getRectangle()
getRectangle in interface P2DBoundingBoxInterfacepublic java.lang.String toString()
toString in class java.lang.Objectpublic void move(double xDiff,
double yDiff)
move in interface P2DBoundingBoxInterfacexDiff - the movement in x.yDiff - the movement in y.public boolean isInside(P2DBoundingBoxInterface box)
isInside in interface P2DBoundingBoxInterfacepublic void setScale(double xFactor,
double yFactor)
setScale in interface P2DBoundingBoxInterfacexFactor - the scaling in x.yFactor - The scaling in y.public void setOffset(double xOffset,
double yOffset)
setOffset in interface P2DBoundingBoxInterfacexOffset - the offset in x.yOffset - The offset in y.public void setXScale(double offset,
double scale)
setXScale in interface P2DBoundingBoxInterfaceoffset - the offset in x.scale - the scaling in x.public void setYScale(double offset,
double scale)
setYScale in interface P2DBoundingBoxInterfaceoffset - the offset in y.scale - the scaling in y.public double getXFactor()
getXFactor in interface P2DBoundingBoxInterfacepublic double getYFactor()
getYFactor in interface P2DBoundingBoxInterfacepublic double getXOffset()
getXOffset in interface P2DBoundingBoxInterfacepublic double getYOffset()
getYOffset in interface P2DBoundingBoxInterfacepublic java.awt.geom.AffineTransform getInverseTransform()
getInverseTransform in interface P2DBoundingBoxInterfacegetTransformpublic java.awt.geom.AffineTransform getTransform()
getTransform in interface P2DBoundingBoxInterfacegetTransformpublic java.awt.geom.AffineTransform getXTransform()
getXTransform in interface P2DBoundingBoxInterfacepublic java.awt.geom.AffineTransform getYTransform()
getYTransform in interface P2DBoundingBoxInterfacepublic java.awt.geom.Point2D inverseTransformPoint(java.awt.geom.Point2D p)
inverseTransformPoint in interface P2DBoundingBoxInterfacep - The point to be transformed to the out coordinate system.public java.awt.geom.Point2D transformPoint(java.awt.geom.Point2D p)
transformPoint in interface P2DBoundingBoxInterfacep - The point to be transformed to the defined coordinate system.public static void main(java.lang.String[] args)