public class Circle extends Shape
positionChangeListeners, sizeChangeListeners| Constructor and Description |
|---|
Circle(Circle circle)
Constructs a
Circle as a copy of another |
Circle(float radius)
Constructs a
Circle at 0,0 with a radius |
Circle(float centerX,
float centerY,
float radius)
Constructs a
Circle with a center and radius |
Circle(Geometry geometry)
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(Circle circle)
Returns if another
Circle is contained within this one |
boolean |
contains(float x,
float y)
Returns if a set of coordinates are contained inside this shape
|
boolean |
contains(Polygon polygon)
|
boolean |
contains(Rectangle rectangle)
|
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 |
Shape |
copy()
Returns an exact copy of this
Shape |
void |
dispose()
|
void |
draw(Graphics g)
Draws this shape using a
Graphics instance |
EdgeIterator |
edgeIterator()
Returns an
EdgeIterator for looping over the edges of this
Shape |
boolean |
equals(java.lang.Object obj) |
void |
fill(Graphics g)
Fills this shape using a
Graphics instance |
Rectangle |
getBoundingBox()
Returns the bounding box of this
Circle |
float |
getCenterX()
Returns the center x coordinate of this object.
|
float |
getCenterY()
Returns the center y coordinate of this object.
|
float |
getDistanceFromCenter(float x,
float y)
Returns the distance from the center of this
Circle to a point |
float |
getDistanceFromCenter(org.mini2Dx.gdx.math.Vector2 point)
Returns the distance from the center of this
Circle to a point |
float |
getDistanceTo(float x,
float y)
Returns the distance from the edge of this
Circle to a point |
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 edges of this object
|
Polygon |
getPolygon()
|
float |
getRadius() |
float |
getRotation()
Returns the rotation of this
Shape |
float |
getWidth()
Returns the width of this object
|
float |
getX()
Returns the x coordinate of this object
|
float |
getY()
Returns the y coordinate of this object
|
int |
hashCode() |
boolean |
intersects(Circle circle)
Returns if the specified
Circle intersects this one |
boolean |
intersects(Rectangle rectangle)
|
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()
|
Circle |
lerp(Circle target,
float alpha) |
void |
rotate(float degrees)
Rotates this
Shape by a specified amount of degrees with its
first point as the origin |
void |
rotateAround(float centerX,
float centerY,
float degrees)
Rotates this
Shape by a specified amount of degrees around a
specified point |
void |
scale(float scale)
Scales the radius of this shape.
|
void |
set(Circle circle) |
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.
|
void |
setRotation(float degrees)
Sets the rotation of this
Shape with its first point as the
origin |
void |
setRotationAround(float centerX,
float centerY,
float degrees)
Sets the rotation of this
Shape with a specified point as the
origin |
void |
setX(float x)
Sets the x coordinate of this object
|
void |
setXY(float x,
float y)
Sets the x and y coordinate of this object
|
void |
setY(float y)
Sets the y coordinate of this object
|
void |
translate(float translateX,
float translateY)
Translates the x and y coordinate of this object
|
add, addPostionChangeListener, addSizeChangeListener, clearPositionChangeListeners, clearPositionListeners, clearPositionListeners, clearSizeChangeListeners, clearSizeListeners, clearSizeListeners, getDistanceTo, intersects, moveTowards, moveTowards, notifyPositionChangeListeners, notifyPositionListeners, notifyPositionListeners, notifySizeChangeListeners, notifySizeListeners, notifySizeListeners, removePositionChangeListener, removePositionListener, removePositionListener, removeSizeChangeListener, removeSizeListener, removeSizeListener, setRotationAround, subtractpublic Circle(float radius)
Circle at 0,0 with a radiusradius - The Circle radiuspublic Circle(float centerX,
float centerY,
float radius)
Circle with a center and radiuscenterX - The center x coordinatecenterY - The center y coordinateradius - The radiuspublic void dispose()
Shapepublic boolean contains(org.mini2Dx.gdx.math.Vector2 point)
SizeableVector2 is contained inside this shapepoint - The Vector2 to checkVector2public boolean contains(float x,
float y)
Sizeablex - The x coordinate to checky - The y coordinate to checkpublic boolean contains(Sizeable shape)
Sizeablepublic boolean contains(Circle circle)
Circle is contained within this onepublic boolean contains(Rectangle rectangle)
public boolean contains(Polygon polygon)
public boolean intersects(Sizeable shape)
Sizeablepublic boolean intersectsLineSegment(org.mini2Dx.gdx.math.Vector2 pointA,
org.mini2Dx.gdx.math.Vector2 pointB)
SizeablepointA - The first point in the line segmentpointB - The second point in the line segmentpublic boolean intersectsLineSegment(float x1,
float y1,
float x2,
float y2)
Sizeablex1 - 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 pointpublic float getWidth()
Sizeablepublic float getHeight()
Sizeablepublic boolean intersects(Rectangle rectangle)
rectangle - The Rectangle to test for intersectionpublic boolean intersects(Circle circle)
Circle intersects this onecircle - The Circle to test for intersectionpublic float getDistanceTo(float x,
float y)
Circle to a pointx - The x coordinatey - The y coordinatepublic float getDistanceFromCenter(org.mini2Dx.gdx.math.Vector2 point)
Circle to a pointpoint - The pointpublic float getDistanceFromCenter(float x,
float y)
Circle to a pointx - The x coordinatey - The y coordinatepublic int getNumberOfSides()
ShapegetNumberOfSides in interface SizeablegetNumberOfSides in class Shapepublic void draw(Graphics g)
ShapeGraphics instancepublic void fill(Graphics g)
ShapeGraphics instancepublic void set(Circle circle)
public float getX()
Positionablepublic float getY()
Positionablepublic void setX(float x)
Positionablex - The x coordinatepublic void setY(float y)
Positionabley - The y coordinatepublic float getCenterX()
SizeableCircle
this is the same as x.public float getCenterY()
SizeableCircle
this is the same as y.public void setCenter(float x,
float y)
Sizeablex - The x coordinate of the shape's centery - The y coordinate of the shape's centerpublic void setCenterX(float x)
Sizeablex - The x coordinate of the shape's centerpublic void setCenterY(float y)
Sizeabley - The y coordinate of the shape's centerpublic void setXY(float x,
float y)
Positionablex - The x coordinatey - The y coordinatepublic float getMinX()
Sizeablepublic float getMinY()
Sizeablepublic float getMaxX()
Sizeablepublic float getMaxY()
Sizeablepublic float getRadius()
public void setRadius(float radius)
SizeablePolygon shapes, this will
stretch in/out the shape from its center. Note that Polygons must
be equilateral.radius - The radius in pixelspublic void scale(float scale)
SizeablePolygon shapes, this will
stretch in/out the shape from its center. Note that Polygons must
be equilateral.scale - The amount to scale by (e.g. 2.0 = double the size)public void translate(float translateX,
float translateY)
Shapepublic EdgeIterator edgeIterator()
ShapeEdgeIterator for looping over the edges of this
ShapeedgeIterator in class ShapeEdgeIteratorpublic float getRotation()
ShapeShapegetRotation in class Shapepublic void setRotation(float degrees)
ShapeShape with its first point as the
originsetRotation in class Shapedegrees - The rotation in degreespublic void setRotationAround(float centerX,
float centerY,
float degrees)
ShapeShape with a specified point as the
originsetRotationAround in class ShapecenterX - The origin/center x coordinatecenterY - The origin/center y coordinatedegrees - The rotation in degreespublic void rotate(float degrees)
ShapeShape by a specified amount of degrees with its
first point as the originpublic void rotateAround(float centerX,
float centerY,
float degrees)
ShapeShape by a specified amount of degrees around a
specified pointrotateAround in class ShapecenterX - The origin/center x coordinatecenterY - The origin/center y coordinatedegrees - The rotation in degreespublic boolean isCircle()
Shapepublic Polygon getPolygon()
ShapegetPolygon in interface SizeablegetPolygon in class ShapeShape is a Circle