public class RMRect
extends java.awt.geom.Rectangle2D.Double
Modifier and Type | Field and Description |
---|---|
static byte |
MaxXEdge |
static byte |
MaxYEdge |
static byte |
MinXEdge |
static byte |
MinYEdge |
static RMRect |
unitRect |
static RMRect |
zeroRect |
Constructor and Description |
---|
RMRect()
Creates an empty rect.
|
RMRect(double x,
double y,
double w,
double h)
Creates a rect with the given x, y, width and height (doubles).
|
RMRect(java.awt.geom.Point2D... points)
Creates a rect enclosing the given array of points.
|
RMRect(java.awt.geom.Rectangle2D aRect)
Creates a rect from an awt rect.
|
Modifier and Type | Method and Description |
---|---|
RMRect |
clone()
Standard clone implementation.
|
boolean |
containsRect(RMRect aRect)
Returns whether the receiver contains the given rect.
|
RMRect |
divideRect(double anAmount,
byte anEdge)
Slices rect by given amount (from given edge) - returns remainder.
|
RMRect |
divideRect(double anAmount,
byte anEdge,
RMRect aRmndr)
Slices rect by given amount (from given edge) - returns remainder.
|
static RMRect |
fromXMLString(java.lang.String aString)
Creates a rect from an String in XML format as defined in toXMLString().
|
RMRect |
getCorraledRect(RMRect aRect,
float anInset)
Returns the given rect moved, if needed, to be contained by this rect.
|
int |
getHitEdges(java.awt.geom.Point2D aPoint,
double aRadius)
Returns the mask of edges hit by the given point.
|
double |
getMidX()
Returns the x mid-point of the rect.
|
double |
getMidY()
Returns the y mid-point of the rect.
|
RMPoint |
getOrigin()
Returns the origin of the rect as an RMPoint.
|
RMPoint |
getPerimeterPointForRadial(double anAngle,
boolean doEllipse)
Returns the point on the rectangle's perimeter that is intersected by a radial at the given angle from the
center of the rect.
|
RMPoint[] |
getPoints()
Returns an array of four points containing each corner of the rect.
|
RMRect |
inset(double anInset)
Insets the receiver rect by the given amount.
|
RMRect |
inset(double xInset,
double yInset)
Insets the receiver rect by the given amount.
|
RMRect |
insetRect(double anInset)
Creates a rect derived from the receiver inset by the given amount.
|
RMRect |
insetRect(double xInset,
double yInset)
Creates a rect derived from the receiver inset by the given amount.
|
RMRect |
intersectedRect(RMRect r2)
Returns the rect formed by the area overlapping with the given rect.
|
boolean |
intersectsRect(RMRect aRect)
Returns whether the receiver intersects with the given rect.
|
boolean |
intersectsRectEvenIfEmpty(RMRect aRect)
Returns whether the receiver intersects with the given rect.
|
RMRect |
offset(double dx,
double dy)
Offsets the receiver by the given x & y.
|
RMRect |
offsetRect(double dx,
double dy)
Creates a rect derived by offsetting the receiver by the given x & y.
|
RMRect |
scale(double anAmount)
Scales the receiver rect by the given amount.
|
RMRect |
scaledRect(double anAmount)
Creates a rect derived from the receiver scaled by the given amount.
|
void |
setHitEdges(java.awt.geom.Point2D aPoint,
int anEdgeMask)
Resets the edges of a rect, given a mask of edges and a new point.
|
RMRect |
setOrigin(double x,
double y)
Sets the origin of the rect.
|
RMRect |
squareRectInRect()
Creates a rect representing the largest square inside rect.
|
java.lang.String |
toString()
Returns a String reprsentation of this rect.
|
java.lang.String |
toXMLString()
Returns an XML string representation of this rect.
|
void |
union(RMRect r2)
Unions the receiver rect with the given rect.
|
void |
unionEvenIfEmpty(RMRect r2)
Unions the receiver rect with the given rect.
|
RMRect |
unionRect(RMRect r2)
Creates a rect encompassing the receiver and the given rect.
|
boolean |
widthsIntersect(RMRect r2)
Returns whether the receiver intersects with the given rect (horizontally only).
|
createIntersection, createUnion, getBounds2D, getHeight, getWidth, getX, getY, isEmpty, outcode, setRect, setRect
add, add, add, contains, contains, equals, getPathIterator, getPathIterator, hashCode, intersect, intersects, intersectsLine, intersectsLine, outcode, setFrame, union
public static final RMRect zeroRect
public static final RMRect unitRect
public static final byte MinXEdge
public static final byte MinYEdge
public static final byte MaxXEdge
public static final byte MaxYEdge
public RMRect()
public RMRect(double x, double y, double w, double h)
public RMRect(java.awt.geom.Point2D... points)
public RMRect(java.awt.geom.Rectangle2D aRect)
public RMPoint getOrigin()
public RMRect setOrigin(double x, double y)
public double getMidX()
public double getMidY()
public void union(RMRect r2)
public RMRect unionRect(RMRect r2)
public void unionEvenIfEmpty(RMRect r2)
public boolean intersectsRect(RMRect aRect)
public boolean intersectsRectEvenIfEmpty(RMRect aRect)
public RMRect intersectedRect(RMRect r2)
public boolean widthsIntersect(RMRect r2)
public RMRect offset(double dx, double dy)
public RMRect offsetRect(double dx, double dy)
public RMRect squareRectInRect()
public boolean containsRect(RMRect aRect)
public RMPoint[] getPoints()
public RMRect inset(double anInset)
public RMRect inset(double xInset, double yInset)
public RMRect insetRect(double anInset)
public RMRect insetRect(double xInset, double yInset)
public int getHitEdges(java.awt.geom.Point2D aPoint, double aRadius)
public void setHitEdges(java.awt.geom.Point2D aPoint, int anEdgeMask)
public RMRect divideRect(double anAmount, byte anEdge)
public RMRect divideRect(double anAmount, byte anEdge, RMRect aRmndr)
public RMRect scale(double anAmount)
public RMRect scaledRect(double anAmount)
public RMPoint getPerimeterPointForRadial(double anAngle, boolean doEllipse)
anAngle
- Angle in degrees.doEllipse
- Whether to scale radials into ellipse or leave them normal.public RMRect getCorraledRect(RMRect aRect, float anInset)
public java.lang.String toString()
toString
in class java.awt.geom.Rectangle2D.Double
public java.lang.String toXMLString()
public static RMRect fromXMLString(java.lang.String aString)
public RMRect clone()
clone
in class java.awt.geom.RectangularShape