public final class Rectangle extends AbstractPolygon
WARNING: this API is experimental and will likely change in the near future.
Constructor and Description |
---|
Rectangle() |
Rectangle(double minX,
double minY,
double maxX,
double maxY)
Constructs a rectangle with specified dimensions.
|
Rectangle(Point min,
Point max)
Constructs a rectangle with specified dimensions.
|
Modifier and Type | Method and Description |
---|---|
void |
addArguments(StringBuilder buffer) |
Rectangle |
clone() |
boolean |
contains(double x,
double y)
Return true if this shape contains the point defined by (
x , y ). |
boolean |
equals(Object other) |
double |
fastGetX(int index)
Get the X coordinate of the Point at
index . |
double |
fastGetY(int index)
Get the Y coordinate of the Point at
index . |
boolean |
fastIntersects(Rectangle box)
Check if this shape's bounding box intersects with
box . |
Rectangle |
getBoundingBox()
Get the rectangle that represents the bounding box that fully contains this shape.
|
static Rectangle |
getBoundingBox(Shape a,
Shape b)
Get a bounding box that contains both
a and b . |
double |
getHeight()
Get the height of this shape's bounding box.
|
Point |
getMaximum() |
double |
getMaximumX() |
double |
getMaximumY() |
Point |
getMinimum() |
double |
getMinimumX() |
double |
getMinimumY() |
String |
getTypeName() |
double |
getWidth()
Get the width of this shape's bounding box.
|
int |
hashCode() |
boolean |
intersects(double minX,
double minY,
double maxX,
double maxY)
Check if this rectangle intersects with rectangle defined by (minX, minY), (maxX, maxY).
|
protected static boolean |
intersects(double minX1,
double minY1,
double maxX1,
double maxY1,
double minX2,
double minY2,
double maxX2,
double maxY2)
Check if 2 bounding boxes intersect.
|
boolean |
intersects(Rectangle box,
Shape other)
Check if this shape intersects with
other . |
boolean |
lineIntersects(double x1,
double y1,
double x2,
double y2)
Check if the line (x1, y1), (x2, y2) intersects with this polygon.
|
Rectangle |
readExternal(DataInput in) |
void |
setMaximum(Point value) |
void |
setMaximumX(double value) |
void |
setMaximumY(double value) |
void |
setMinimum(Point value) |
void |
setMinimumX(double value) |
void |
setMinimumY(double value) |
int |
size()
Return the number of vertices in this polygon.
|
void |
writeExternal(DataOutput out) |
getPoint, getPointX, getPointY, intersects
compareTo, contains, intersects, readExternal, toString, toString, toString, valueOf, writeExternal
public Rectangle()
public Rectangle(double minX, double minY, double maxX, double maxY)
public String getTypeName()
getTypeName
in class Shape
public double getWidth()
public double getHeight()
public int size()
size
in class AbstractPolygon
public double fastGetX(int index)
index
.
WARNING: this method assumes that index
is positive and
less than AbstractPolygon.size()
.
fastGetX
in class AbstractPolygon
public double fastGetY(int index)
index
.
WARNING: this method assumes that index
is positive and
less than AbstractPolygon.size()
.
fastGetY
in class AbstractPolygon
public Point getMinimum()
public void setMinimum(Point value)
public double getMinimumX()
public void setMinimumX(double value)
public double getMinimumY()
public void setMinimumY(double value)
public Point getMaximum()
public void setMaximum(Point value)
public double getMaximumX()
public void setMaximumX(double value)
public double getMaximumY()
public void setMaximumY(double value)
public Rectangle getBoundingBox()
getBoundingBox
in class Shape
public boolean contains(double x, double y)
x
, y
).public boolean intersects(Rectangle box, Shape other)
other
.intersects
in class AbstractPolygon
box
- The bounding box of this shape from Shape.getBoundingBox()
.other
- The shape to check for intersection withpublic boolean fastIntersects(Rectangle box)
box
.fastIntersects
in class Shape
public boolean intersects(double minX, double minY, double maxX, double maxY)
protected static boolean intersects(double minX1, double minY1, double maxX1, double maxY1, double minX2, double minY2, double maxX2, double maxY2)
public boolean lineIntersects(double x1, double y1, double x2, double y2)
lineIntersects
in class AbstractPolygon
public void addArguments(StringBuilder buffer)
addArguments
in class Shape
public int hashCode()
Shape
public static Rectangle getBoundingBox(Shape a, Shape b)
a
and b
.public void writeExternal(DataOutput out) throws IOException
writeExternal
in class Shape
IOException
public Rectangle readExternal(DataInput in) throws IOException
readExternal
in class Shape
IOException
Copyright © 2018 Attivio, Inc. All Rights Reserved.
PATENT NOTICE: Attivio, Inc. Software Related Patents. With respect to the Attivio software product(s) being used, the following patents apply: Querying Joined Data Within A Search Engine Index: United States Patent No.(s): 8,073,840. Ordered Processing of Groups of Messages: U.S. Patent No.(s) 8,495,656. Signal processing approach to sentiment analysis for entities in documents: U.S. Patent No.(s) 8,725,494. Other U.S. and International Patents Pending.