public class DRectangle
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
double |
height
The height of this rectangle.
|
double |
width
The width of this rectangle.
|
double |
x
The minimum x-coordinate for this rectangle.
|
double |
y
The minimum y-coordinate for this rectangle.
|
Constructor and Description |
---|
DRectangle(double x,
double y,
double width,
double height)
Constructs a rectangle.
|
DRectangle(DRectangle r)
Constructs a copy of the specified rectangle.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(double x,
double y)
Determines whether this rectangle contains the point (x,y).
|
boolean |
contains(DPoint point)
Determines whether this rectangle contains the specified point.
|
boolean |
equals(java.lang.Object obj) |
int |
hashCode() |
DRectangle |
intersection(DRectangle rect)
Returns the intersection of this rectangle and a specified rectangle.
|
boolean |
isEmpty()
Determines whether this rectangle is empty.
|
java.lang.String |
toString() |
DRectangle |
union(DRectangle rect)
Returns the union of this rectangle and a specified rectangle.
|
public double x
public double y
public double width
public double height
public DRectangle(double x, double y, double width, double height)
x
- the minimum x coordinate.y
- the minimum y coordinate.width
- the width; must not be negative.height
- the height; must not be negative.public DRectangle(DRectangle r)
r
- the rectangle.public DRectangle union(DRectangle rect)
rect
- a rectangle.public DRectangle intersection(DRectangle rect)
rect
- a rectangle.public boolean isEmpty()
public boolean contains(DPoint point)
point
- the point.public boolean contains(double x, double y)
x
- the x-coordinate of the point.y
- the y-coordinate of the point.public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object