Class PolygonTools
- Namespace
- Alis.Core.Physic.Common
- Assembly
- Alis.dll
The polygon tools class
public static class PolygonTools
Inheritance
Inherited Members
Methods
CreateArc(float, int, float)
Creates the arc using the specified radians
public static Vertices CreateArc(float radians, int sides, float radius)
Parameters
Returns
- Vertices
-
The vertices
CreateCapsule(float, float, int)
Creates an capsule with the specified height, radius and number of edges. A capsule has the same form as a pill capsule.
public static Vertices CreateCapsule(float height, float endRadius, int edges)
Parameters
height
float-
Height (inner height + 2 * radius) of the capsule.
endRadius
float-
Radius of the capsule ends.
edges
int-
The number of edges of the capsule ends. The more edges, the more it resembles an capsule
Returns
CreateCapsule(float, float, int, float, int)
Creates an capsule with the specified height, radius and number of edges. A capsule has the same form as a pill capsule.
public static Vertices CreateCapsule(float height, float topRadius, int topEdges, float bottomRadius, int bottomEdges)
Parameters
height
float-
Height (inner height + radii) of the capsule.
topRadius
float-
Radius of the top.
topEdges
int-
The number of edges of the top. The more edges, the more it resembles an capsule
bottomRadius
float-
Radius of bottom.
bottomEdges
int-
The number of edges of the bottom. The more edges, the more it resembles an capsule
Returns
CreateCircle(float, int)
Creates a circle with the specified radius and number of edges.
public static Vertices CreateCircle(float radius, int numberOfEdges)
Parameters
radius
float-
The radius.
numberOfEdges
int-
The number of edges. The more edges, the more it resembles a circle
Returns
CreateEllipse(float, float, int)
Creates a ellipse with the specified width, height and number of edges.
public static Vertices CreateEllipse(float xRadius, float yRadius, int numberOfEdges)
Parameters
xRadius
float-
Width of the ellipse.
yRadius
float-
Height of the ellipse.
numberOfEdges
int-
The number of edges. The more edges, the more it resembles an ellipse
Returns
CreateGear(float, int, float, float)
Creates a gear shape with the specified radius and number of teeth.
public static Vertices CreateGear(float radius, int numberOfTeeth, float tipPercentage, float toothHeight)
Parameters
radius
float-
The radius.
numberOfTeeth
int-
The number of teeth.
tipPercentage
float-
The tip percentage.
toothHeight
float-
Height of the tooth.
Returns
CreateLine(Vector2, Vector2)
Set this as a single edge.
public static Vertices CreateLine(Vector2 start, Vector2 end)
Parameters
Returns
CreateRectangle(float, float)
Build vertices to represent an axis-aligned box.
public static Vertices CreateRectangle(float hx, float hy)
Parameters
Returns
CreateRectangle(float, float, Vector2, float)
Build vertices to represent an oriented box.
public static Vertices CreateRectangle(float hx, float hy, Vector2 center, float angle)
Parameters
hx
float-
the half-width.
hy
float-
the half-height.
center
Vector2-
the center of the box in local coordinates.
angle
float-
the rotation of the box in local coordinates.
Returns
CreateRoundedRectangle(float, float, float, float, int)
Creates a rounded rectangle with the specified width and height.
public static Vertices CreateRoundedRectangle(float width, float height, float xRadius, float yRadius, int segments)
Parameters
width
float-
The width.
height
float-
The height.
xRadius
float-
The rounding X radius.
yRadius
float-
The rounding Y radius.
segments
int-
The number of segments to subdivide the edges.