public class Ellipse extends Object implements Serializable, Shape2D
Modifier and Type | Field and Description |
---|---|
float |
height |
float |
width |
float |
x |
float |
y |
Constructor and Description |
---|
Ellipse()
Construct a new ellipse with all values set to zero
|
Ellipse(Circle circle)
|
Ellipse(Ellipse ellipse)
Copy constructor
|
Ellipse(float x,
float y,
float width,
float height)
Constructs a new ellipse
|
Ellipse(Vector2 position,
float width,
float height)
Costructs a new ellipse
|
Ellipse(Vector2 position,
Vector2 size) |
Modifier and Type | Method and Description |
---|---|
float |
area() |
float |
circumference()
Approximates the circumference of this
Ellipse . |
boolean |
contains(float x,
float y)
Checks whether or not this ellipse contains the given point.
|
boolean |
contains(Vector2 point)
Checks whether or not this ellipse contains the given point.
|
boolean |
equals(Object o) |
int |
hashCode() |
void |
set(Circle circle) |
void |
set(Ellipse ellipse)
Sets a new position and size for this ellipse based upon another ellipse.
|
void |
set(float x,
float y,
float width,
float height)
Sets a new position and size for this ellipse.
|
void |
set(Vector2 position,
Vector2 size) |
Ellipse |
setPosition(float x,
float y)
Sets the x and y-coordinates of ellipse center
|
Ellipse |
setPosition(Vector2 position)
Sets the x and y-coordinates of ellipse center from a
Vector2 . |
Ellipse |
setSize(float width,
float height)
Sets the width and height of this ellipse
|
public Ellipse()
public Ellipse(Ellipse ellipse)
ellipse
- Ellipse to construct a copy of.public Ellipse(float x, float y, float width, float height)
x
- X coordinatey
- Y coordinatewidth
- Width in pixelsheight
- Height in pixelspublic Ellipse(Vector2 position, float width, float height)
position
- Position vectorwidth
- Width in pixelsheight
- Height in pixelspublic boolean contains(float x, float y)
x
- X coordinatey
- Y coordinatepublic boolean contains(Vector2 point)
point
- Position vectorpublic void set(float x, float y, float width, float height)
x
- X coordinatey
- Y coordinatewidth
- Width in pixelsheight
- Height in pixelspublic void set(Ellipse ellipse)
ellipse
- The ellipse to copy the position and size of.public void set(Circle circle)
public Ellipse setPosition(Vector2 position)
Vector2
.position
- The position vectorpublic Ellipse setPosition(float x, float y)
x
- The x-coordinatey
- The y-coordinatepublic Ellipse setSize(float width, float height)
width
- The widthheight
- The heightpublic float area()
Ellipse
as MathUtils.PI
* width
* height
public float circumference()
Ellipse
. Oddly enough, the circumference of an ellipse is actually difficult
to compute exactly.Copyright © 2015. All rights reserved.