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(Parallelogram parallelogram)
Returns if the specified
Parallelogram is contained within this
one |
boolean |
contains(Positionable positionable)
Returns if the specified
Positionable is contained within this
shape |
boolean |
contains(Rectangle rectangle) |
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 |
<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
|
void |
set(float x,
float y,
float width,
float height) |
void |
set(Rectangle rectangle) |
void |
set(com.badlogic.gdx.math.Rectangle rectangle) |
void |
setHeight(float height) |
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
|
void |
setWidth(float width) |
void |
setX(float x) |
void |
setY(float y) |
contains, contains, getHeight, getWidth, getX, getY, merge, overlaps, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetHeight, getWidthgetX, getYpublic Rectangle()
Rectangle at 0,0 with a width and height of 1public 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 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)
public boolean contains(Positionable positionable)
ParallelogramPositionable is contained within this
shapecontains in interface Parallelogrampositionable - The Positionable to testParallelogram.contains(Positionable)public int getNumberOfSides()
getNumberOfSides in interface ShapeShape.getNumberOfSides()public void draw(Graphics g)
draw in interface ShapeShape.draw(Graphics)public void set(float x,
float y,
float width,
float height)
set in class com.badlogic.gdx.math.Rectanglepublic void set(Rectangle rectangle)
public void set(com.badlogic.gdx.math.Rectangle rectangle)
set in class com.badlogic.gdx.math.Rectanglepublic void setX(float x)
setX in class com.badlogic.gdx.math.Rectanglepublic void setY(float y)
setY in class com.badlogic.gdx.math.Rectanglepublic void setWidth(float width)
setWidth in class com.badlogic.gdx.math.Rectanglepublic void setHeight(float height)
setHeight 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 ParallelogramCopyright © 2014. All rights reserved.