Class Polygon
Definition
- Namespace:
- Tizen.NUI.Physics2D.Chipmunk
- Assembly:
- Tizen.NUI.Physics2D.dll
A polygon shape composed of connected vertices.
public class Polygon : Shape
- Inheritance
-
Constructors
View Source
Polygon(Body, IReadOnlyList<Vect>, Transform, double)
A convex polygon shape. It's the slowest, but most flexible collision shape.
Declaration
public Polygon(Body body, IReadOnlyList<Vect> verts, Transform transform, double radius)
Parameters
Type |
Name |
Description |
Body |
body |
|
IReadOnlyList<><Vect> |
verts |
|
Transform |
transform |
|
double |
radius |
|
View Source
Polygon(Body, Vect[], double)
Allocate and initialize a polygon shape with rounded corners.
The vertexes must be convex with a counter-clockwise winding.
Declaration
public Polygon(Body body, Vect[] verts, double radius)
Parameters
Type |
Name |
Description |
Body |
body |
|
Vect[] |
verts |
|
double |
radius |
|
Properties
View Source
Area
Get and calculate the signed area of this polygon. Vertices specified such that they connect in
a clockwise fashion (called winding) give a positive area measurement. This is probably
backwards to what you might expect.
Declaration
public double Area { get; }
Property Value
View Source
Centroid
Get and calculate the centroid of the polygon.
Declaration
public Vect Centroid { get; }
Property Value
View Source
Count
Get the number of vertices in a polygon shape.
Declaration
public int Count { get; }
Property Value
View Source
Radius
Get the radius of the polygon.
Declaration
public double Radius { get; }
Property Value
View Source
Vertices
Get the vertices of the polygon.
Declaration
public IReadOnlyList<Vect> Vertices { get; }
Property Value
Type |
Description |
IReadOnlyList<><Vect> |
|
Methods
View Source
AreaForPoly(IReadOnlyList<Vect>, double)
Calculate the signed area of this polygon. Vertices specified such that they connect in
a clockwise fashion (called winding) give a positive area measurement. This is probably
backwards to what you might expect.
Declaration
public static double AreaForPoly(IReadOnlyList<Vect> vertices, double radius)
Parameters
Type |
Name |
Description |
IReadOnlyList<><Vect> |
vertices |
|
double |
radius |
|
Returns
View Source
CentroidForPoly(IReadOnlyList<Vect>)
Calculate the natural centroid of a polygon.
Declaration
public static Vect CentroidForPoly(IReadOnlyList<Vect> vertices)
Parameters
Type |
Name |
Description |
IReadOnlyList<><Vect> |
vertices |
|
Returns
View Source
GetVertex(int)
Get the i
th vertex of a polygon shape.
Declaration
public Vect GetVertex(int i)
Parameters
Type |
Name |
Description |
int |
i |
|
Returns
View Source
MomentForPolygon(double, IReadOnlyList<Vect>, Vect, double)
Calculate the moment of inertia for a solid polygon shape assuming its center of gravity
is at its centroid. The offset is added to each vertex.
Declaration
public static double MomentForPolygon(double mass, IReadOnlyList<Vect> vertices, Vect offset, double radius)
Parameters
Type |
Name |
Description |
double |
mass |
|
IReadOnlyList<><Vect> |
vertices |
|
Vect |
offset |
|
double |
radius |
|
Returns
Extension Methods