|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectmath.geom2d.polygon.Rectangle2D
public class Rectangle2D
Rectangle2D defines a rectangle rotated around its first corner.
| Field Summary | |
|---|---|
protected double |
h
|
protected double |
theta
|
protected double |
w
|
protected double |
x0
|
protected double |
y0
|
| Fields inherited from interface math.geom2d.Shape2D |
|---|
ACCURACY, defaultClipWindow, EMPTY_SET |
| Constructor Summary | |
|---|---|
Rectangle2D()
Empty contructor (size and position zero) |
|
Rectangle2D(double x0,
double y0,
double w,
double h)
Main constructor |
|
Rectangle2D(double x0,
double y0,
double w,
double h,
double theta)
Main constructor |
|
Rectangle2D(Point2D point,
double w,
double h)
Main constructor |
|
Rectangle2D(Point2D point,
double w,
double h,
double theta)
Main constructor |
|
Rectangle2D(java.awt.geom.Rectangle2D rect)
Constructor from awt, to allow easy construction from existing apps. |
|
| Method Summary | |
|---|---|
Shape2D |
clip(Box2D box)
Return the clipped polygon, as an instance of Polygon2D. |
boolean |
contains(double x,
double y)
|
boolean |
contains(double x,
double y,
double w,
double h)
|
boolean |
contains(java.awt.geom.Point2D point)
This method simply invoke ancestor method. |
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 retangles are the same. |
Boundary2D |
getBoundary()
returns the boundary of the set. |
Box2D |
getBoundingBox()
Return bounding box of the rectangle. |
java.awt.Rectangle |
getBounds()
Return bounding box of the shape. |
java.awt.geom.Rectangle2D |
getBounds2D()
Return more precise bounds for the shape. |
Shape2D |
getClippedShape(Box2D box)
Return the clipped polygon, as an instance of Polygon2D. |
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()
|
java.awt.geom.PathIterator |
getPathIterator(java.awt.geom.AffineTransform t)
|
java.awt.geom.PathIterator |
getPathIterator(java.awt.geom.AffineTransform t,
double flatness)
|
java.util.Iterator<Point2D> |
getPoints()
Deprecated. use getVertices() method instead. |
double |
getSignedDistance(double x,
double y)
Get the signed distance of the shape to the given point : this distance is positive if the point lies outside the shape, and is negative if the point lies inside the shape. |
double |
getSignedDistance(java.awt.geom.Point2D p)
Get the signed distance of the shape to the given point : this distance is positive if the point lies outside the shape, and is negative if the point lies inside the shape. |
double |
getTheta()
|
java.util.Collection<Point2D> |
getVertices()
Returns the vertices of the rectangle as a collection of points. |
int |
getVerticesNumber()
Return the number of vertices of the polygon |
double |
getWidth()
|
double |
getX()
|
double |
getY()
|
boolean |
intersects(double x0,
double y0,
double w0,
double h0)
|
boolean |
intersects(java.awt.geom.Rectangle2D r)
|
boolean |
isBounded()
Always returns true, because a rectangle is always bounded. |
void |
setRectangle(double x,
double y,
double width,
double height,
double theta)
Apply the characteristics of the given Rectangle to this object. |
void |
setRectangle(Rectangle2D rect)
Apply the characteristics of the given Rectangle to this object. |
void |
setRectangle(java.awt.geom.Rectangle2D rect)
Apply the characteristics of the given Rectangle to this object. |
Polygon2D |
transform(AffineTransform2D trans)
Return the new Polygon created by an affine transform of this polygon. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected double x0
protected double y0
protected double w
protected double h
protected double theta
| Constructor Detail |
|---|
public Rectangle2D(double x0,
double y0,
double w,
double h,
double theta)
public Rectangle2D()
public Rectangle2D(java.awt.geom.Rectangle2D rect)
public Rectangle2D(double x0,
double y0,
double w,
double h)
public Rectangle2D(Point2D point,
double w,
double h,
double theta)
public Rectangle2D(Point2D point,
double w,
double h)
| Method Detail |
|---|
public double getX()
public double getY()
public double getWidth()
public double getHeight()
public double getTheta()
public void setRectangle(Rectangle2D rect)
public void setRectangle(java.awt.geom.Rectangle2D rect)
public void setRectangle(double x,
double y,
double width,
double height,
double theta)
@Deprecated public java.util.Iterator<Point2D> getPoints()
public java.util.Collection<Point2D> getVertices()
getVertices in interface PolygonalShape2Dpublic int getVerticesNumber()
PolygonalShape2D
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 boolean isBounded()
isBounded in interface Shape2Dpublic double getDistance(java.awt.geom.Point2D p)
Shape2D
getDistance in interface Shape2D
public double getDistance(double x,
double y)
Shape2D
getDistance in interface Shape2Dpublic double getSignedDistance(java.awt.geom.Point2D p)
public double getSignedDistance(double x,
double y)
public Shape2D getClippedShape(Box2D box)
public Shape2D clip(Box2D box)
clip in interface Shape2Dbox - the clipping box
public Box2D getBoundingBox()
getBoundingBox in interface Shape2Dpublic 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 x,
double y,
double w,
double h)
contains in interface java.awt.Shapepublic boolean contains(java.awt.geom.Rectangle2D rect)
contains in interface java.awt.Shapepublic boolean containsBounds(Shape2D shape)
public boolean intersects(double x0,
double y0,
double w0,
double h0)
intersects in interface java.awt.Shapepublic boolean intersects(java.awt.geom.Rectangle2D r)
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 t)
getPathIterator in interface java.awt.Shape
public java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform t,
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 | |||||||||