| Modifier and Type | Field and Description |
|---|---|
| private Rectangle | |
| private boolean | |
| private float[] | |
| private float | |
| private float | |
| private float | |
| private float | |
| private float | |
| private float[] | |
| private float | |
| private float |
| Access | Constructor and Description |
|---|---|
| public | |
| public | Polygon(float[]
an array where every even element represents the horizontal part of a point, and the following element
representing the vertical part vertices)Constructs a new polygon from a float array of parts of vertex points. |
| Modifier and Type | Method and Description |
|---|---|
| public float | |
| public boolean | contains(float x, float y)
Implements com. Returns whether an x, y pair is contained within the polygon. |
| public boolean | contains(Vector2 point)
Implements com. Returns whether the given point is contained within the shape. |
| public void | |
| public Rectangle | Returns: this polygon's bounding boxRectangleReturns an axis-aligned bounding box of this polygon. |
| public Vector2 | |
| public float | |
| public float | |
| public float | |
| public float | |
| public float | |
| public float[] | Returns: vertices scaled, rotated, and offset by the polygon position.Calculates and returns the vertices of the polygon after scaling, rotation, and positional translations have been applied, as they are position within the world. |
| public Vector2 | |
| public int | |
| public float[] | getVertices()
Returns the polygon's local vertices without scaling or rotation and without being offset by the polygon position. |
| public float | |
| public float | |
| public void | |
| public void | |
| public void | |
| public void | setOrigin(float originX, float originY)
Sets the origin point to which all of the polygon's local vertices are relative to. |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | setVertices(float[]
float array where every even element represents the x-coordinate of a vertex, and the proceeding element
representing the y-coordinate. vertices)Sets the polygon's local vertices relative to the origin point, without any scaling, rotating or translations being applied. |
| public void | translate(float x, float y)
Translates the polygon's position by the specified horizontal and vertical amounts. |
| bounds | back to summary |
|---|---|
| private Rectangle bounds | |
| dirty | back to summary |
|---|---|
| private boolean dirty | |
| localVertices | back to summary |
|---|---|
| private float[] localVertices | |
| originX | back to summary |
|---|---|
| private float originX | |
| originY | back to summary |
|---|---|
| private float originY | |
| rotation | back to summary |
|---|---|
| private float rotation | |
| scaleX | back to summary |
|---|---|
| private float scaleX | |
| scaleY | back to summary |
|---|---|
| private float scaleY | |
| worldVertices | back to summary |
|---|---|
| private float[] worldVertices | |
| x | back to summary |
|---|---|
| private float x | |
| y | back to summary |
|---|---|
| private float y | |
| Polygon | back to summary |
|---|---|
| public Polygon() Constructs a new polygon with no vertices. | |
| Polygon | back to summary |
|---|---|
| public Polygon(float[] vertices) Constructs a new polygon from a float array of parts of vertex points.
| |
| area | back to summary |
|---|---|
| public float area() Returns the area contained within the polygon. | |
| contains | back to summary |
|---|---|
| public boolean contains(float x, float y) Implements com. Returns whether an x, y pair is contained within the polygon.
| |
| contains | back to summary |
|---|---|
| public boolean contains(Vector2 point) Implements com. Doc from com. Returns whether the given point is contained within the shape.
| |
| dirty | back to summary |
|---|---|
| public void dirty() Sets the polygon's world vertices to be recalculated when calling | |
| getBoundingRectangle | back to summary |
|---|---|
| public Rectangle getBoundingRectangle() Returns an axis-aligned bounding box of this polygon. Note the returned Rectangle is cached in this polygon, and will be reused if this Polygon is changed. | |
| getCentroid | back to summary |
|---|---|
| public Vector2 getCentroid(Vector2 centroid) | |
| getOriginX | back to summary |
|---|---|
| public float getOriginX() Returns the x-coordinate of the polygon's origin point. | |
| getOriginY | back to summary |
|---|---|
| public float getOriginY() Returns the y-coordinate of the polygon's origin point. | |
| getRotation | back to summary |
|---|---|
| public float getRotation() Returns the total rotation applied to the polygon. | |
| getScaleX | back to summary |
|---|---|
| public float getScaleX() Returns the total horizontal scaling applied to the polygon. | |
| getScaleY | back to summary |
|---|---|
| public float getScaleY() Returns the total vertical scaling applied to the polygon. | |
| getTransformedVertices | back to summary |
|---|---|
| public float[] getTransformedVertices() Calculates and returns the vertices of the polygon after scaling, rotation, and positional translations have been applied, as they are position within the world.
| |
| getVertex | back to summary |
|---|---|
public Vector2 getVertex(int vertexNum, Vector2 pos)
| |
| getVertexCount | back to summary |
|---|---|
| public int getVertexCount() | |
| getVertices | back to summary |
|---|---|
| public float[] getVertices() Returns the polygon's local vertices without scaling or rotation and without being offset by the polygon position. | |
| getX | back to summary |
|---|---|
| public float getX() Returns the x-coordinate of the polygon's position within the world. | |
| getY | back to summary |
|---|---|
| public float getY() Returns the y-coordinate of the polygon's position within the world. | |
| resetTransformations | back to summary |
|---|---|
| public void resetTransformations() | |
| rotate | back to summary |
|---|---|
| public void rotate(float degrees) Applies additional rotation to the polygon by the supplied degrees. | |
| scale | back to summary |
|---|---|
| public void scale(float amount) Applies additional scaling to the polygon by the supplied amount. | |
| setOrigin | back to summary |
|---|---|
| public void setOrigin(float originX, float originY) Sets the origin point to which all of the polygon's local vertices are relative to. | |
| setPosition | back to summary |
|---|---|
| public void setPosition(float x, float y) Sets the polygon's position within the world. | |
| setRotation | back to summary |
|---|---|
| public void setRotation(float degrees) Sets the polygon to be rotated by the supplied degrees. | |
| setScale | back to summary |
|---|---|
| public void setScale(float scaleX, float scaleY) Sets the amount of scaling to be applied to the polygon. | |
| setVertex | back to summary |
|---|---|
| public void setVertex(int vertexNum, float x, float y) Set vertex position
| |
| setVertices | back to summary |
|---|---|
| public void setVertices(float[] vertices) Sets the polygon's local vertices relative to the origin point, without any scaling, rotating or translations being applied.
| |
| translate | back to summary |
|---|---|
| public void translate(float x, float y) Translates the polygon's position by the specified horizontal and vertical amounts. | |