public class Circle extends java.lang.Object implements java.io.Serializable, Shape2D
| Constructor and Description |
|---|
Circle()
Constructs a new circle with all values set to zero
|
Circle(Circle circle)
Copy constructor
|
Circle(float x,
float y,
float radius)
Constructs a new circle with the given X and Y coordinates and the given radius.
|
Circle(Vector2 position,
float radius)
Constructs a new circle using a given
Vector2 that contains the desired X and Y coordinates, and a given radius. |
Circle(Vector2 center,
Vector2 edge)
Creates a new
Circle in terms of its center and a point on its edge. |
| Modifier and Type | Method and Description |
|---|---|
float |
area() |
float |
circumference() |
boolean |
contains(Circle c) |
boolean |
contains(float x,
float y)
Checks whether or not this circle contains a given point.
|
boolean |
contains(Vector2 point)
Checks whether or not this circle contains a given point.
|
boolean |
equals(java.lang.Object o) |
int |
hashCode() |
boolean |
overlaps(Circle c) |
void |
set(Circle circle)
Sets a new location and radius for this circle, based upon another circle.
|
void |
set(float x,
float y,
float radius)
Sets a new location and radius for this circle.
|
void |
set(Vector2 position,
float radius)
Sets a new location and radius for this circle.
|
void |
set(Vector2 center,
Vector2 edge)
Sets this
Circle's values in terms of its center and a point on its edge. |
void |
setPosition(float x,
float y)
Sets the x and y-coordinates of circle center
|
void |
setPosition(Vector2 position)
Sets the x and y-coordinates of circle center from vector
|
void |
setRadius(float radius)
Sets the radius of circle
|
void |
setX(float x)
Sets the x-coordinate of circle center
|
void |
setY(float y)
Sets the y-coordinate of circle center
|
java.lang.String |
toString()
|
public Circle()
public Circle(float x,
float y,
float radius)
x - X coordinatey - Y coordinateradius - The radius of the circlepublic Circle(Vector2 position, float radius)
Vector2 that contains the desired X and Y coordinates, and a given radius.position - The position Vector2.radius - The radiuspublic Circle(Circle circle)
circle - The circle to construct a copy of.public void set(float x,
float y,
float radius)
x - X coordinatey - Y coordinateradius - Circle radiuspublic void set(Vector2 position, float radius)
position - Position Vector2 for this circle.radius - Circle radiuspublic void set(Circle circle)
circle - The circle to copy the position and radius of.public void set(Vector2 center, Vector2 edge)
Circle's values in terms of its center and a point on its edge.center - The new center of the circleedge - Any point on the edge of the given circlepublic void setPosition(Vector2 position)
position - The position vectorpublic void setPosition(float x,
float y)
x - The x-coordinatey - The y-coordinatepublic void setX(float x)
x - The x-coordinatepublic void setY(float y)
y - The y-coordinatepublic void setRadius(float radius)
radius - The radiuspublic boolean contains(float x,
float y)
public boolean contains(Vector2 point)
public boolean contains(Circle c)
c - the other Circlepublic boolean overlaps(Circle c)
c - the other Circlepublic java.lang.String toString()
toString in class java.lang.Objectpublic float circumference()
MathUtils.PI2) * radiuspublic float area()
MathUtils.PI * radius * radius).public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Object