public class Rectangle extends Object implements Shape
Constructor and Description |
---|
Rectangle()
Create a blank rectangle.
|
Rectangle(double x,
double y,
double width,
double height)
Create a rectangle.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(double x,
double y)
Check if the rectangle contains the point.
|
boolean |
contains(Rectangle rectangle)
Check if the rectangle contains the other.
|
boolean |
equals(Object obj) |
int |
getHeight()
Get the current height.
|
double |
getHeightReal()
Get the real width.
|
double |
getMaxX()
Get the max x location.
|
double |
getMaxY()
Get the max y location.
|
double |
getMinX()
Get the min x location.
|
double |
getMinY()
Get the min y location.
|
int |
getWidth()
Get the current width.
|
double |
getWidthReal()
Get the real width.
|
double |
getX()
Get the current horizontal location.
|
double |
getY()
Get the current vertical location.
|
int |
hashCode() |
boolean |
intersects(Rectangle rectangle)
Check if the rectangle intersects the other.
|
Rectangle |
rotate(double angle)
Rotate rectangle with specific angle.
|
void |
set(double x,
double y,
double w,
double h)
Sets the location and size.
|
String |
toString() |
void |
translate(double vx,
double vy)
Translate rectangle using specified vector.
|
public Rectangle()
public Rectangle(double x, double y, double width, double height)
x
- The horizontal location.y
- The vertical location.width
- The rectangle width.height
- The rectangle height.public boolean intersects(Rectangle rectangle)
rectangle
- The rectangle to test with.true
if intersect, false
else.public boolean contains(Rectangle rectangle)
rectangle
- The rectangle to test with.true
if contains, false
else.public boolean contains(double x, double y)
x
- The horizontal location.y
- The vertical location.true
if contains, false
else.public void translate(double vx, double vy)
vx
- The horizontal translation vector.vy
- The vertical translation vector.public Rectangle rotate(double angle)
angle
- The angle in degree.public void set(double x, double y, double w, double h)
x
- The horizontal location.y
- The vertical location.w
- The rectangle width.h
- The rectangle height.public double getMinX()
public double getMinY()
public double getMaxX()
public double getMaxY()
public double getWidthReal()
public double getHeightReal()
public double getX()
Localizable
getX
in interface Localizable
public double getY()
Localizable
getY
in interface Localizable
public int getWidth()
Surface
public int getHeight()
Surface
Copyright © 2017 Byron 3D Games Studio. All rights reserved.