@Immutable public class ProjectionRect extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
ProjectionRect.Builder |
| Constructor and Description |
|---|
ProjectionRect()
default constructor, initialized to center (0,0) and width (10000, 10000)
|
ProjectionRect(double x1,
double y1,
double x2,
double y2)
construct a ProjectionRect from any two opposite corner points
|
ProjectionRect(ProjectionPoint minimum,
double width,
double height)
Construct a ProjectionRect from any two opposite corner points.
|
ProjectionRect(ProjectionPoint corner1,
ProjectionPoint corner2)
Construct a ProjectionRect from any two opposite corner points.
|
ProjectionRect(String spec)
Deprecated.
use fromSpec(String spec)
|
| Modifier and Type | Method and Description |
|---|---|
static ProjectionRect.Builder |
builder() |
static ProjectionRect.Builder |
builder(double x1,
double y1,
double x2,
double y2) |
boolean |
contains(ProjectionPoint point)
Returns
true if this bounding box contains point. |
boolean |
contains(ProjectionRect rect)
Returns
true if this bounding box contains rect. |
boolean |
equals(Object o) |
static ProjectionRect |
fromSpec(String spec)
Construct a bounding box from a string, or null if incorrect format.
|
double |
getCenterX()
Returns the X coordinate of the center of the framing
rectangle of the
Shape in double
precision. |
double |
getCenterY()
Returns the Y coordinate of the center of the framing
rectangle of the
Shape in double
precision. |
double |
getHeight() |
ProjectionPoint |
getLowerLeftPoint()
Get the Lower Right Point (same as getMinPoint)
|
ProjectionPoint |
getLowerRightPoint()
Get the Lower Right Point
|
ProjectionPoint |
getMaxPoint()
Get the maximum corner of the bounding box.
|
double |
getMaxX()
Returns the largest X coordinate of the framing
rectangle of the
Shape in double
precision. |
double |
getMaxY()
Returns the largest Y coordinate of the framing
rectangle of the
Shape in double
precision. |
ProjectionPoint |
getMinPoint()
Get the minimum corner of the bounding box.
|
double |
getMinX()
Returns the smallest X coordinate of the framing
rectangle of the
Shape in double
precision. |
double |
getMinY()
Returns the smallest Y coordinate of the framing
rectangle of the
Shape in double
precision. |
ProjectionPoint |
getUpperLeftPoint()
Get the Upper Left Point
|
ProjectionPoint |
getUpperRightPoint()
Get the Upper Left Point (same as getMaxPoint)
|
double |
getWidth() |
double |
getX()
Deprecated.
use getMinX
|
double |
getY()
Deprecated.
use getMinY
|
int |
hashCode() |
static ProjectionRect |
intersect(ProjectionRect src1,
ProjectionRect src2)
Intersects the pair of specified source
Rectangle2D
objects and puts the result into the specified destination
Rectangle2D object. |
boolean |
intersects(double x,
double y,
double w,
double h) |
boolean |
intersects(ProjectionRect r) |
boolean |
isEmpty() |
boolean |
nearlyEquals(ProjectionRect other)
Returns the result of
nearlyEquals(ProjectionRect, double), with Misc.defaultMaxRelativeDiffFloat. |
boolean |
nearlyEquals(ProjectionRect other,
double maxRelDiff)
Returns
true if this rectangle is nearly equal to other. |
ProjectionRect.Builder |
toBuilder()
Turn into a mutable Builder.
|
String |
toString()
Return a String representation of this ProjectionRect that can be used in new ProjectionRect(String):
"x, y, width, height"
|
String |
toString1()
Get a String representation of this object.
|
String |
toString2(int ndec) |
public ProjectionRect()
public ProjectionRect(ProjectionPoint corner1, ProjectionPoint corner2)
corner1 - a corner.corner2 - the opposite corner.public ProjectionRect(ProjectionPoint minimum, double width, double height)
minimum - lower left corner, ie the minimum x and ywidth - x width.height - y heightpublic ProjectionRect(double x1,
double y1,
double x2,
double y2)
x1 - x coord of any corner of the bounding boxy1 - y coord of the same corner as x1x2 - x coord of opposite corner from x1,y1y2 - y coord of same corner as x2@Deprecated public ProjectionRect(String spec)
@Nullable public static ProjectionRect fromSpec(String spec)
spec - "startx, starty, width, height"@Deprecated public double getX()
@Deprecated public double getY()
public double getWidth()
public double getHeight()
public double getMinX()
Shape in double
precision.Shape.public double getMinY()
Shape in double
precision.Shape.public double getMaxX()
Shape in double
precision.Shape.public double getMaxY()
Shape in double
precision.Shape.public double getCenterX()
Shape in double
precision.Shape.public double getCenterY()
Shape in double
precision.Shape.public boolean isEmpty()
public boolean intersects(ProjectionRect r)
public boolean intersects(double x,
double y,
double w,
double h)
public static ProjectionRect intersect(ProjectionRect src1, ProjectionRect src2)
Rectangle2D
objects and puts the result into the specified destination
Rectangle2D object. One of the source rectangles
can also be the destination to avoid creating a third Rectangle2D
object, but in this case the original points of this source
rectangle will be overwritten by this method.src1 - the first of a pair of Rectangle2D
objects to be intersected with each othersrc2 - the second of a pair of Rectangle2D
objects to be intersected with each otherProjectionRect that holds the
results of the intersection of src1 and
src2public boolean contains(ProjectionPoint point)
true if this bounding box contains point.point - a point in projection coordinates.true if this bounding box contains point.public boolean contains(ProjectionRect rect)
true if this bounding box contains rect.rect - a bounding box in projection coordinatestrue if this bounding box contains rect.public ProjectionPoint getLowerRightPoint()
public ProjectionPoint getUpperRightPoint()
public ProjectionPoint getLowerLeftPoint()
public ProjectionPoint getUpperLeftPoint()
public ProjectionPoint getMinPoint()
public ProjectionPoint getMaxPoint()
public String toString1()
public String toString2(int ndec)
public String toString()
public boolean nearlyEquals(ProjectionRect other)
nearlyEquals(ProjectionRect, double), with Misc.defaultMaxRelativeDiffFloat.public boolean nearlyEquals(ProjectionRect other, double maxRelDiff)
true if this rectangle is nearly equal to other. The "near equality" of corners is
determined using ProjectionPoint.nearlyEquals(ProjectionPoint, double), with the specified maxRelDiff.other - the other rectangle to check.maxRelDiff - the maximum relative difference that two corners may have.true if this rectangle is nearly equal to other.public ProjectionRect.Builder toBuilder()
public static ProjectionRect.Builder builder()
public static ProjectionRect.Builder builder(double x1, double y1, double x2, double y2)