|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectmath.geom2d.Box2D
public class Box2D
This class defines bounds of a shape. It stores limits in each direction:
x and y. It also provides methods for clipping
others shapes, depending on their type.
| Field Summary |
|---|
| Fields inherited from interface math.geom2d.Shape2D |
|---|
ACCURACY, defaultClipWindow, EMPTY_SET |
| Constructor Summary | |
|---|---|
Box2D()
Empty constructor (size and position zero) |
|
Box2D(double x0,
double x1,
double y0,
double y1)
Main constructor, given bounds for x coord, then bounds for y coord. |
|
Box2D(Point2D point,
double w,
double h)
Constructor from a point, a width and an height |
|
Box2D(Point2D p1,
Point2D p2)
Constructor from 2 points, giving extreme coordinates of the box. |
|
Box2D(java.awt.geom.Rectangle2D rect)
Constructor from awt, to allow easy construction from existing apps. |
|
| Method Summary | |
|---|---|
Shape2D |
clip(Box2D box)
Returns an instance of Box2D, or Shape2D.EMPTY_SET if the two boxes are disjoint |
BoundarySet2D<ContinuousBoundary2D> |
clipBoundary(Boundary2D boundary)
Clips a boundary and closes the result curve. |
CurveSet2D<ContinuousOrientedCurve2D> |
clipContinuousOrientedCurve(ContinuousOrientedCurve2D curve)
Clip a curve, and return a CurveSet2D. |
CurveSet2D<Curve2D> |
clipCurve(Curve2D curve)
Clip a curve, and return a CurveSet2D. |
CurveSet2D<Curve2D> |
clipCurveOld(Curve2D curve)
|
CurveSet2D<SmoothCurve2D> |
clipSmoothCurve(SmoothCurve2D curve)
clip a continuous smooth curve. |
boolean |
contains(double x,
double y)
|
boolean |
contains(double x0,
double y0,
double w,
double h)
|
boolean |
contains(java.awt.geom.Point2D point)
|
boolean |
contains(java.awt.geom.Rectangle2D rect)
|
boolean |
containsBounds(Shape2D shape)
Test if the specified Shape is totally contained in this Rectangle. |
boolean |
equals(java.lang.Object obj)
Test if boxes are the same. two boxes are the same if the have the same bounds. |
static int |
findNextCurveIndex(double[] positions,
double pos)
|
java.awt.Rectangle |
getAsAWTRectangle()
convert to AWT rectangle. |
java.awt.geom.Rectangle2D |
getAsAWTRectangle2D()
convert to AWT Rectangle2D. |
Shape2D |
getAsRectangle()
convert to rectangle. |
Boundary2D |
getBoundary()
returns the boundary of the set. |
Box2D |
getBoundingBox()
Return a new instance of Box2D with same parameters as this box. |
java.awt.Rectangle |
getBounds()
|
java.awt.geom.Rectangle2D |
getBounds2D()
|
Shape2D |
getClippedShape(Box2D box)
Return an instance of Box2D |
java.util.Collection<StraightLine2D> |
getClippingLines()
Returns the set of lines defining half-planes which all contains the box. |
double |
getDistance(double x,
double y)
get the distance of the shape to the given point, specified by x and y, or the distance of point to the frontier of the shape in the case of a plain (i.e. fillable) shape. |
double |
getDistance(java.awt.geom.Point2D p)
get the distance of the shape to the given point, or the distance of point to the frontier of the shape in the case of a plain shape. |
java.util.Collection<LineSegment2D> |
getEdges()
Return the edges as line segments of the polygon |
double |
getHeight()
|
double |
getMaxX()
|
double |
getMaxY()
|
double |
getMinX()
|
double |
getMinY()
|
java.awt.geom.PathIterator |
getPathIterator(java.awt.geom.AffineTransform at)
|
java.awt.geom.PathIterator |
getPathIterator(java.awt.geom.AffineTransform at,
double flatness)
|
java.util.Collection<Point2D> |
getVertices()
Return the vertices (singular points) of the polygon |
int |
getVerticesNumber()
Returns 4, the number of vertices of a rectangle |
double |
getWidth()
|
boolean |
intersects(double x0,
double y0,
double w,
double h)
|
boolean |
intersects(java.awt.geom.Rectangle2D rect)
|
boolean |
isBounded()
Always returns true, because a rectangle is always bounded. |
Polygon2D |
transform(AffineTransform2D trans)
Return the new domain created by an affine transform of this box. |
Box2D |
union(Box2D box)
change the bounds of the box to also include bounds of the argument. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Box2D()
public Box2D(double x0,
double x1,
double y0,
double y1)
public Box2D(java.awt.geom.Rectangle2D rect)
public Box2D(Point2D p1,
Point2D p2)
public Box2D(Point2D point,
double w,
double h)
| Method Detail |
|---|
public double getMinX()
public double getMinY()
public double getMaxX()
public double getMaxY()
public double getWidth()
public double getHeight()
public java.util.Collection<StraightLine2D> getClippingLines()
public CurveSet2D<Curve2D> clipCurve(Curve2D curve)
public CurveSet2D<Curve2D> clipCurveOld(Curve2D curve)
public CurveSet2D<SmoothCurve2D> clipSmoothCurve(SmoothCurve2D curve)
public CurveSet2D<ContinuousOrientedCurve2D> clipContinuousOrientedCurve(ContinuousOrientedCurve2D curve)
public BoundarySet2D<ContinuousBoundary2D> clipBoundary(Boundary2D boundary)
public static final int findNextCurveIndex(double[] positions,
double pos)
public java.awt.Rectangle getAsAWTRectangle()
public java.awt.geom.Rectangle2D getAsAWTRectangle2D()
public Shape2D getAsRectangle()
public Box2D union(Box2D box)
box - the bounding box to include
public java.util.Collection<Point2D> getVertices()
PolygonalShape2D
getVertices in interface PolygonalShape2Dpublic int getVerticesNumber()
getVerticesNumber in interface PolygonalShape2Dpublic java.util.Collection<LineSegment2D> getEdges()
PolygonalShape2D
getEdges in interface PolygonalShape2Dpublic Boundary2D getBoundary()
Domain2DThe returned curve is oriented, with an interior and an exterior.
getBoundary in interface Domain2Dpublic double getDistance(java.awt.geom.Point2D p)
Shape2D
getDistance in interface Shape2D
public double getDistance(double x,
double y)
Shape2D
getDistance in interface Shape2Dpublic boolean isBounded()
isBounded in interface Shape2Dpublic boolean containsBounds(Shape2D shape)
public Shape2D getClippedShape(Box2D box)
public Shape2D clip(Box2D box)
clip in interface Shape2Dbox - the clipping box
public Box2D getBoundingBox()
getBoundingBox in interface Shape2DShape2D.getBoundingBox()public Polygon2D transform(AffineTransform2D trans)
transform in interface PolygonalShape2Dtransform in interface Shape2Dtrans - an affine transform
public boolean contains(java.awt.geom.Point2D point)
contains in interface java.awt.Shape
public boolean contains(double x,
double y)
contains in interface java.awt.Shape
public boolean contains(double x0,
double y0,
double w,
double h)
contains in interface java.awt.Shapepublic boolean contains(java.awt.geom.Rectangle2D rect)
contains in interface java.awt.Shape
public boolean intersects(double x0,
double y0,
double w,
double h)
intersects in interface java.awt.Shapepublic boolean intersects(java.awt.geom.Rectangle2D rect)
intersects in interface java.awt.Shapepublic java.awt.Rectangle getBounds()
getBounds in interface java.awt.Shapepublic java.awt.geom.Rectangle2D getBounds2D()
getBounds2D in interface java.awt.Shapepublic java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform at)
getPathIterator in interface java.awt.Shape
public java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform at,
double flatness)
getPathIterator in interface java.awt.Shapepublic boolean equals(java.lang.Object obj)
equals in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||