public class Rectangle2DInt extends Object
| Modifier and Type | Field and Description |
|---|---|
Point2DInt |
position |
Point2DInt |
size |
| Constructor and Description |
|---|
Rectangle2DInt(int x,
int y,
int width,
int height)
Constructor.
|
Rectangle2DInt(Point2DInt position,
Point2DInt size)
Constructor.
|
Rectangle2DInt(Rectangle2DInt copy)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(int px,
int py)
return true if the given point is contained within this rectangle.
|
boolean |
contains(Point2DInt point)
return true if the given point is contained within this rectangle.
|
boolean |
contains(Point2DInt point,
int tolerance)
return true if the given point is contained within this rectangle.
|
boolean |
contains(Rectangle2DInt r)
return true if this rectangle contains entirely the given rectangle r.
|
boolean |
equals(Object obj) |
void |
extendToContain(Rectangle2DInt r)
Extand this rectangle so it can contain the given rectangle.
|
Line2DInt |
getBottomLine()
Return the line if the bottom edge.
|
Point2DInt[] |
getIntersection(Line2DInt line)
return the intersection points between this rectangle and the given line: it may returns 0, 1 or 2 points.
|
Rectangle2DInt |
getIntersection(Rectangle2DInt r)
return the rectangle corresponding to the intersection or null if there is no intersection.
|
Point2DInt[] |
getIntersectionPoints(Rectangle2DInt r)
return the intersection points between this rectangle and the given one or null if both are equals:
it may return 0 to 2 points (1 point being the case where only one of their corner is common).
|
Line2DInt |
getLeftLine()
Return the line of the left edge.
|
Line2DInt |
getRightLine()
Return the line of the right edge.
|
Line2DInt |
getTopLine()
Return the line of the top edge.
|
boolean |
hasCommonArea(Rectangle2DInt r)
return true if this rectangle contains the given rectangle, or has an intersection with it.
|
int |
hashCode() |
String |
toString() |
public Point2DInt position
public Point2DInt size
public Rectangle2DInt(int x,
int y,
int width,
int height)
public Rectangle2DInt(Point2DInt position, Point2DInt size)
public Rectangle2DInt(Rectangle2DInt copy)
public boolean contains(Point2DInt point)
public boolean contains(int px,
int py)
public boolean contains(Point2DInt point, int tolerance)
public boolean contains(Rectangle2DInt r)
public boolean hasCommonArea(Rectangle2DInt r)
public Point2DInt[] getIntersection(Line2DInt line)
public Rectangle2DInt getIntersection(Rectangle2DInt r)
public Point2DInt[] getIntersectionPoints(Rectangle2DInt r)
public void extendToContain(Rectangle2DInt r)
public Line2DInt getTopLine()
public Line2DInt getBottomLine()
public Line2DInt getLeftLine()
public Line2DInt getRightLine()
Copyright © 2017. All rights reserved.