Path
Declaration
public class tainicom.Aether.Physics2D.Common.Path
Path: Very similar to Vertices, but this class contains vectors describing control points on a Catmull-Rom curve.
Constructors
Path
Initializes a new instance of the Path class.
void Path()
Path
Initializes a new instance of the Path class.
void Path(Vector2[] vertices)
Parameters:
| Name | Type | Description |
|---|---|---|
vertices |
Strawberry.Math.Vector2[] |
The vertices to created the path from. |
Path
Initializes a new instance of the Path class.
void Path(IList<Vector2> vertices)
Parameters:
| Name | Type | Description |
|---|---|---|
vertices |
System.Collections.Generic.IList |
The vertices to created the path from. |
Properties
Closed
True if the curve is closed.
bool Closed { get set }
Value: true if closed; otherwise, false.
Fields
ControlPoints
All the points that makes up the curve
List<Vector2> ControlPoints
Methods
NextIndex
Gets the next index of a controlpoint
int NextIndex(int index)
Parameters:
| Name | Type | Description |
|---|---|---|
index |
System.Int32 |
The index. |
PreviousIndex
Gets the previous index of a controlpoint
int PreviousIndex(int index)
Parameters:
| Name | Type | Description |
|---|---|---|
index |
System.Int32 |
The index. |
Translate
Translates the control points by the specified vector.
void Translate(ref Vector2 vector)
Parameters:
| Name | Type | Description |
|---|---|---|
vector |
ref Strawberry.Math.Vector2 |
The vector. |
Scale
Scales the control points by the specified vector.
void Scale(ref Vector2 value)
Parameters:
| Name | Type | Description |
|---|---|---|
value |
ref Strawberry.Math.Vector2 |
The Value. |
Rotate
Rotate the control points by the defined value in radians.
void Rotate(float value)
Parameters:
| Name | Type | Description |
|---|---|---|
value |
System.Single |
The amount to rotate by in radians. |
ToString override
string ToString()
GetVertices
Returns a set of points defining the curve with the specifed number of divisions between each control point.
Vertices GetVertices(int divisions)
Parameters:
| Name | Type | Description |
|---|---|---|
divisions |
System.Int32 |
Number of divisions between each control point. |
GetPosition
Vector2 GetPosition(float time)
Parameters:
| Name | Type | Description |
|---|---|---|
time |
System.Single |
GetPositionNormal
Gets the normal for the given time.
Vector2 GetPositionNormal(float time)
Parameters:
| Name | Type | Description |
|---|---|---|
time |
System.Single |
The time |
Returns: The normal.
Add
void Add(Vector2 point)
Parameters:
| Name | Type | Description |
|---|---|---|
point |
Strawberry.Math.Vector2 |
Remove
void Remove(Vector2 point)
Parameters:
| Name | Type | Description |
|---|---|---|
point |
Strawberry.Math.Vector2 |
RemoveAt
void RemoveAt(int index)
Parameters:
| Name | Type | Description |
|---|---|---|
index |
System.Int32 |
GetLength
float GetLength()
SubdivideEvenly
List<Vector3> SubdivideEvenly(int divisions)
Parameters:
| Name | Type | Description |
|---|---|---|
divisions |
System.Int32 |