public interface Sizeable extends Positionable
Modifier and Type | Method and Description |
---|---|
<T extends Sizeable> |
addSizeChangeListener(SizeChangeListener<T> listener)
Adds a
SizeChangeListener to be notified of size changes |
boolean |
contains(float x,
float y)
Returns if a set of coordinates are contained inside this shape
|
boolean |
contains(Sizeable shape)
Returns if this shape contains the specified shape
|
boolean |
contains(org.mini2Dx.gdx.math.Vector2 point)
Returns if a
Vector2 is contained inside this shape |
float |
getCenterX()
Returns the center x coordinate of this object.
|
float |
getCenterY()
Returns the center y coordinate of this object.
|
float |
getHeight()
Returns the height of this object
|
float |
getMaxX()
Returns max X coordinate of this object
|
float |
getMaxY()
Returns max Y coordinate of this object
|
float |
getMinX()
Returns min X coordinate of this object
|
float |
getMinY()
Returns min Y coordinate of this object
|
int |
getNumberOfSides()
Returns the number of sides of this shape
|
Polygon |
getPolygon()
Returns the underlying
Polygon for this shape |
float |
getWidth()
Returns the width of this object
|
boolean |
intersects(LineSegment lineSegment)
Returns if this shape intersects the specified
LineSegment |
boolean |
intersects(Sizeable shape)
Returns if this shape intersects a shape
|
boolean |
intersectsLineSegment(float x1,
float y1,
float x2,
float y2)
Returns if this shape intersects a line segment
|
boolean |
intersectsLineSegment(org.mini2Dx.gdx.math.Vector2 pointA,
org.mini2Dx.gdx.math.Vector2 pointB)
Returns if this shape intersects a line segment
|
boolean |
isCircle()
Returns if this is a
Circle instance |
<T extends Sizeable> |
removeSizeChangeListener(SizeChangeListener<T> listener)
Removes a
SizeChangeListener to stop it being notified of size
changes |
void |
scale(float scale)
Scales the radius of this shape.
|
void |
setCenter(float x,
float y)
Sets the center x,y coordinate of this object
|
void |
setCenterX(float x)
Sets the center x coordinate
|
void |
setCenterY(float y)
Sets the center y coordianate
|
void |
setRadius(float radius)
Sets the radius of this shape.
|
addPostionChangeListener, getDistanceTo, getDistanceTo, getX, getY, moveTowards, moveTowards, removePositionChangeListener, setX, setXY, setY
boolean contains(Sizeable shape)
boolean contains(org.mini2Dx.gdx.math.Vector2 point)
Vector2
is contained inside this shapepoint
- The Vector2
to checkVector2
boolean contains(float x, float y)
x
- The x coordinate to checky
- The y coordinate to checkboolean intersects(Sizeable shape)
boolean intersects(LineSegment lineSegment)
LineSegment
lineSegment
- The LineSegment
to checkLineSegment
boolean intersectsLineSegment(org.mini2Dx.gdx.math.Vector2 pointA, org.mini2Dx.gdx.math.Vector2 pointB)
pointA
- The first point in the line segmentpointB
- The second point in the line segmentboolean intersectsLineSegment(float x1, float y1, float x2, float y2)
x1
- The x coordinate of the first pointy1
- The y coordinate of the first pointx2
- The x coordinate of the second pointy2
- The y coordinate of the second pointfloat getWidth()
float getHeight()
void setRadius(float radius)
Polygon
shapes, this will
stretch in/out the shape from its center. Note that Polygon
s must
be equilateral.radius
- The radius in pixelsvoid scale(float scale)
Polygon
shapes, this will
stretch in/out the shape from its center. Note that Polygon
s must
be equilateral.scale
- The amount to scale by (e.g. 2.0 = double the size)float getMinX()
float getMinY()
float getMaxX()
float getMaxY()
float getCenterX()
Circle
this is the same as x.float getCenterY()
Circle
this is the same as y.void setCenter(float x, float y)
x
- The x coordinate of the shape's centery
- The y coordinate of the shape's centervoid setCenterX(float x)
x
- The x coordinate of the shape's centervoid setCenterY(float y)
y
- The y coordinate of the shape's center<T extends Sizeable> void addSizeChangeListener(SizeChangeListener<T> listener)
SizeChangeListener
to be notified of size changeslistener
- The SizeChangeListener
to add<T extends Sizeable> void removeSizeChangeListener(SizeChangeListener<T> listener)
SizeChangeListener
to stop it being notified of size
changeslistener
- The SizeChangeListener
to removeboolean isCircle()
Circle
instanceCircle
instancePolygon getPolygon()
Polygon
for this shapePolygon
for this shapeint getNumberOfSides()
Circle