Class representing a Polygon.
More...
Class representing a Polygon.
Otter.Polygon.Polygon |
( |
Polygon |
copy | ) |
|
Otter.Polygon.Polygon |
( |
params float[] |
points | ) |
|
Create a new Polygon.
- Parameters
-
points | A series of points to create the Polygon from (x1, y1, x2, y2, x3, y3...) |
void Otter.Polygon.Add |
( |
Vector2 |
point | ) |
|
Add a Vector2 to the list of points.
- Parameters
-
point | The Vector2 to add the points. |
void Otter.Polygon.Add |
( |
float |
x, |
|
|
float |
y |
|
) |
| |
Add an X Y position to the list of points.
- Parameters
-
x | The X position to add. |
y | The Y position to add. |
void Otter.Polygon.Clear |
( |
| ) |
|
bool Otter.Polygon.ContainsPoint |
( |
Vector2 |
point | ) |
|
Check to see if a Polygon contains a point.
- Parameters
-
point | The point to check for. |
- Returns
- True if the polygon contains the point.
bool Otter.Polygon.ContainsPoint |
( |
float |
x, |
|
|
float |
y |
|
) |
| |
Check to see if a Polygon contains a point.
- Parameters
-
x | The X position of the point to check for. |
y | The Y position of the point to check for. |
- Returns
- True if the polygon contains the point.
static Polygon Otter.Polygon.CreateCircle |
( |
float |
radius, |
|
|
int |
steps = 32 |
|
) |
| |
|
static |
Creates a Polygon in the shape of a circle.
- Parameters
-
radius | The radius of the circle. |
steps | How many steps to use to create the circle (higher is rounder.) |
- Returns
- A circle shaped Polygon.
static Polygon Otter.Polygon.CreateRectangle |
( |
float |
width, |
|
|
float |
height |
|
) |
| |
|
static |
Creates a Polygon in the shape of a rectangle.
- Parameters
-
width | The width of the rectangle. |
height | The height of the rectangle. |
- Returns
- A rectangle shaped Polygon.
List<Vector2> Otter.Polygon.GetAxes |
( |
| ) |
|
Get the axes to project on.
- Returns
- A list of normals from the polygon.
List<Line2> Otter.Polygon.GetEdgesAsLines |
( |
| ) |
|
Get a list of all the edges of the Polygon as Line2 objects.
- Returns
- A Line2 list of all edges.
void Otter.Polygon.OffsetPoints |
( |
Vector2 |
vector | ) |
|
Offset all the points by a Vector2 amount.
- Parameters
-
void Otter.Polygon.OffsetPoints |
( |
float |
x, |
|
|
float |
y |
|
) |
| |
Offset all the points by a Vector2 amount.
- Parameters
-
bool Otter.Polygon.Overlap |
( |
Polygon |
other | ) |
|
Test another Polygon for an overlap. Will not work if either Polygon is concave!
- Parameters
-
other | The other polygon to check. |
- Returns
- True if this polygon overlaps the other polygon.
Project the polygon onto an axis.
- Parameters
-
axis | The axis to project on. |
- Returns
- The min and max values of the projection.
void Otter.Polygon.Rotate |
( |
float |
amount, |
|
|
float |
aroundX, |
|
|
float |
aroundY |
|
) |
| |
Rotate the polygon by a specified amount.
- Parameters
-
amount | The amount in degrees to rotate. |
aroundX | The X position to rotate around. |
aroundY | The Y position to rotate around. |
void Otter.Polygon.Scale |
( |
float |
amountX, |
|
|
float |
amountY, |
|
|
float |
aroundX, |
|
|
float |
aroundY |
|
) |
| |
Scale the polygon by a specified amount.
- Parameters
-
amountX | The amount to scale horizontally. |
amountY | The amount to scale veritcally. |
aroundX | The X position to scale around. |
aroundY | The Y position to scale around. |
override string Otter.Polygon.ToString |
( |
| ) |
|
Convert to a string.
- Returns
- String of data about the Polygon.
The number of points in the Polygon.
float Otter.Polygon.HalfHeight |
|
get |
float Otter.Polygon.HalfWidth |
|
get |
float Otter.Polygon.Height |
|
get |
The Height of the polygon determined by the bottom most point minus the top most point.
Vector2 Otter.Polygon.this[int index] |
|
getset |
The list of Vector2 points in the Polygon.
- Parameters
-
index | The index of the point. |
- Returns
- The point at the specified index.
float Otter.Polygon.Width |
|
get |
The Width of the polygon determined by the right most point minus the left most point.
The documentation for this class was generated from the following file: