public class Rectangle extends com.badlogic.gdx.math.Rectangle implements Parallelogram
| Constructor and Description |
|---|
Rectangle()
Default constructor.
|
Rectangle(float x,
float y,
float width,
float height)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
<T extends Positionable> |
addPostionChangeListener(PositionChangeListener<T> listener)
Adds a
PositionChangeListener to be notified of coordinate
changes |
boolean |
contains(float x,
float y)
Returns if the specified coordinates are contained within this
Parallelogram |
boolean |
contains(Parallelogram parallelogram)
Returns if the specified
Parallelogram is contained within this
one |
boolean |
contains(Rectangle rectangle) |
boolean |
contains(com.badlogic.gdx.math.Rectangle rectangle) |
boolean |
contains(com.badlogic.gdx.math.Vector2 point) |
void |
debug(Graphics g)
Renders this
Rectangle and the LineSegments between each
of its point and its rotational center |
void |
draw(Graphics g) |
float |
getCenterX()
Returns the x coordinate of the center of this
Rectangle |
float |
getCenterY()
Returns the y coordinate of the center of this
Rectangle |
float |
getDistanceTo(Positionable positionable)
Returns this distance between this object's x,y coordinates and the
provided
Positionable's xy coordinates |
float |
getMaxX()
Returns the greatest x coordinate this
Rectangle |
float |
getMaxY()
Returns the greatest y coordinate this
Rectangle |
float |
getMinX()
Returns the least x coordinate this
Rectangle |
float |
getMinY()
Returns the least y coordinate this
Rectangle |
int |
getNumberOfSides() |
float |
getRotation()
Returns the current rotation of the shape in degrees
|
Rectangle |
intersection(Rectangle rect) |
boolean |
intersects(float x,
float y,
float width,
float height)
Returns if this shape intersects a specified rectangle dimensions
|
boolean |
intersects(LineSegment lineSegment)
Returns if this shape intersects a specified
LineSegment |
boolean |
intersects(Parallelogram parallelogram)
Returns if this shape intersects a specified
Parallelogram |
boolean |
intersects(Rectangle rectangle)
Returns if the specified
Rectangle intersects this one |
boolean |
overlaps(com.badlogic.gdx.math.Rectangle rectangle) |
<T extends Positionable> |
removePositionChangeListener(PositionChangeListener<T> listener)
Removes a
PositionChangeListener to stop it being notified of
coordinate changes |
void |
rotate(float degrees)
Rotates the shape around its top-left corner by the specified degrees
adding to its existing rotation
|
void |
rotateAround(Point center,
float degrees)
Rotates the shape around a center point by the specified degrees adding
to its existing rotation
|
Rectangle |
set(float x,
float y,
float width,
float height) |
void |
set(Rectangle rectangle) |
com.badlogic.gdx.math.Rectangle |
set(com.badlogic.gdx.math.Rectangle rectangle) |
Rectangle |
setHeight(float height) |
Rectangle |
setPosition(float x,
float y) |
Rectangle |
setPosition(com.badlogic.gdx.math.Vector2 position) |
void |
setRotation(float degrees)
Sets the current rotation of the shape around its top-left corner
Note: Rotates around the top-left corner
|
void |
setRotationAround(Point center,
float degrees)
Sets the current rotation of the shape around a center point
|
Rectangle |
setSize(float sizeXY) |
Rectangle |
setSize(float width,
float height) |
Rectangle |
setWidth(float width) |
Rectangle |
setX(float x) |
Rectangle |
setY(float y) |
java.lang.String |
toString() |
area, equals, fitInside, fitOutside, getAspectRatio, getCenter, getHeight, getPosition, getSize, getWidth, getX, getY, hashCode, merge, merge, merge, merge, perimeter, setCenter, setCenterclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetHeight, getWidthgetX, getYpublic Rectangle()
Rectangle at 0,0 with a width and
height of 1public void debug(Graphics g)
Rectangle and the LineSegments between each
of its point and its rotational centerg - The Graphics context to render topublic float getDistanceTo(Positionable positionable)
PositionablePositionable's xy coordinatesgetDistanceTo in interface Positionablepositionable - The Positionable to retrieve the distance fromPositionable.getDistanceTo(Positionable)public <T extends Positionable> void addPostionChangeListener(PositionChangeListener<T> listener)
PositionablePositionChangeListener to be notified of coordinate
changesaddPostionChangeListener in interface Positionablelistener - The PositionChangeListener to addPositionable.addPostionChangeListener(PositionChangeListener)public <T extends Positionable> void removePositionChangeListener(PositionChangeListener<T> listener)
PositionablePositionChangeListener to stop it being notified of
coordinate changesremovePositionChangeListener in interface Positionablelistener - The PositionChangeListener to removePositionable.removePositionChangeListener(PositionChangeListener)public float getRotation()
ParallelogramgetRotation in interface ParallelogramParallelogram.getRotation()public void setRotation(float degrees)
ParallelogramsetRotation in interface Parallelogramdegrees - The rotation angle in degreesParallelogram.setRotation(float)public void setRotationAround(Point center, float degrees)
ParallelogramsetRotationAround in interface Parallelogramcenter - The center point to rotate arounddegrees - The rotation angle in degreesParallelogram.setRotationAround(Point, float)public void rotate(float degrees)
Parallelogramrotate in interface Parallelogramdegrees - The rotation in degreesParallelogram.rotate(float)public void rotateAround(Point center, float degrees)
ParallelogramrotateAround in interface Parallelogramdegrees - The rotation in degreesParallelogram.rotateAround(Point, float)public boolean intersects(LineSegment lineSegment)
ParallelogramLineSegmentintersects in interface ParallelogramlineSegment - The LineSegment to test for intersectionParallelogram.intersects(LineSegment)public boolean intersects(Rectangle rectangle)
Rectangle intersects this onepublic boolean overlaps(com.badlogic.gdx.math.Rectangle rectangle)
overlaps in class com.badlogic.gdx.math.Rectanglepublic boolean intersects(Parallelogram parallelogram)
ParallelogramParallelogramintersects in interface Parallelogramparallelogram - The Parallelogram to test for intersectionParallelogram.intersects(Parallelogram)public boolean intersects(float x,
float y,
float width,
float height)
Parallelogramintersects in interface Parallelogramx - The x coordinate of the rectangley - The y coordinate of the rectanglewidth - The width of the rectangleheight - The height of the rectangleParallelogram.intersects(float, float, float, float)public boolean contains(Parallelogram parallelogram)
ParallelogramParallelogram is contained within this
onecontains in interface Parallelogramparallelogram - The Parallelogram to testParallelogram.contains(Parallelogram)public boolean contains(Rectangle rectangle)
Parallelogram.contains(Parallelogram)public boolean contains(com.badlogic.gdx.math.Rectangle rectangle)
contains in class com.badlogic.gdx.math.Rectanglepublic boolean contains(float x,
float y)
ParallelogramParallelogramcontains in interface Parallelogramcontains in class com.badlogic.gdx.math.Rectanglex - The x coordinatey - The y coordinatepublic boolean contains(com.badlogic.gdx.math.Vector2 point)
contains in class com.badlogic.gdx.math.Rectanglepublic int getNumberOfSides()
getNumberOfSides in interface ShapeShape.getNumberOfSides()public void draw(Graphics g)
draw in interface ShapeShape.draw(Graphics)public Rectangle set(float x, float y, float width, float height)
set in class com.badlogic.gdx.math.Rectanglepublic void set(Rectangle rectangle)
public com.badlogic.gdx.math.Rectangle set(com.badlogic.gdx.math.Rectangle rectangle)
set in class com.badlogic.gdx.math.Rectanglepublic Rectangle setPosition(float x, float y)
setPosition in class com.badlogic.gdx.math.Rectanglepublic Rectangle setPosition(com.badlogic.gdx.math.Vector2 position)
setPosition in class com.badlogic.gdx.math.Rectanglepublic Rectangle setX(float x)
setX in class com.badlogic.gdx.math.Rectanglepublic Rectangle setY(float y)
setY in class com.badlogic.gdx.math.Rectanglepublic Rectangle setWidth(float width)
setWidth in class com.badlogic.gdx.math.Rectanglepublic Rectangle setHeight(float height)
setHeight in class com.badlogic.gdx.math.Rectanglepublic Rectangle setSize(float width, float height)
setSize in class com.badlogic.gdx.math.Rectanglepublic Rectangle setSize(float sizeXY)
setSize in class com.badlogic.gdx.math.Rectanglepublic float getCenterX()
Rectanglepublic float getCenterY()
Rectanglepublic float getMinX()
Rectanglepublic float getMinY()
Rectanglepublic float getMaxX()
RectanglegetMaxX in interface Parallelogrampublic float getMaxY()
RectanglegetMaxY in interface Parallelogrampublic java.lang.String toString()
toString in class com.badlogic.gdx.math.Rectangle