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, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getHeight, getWidth
getX, getY
public Rectangle()
Rectangle
at 0,0 with a width and height of 1public float getDistanceTo(Positionable positionable)
Positionable
Positionable
's xy coordinatesgetDistanceTo
in interface Positionable
positionable
- The Positionable
to retrieve the distance fromPositionable.getDistanceTo(Positionable)
public <T extends Positionable> void addPostionChangeListener(PositionChangeListener<T> listener)
Positionable
PositionChangeListener
to be notified of coordinate
changesaddPostionChangeListener
in interface Positionable
listener
- The PositionChangeListener
to addPositionable.addPostionChangeListener(PositionChangeListener)
public <T extends Positionable> void removePositionChangeListener(PositionChangeListener<T> listener)
Positionable
PositionChangeListener
to stop it being notified of
coordinate changesremovePositionChangeListener
in interface Positionable
listener
- The PositionChangeListener
to removePositionable.removePositionChangeListener(PositionChangeListener)
public float getRotation()
Parallelogram
getRotation
in interface Parallelogram
Parallelogram.getRotation()
public void setRotation(float degrees)
Parallelogram
setRotation
in interface Parallelogram
degrees
- The rotation angle in degreesParallelogram.setRotation(float)
public void setRotationAround(Point center, float degrees)
Parallelogram
setRotationAround
in interface Parallelogram
center
- The center point to rotate arounddegrees
- The rotation angle in degreesParallelogram.setRotationAround(Point, float)
public void rotate(float degrees)
Parallelogram
rotate
in interface Parallelogram
degrees
- The rotation in degreesParallelogram.rotate(float)
public void rotateAround(Point center, float degrees)
Parallelogram
rotateAround
in interface Parallelogram
degrees
- The rotation in degreesParallelogram.rotateAround(Point, float)
public boolean intersects(LineSegment lineSegment)
Parallelogram
LineSegment
intersects
in interface Parallelogram
lineSegment
- The LineSegment
to test for intersectionParallelogram.intersects(LineSegment)
public boolean intersects(Rectangle rectangle)
Rectangle
intersects this onepublic boolean intersects(Parallelogram parallelogram)
Parallelogram
Parallelogram
intersects
in interface Parallelogram
parallelogram
- The Parallelogram
to test for intersectionParallelogram.intersects(Parallelogram)
public boolean intersects(float x, float y, float width, float height)
Parallelogram
intersects
in interface Parallelogram
x
- 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)
Parallelogram
Parallelogram
is contained within this
onecontains
in interface Parallelogram
parallelogram
- The Parallelogram
to testParallelogram.contains(Parallelogram)
public boolean contains(Rectangle rectangle)
public boolean contains(Positionable positionable)
Parallelogram
Positionable
is contained within this
shapecontains
in interface Parallelogram
positionable
- The Positionable
to testParallelogram.contains(Positionable)
public int getNumberOfSides()
getNumberOfSides
in interface Shape
Shape.getNumberOfSides()
public void draw(Graphics g)
draw
in interface Shape
Shape.draw(Graphics)
public void set(float x, float y, float width, float height)
set
in class com.badlogic.gdx.math.Rectangle
public void set(Rectangle rectangle)
public void set(com.badlogic.gdx.math.Rectangle rectangle)
set
in class com.badlogic.gdx.math.Rectangle
public void setX(float x)
setX
in class com.badlogic.gdx.math.Rectangle
public void setY(float y)
setY
in class com.badlogic.gdx.math.Rectangle
public void setWidth(float width)
setWidth
in class com.badlogic.gdx.math.Rectangle
public void setHeight(float height)
setHeight
in class com.badlogic.gdx.math.Rectangle
public float getCenterX()
Rectangle
public float getCenterY()
Rectangle
public float getMinX()
Rectangle
public float getMinY()
Rectangle
public float getMaxX()
Rectangle
getMaxX
in interface Parallelogram
public float getMaxY()
Rectangle
getMaxY
in interface Parallelogram
Copyright © 2014. All rights reserved.