Class Path
- Namespace
- Alis.Core.Physic.Common
- Assembly
- Alis.dll
Path: Very similar to Vertices, but this class contains vectors describing control points on a Catmull-Rom curve.
public class Path
Inheritance
Inherited Members
Constructors
Path()
Initializes a new instance of the Alis.Core.Physic.Common.Path class.
public Path()
Path(Vector2[])
Initializes a new instance of the Alis.Core.Physic.Common.Path class.
public Path(Vector2[] vertices)
Parameters
vertices
Vector2[]-
The vertices to created the path from.
Path(IList<Vector2>)
Initializes a new instance of the Alis.Core.Physic.Common.Path class.
public Path(IList<Vector2> vertices)
Parameters
Fields
ControlPoints
All the points that makes up the curve
public List<Vector2> ControlPoints
Field Value
_deltaT
The delta
private float _deltaT
Field Value
Properties
Closed
True if the curve is closed.
public bool Closed { get; set; }
Property Value
Methods
Add(Vector2)
Adds the point
public void Add(Vector2 point)
Parameters
point
Vector2-
The point
CalcCatmullRom(Vector2, Vector2, Vector2, Vector2, float, out Vector2)
Calcs the catmull rom using the specified p 0
private void CalcCatmullRom(Vector2 p0, Vector2 p1, Vector2 p2, Vector2 p3, float amount, out Vector2 result)
Parameters
p0
Vector2-
The
p1
Vector2-
The
p2
Vector2-
The
p3
Vector2-
The
amount
float-
The amount
result
Vector2-
The result
GetLength()
Gets the length
public float GetLength()
Returns
- float
-
The length
GetPosition(float)
Gets the position using the specified time
public Vector2 GetPosition(float time)
Parameters
time
float-
The time
Returns
- Vector2
-
The temp
Exceptions
- Exception
-
You need at least 2 control points to calculate a position.
GetPositionNormal(float)
Gets the normal for the given time.
public Vector2 GetPositionNormal(float time)
Parameters
time
float-
The time
Returns
- Vector2
-
The normal.
GetVertices(int)
Returns a set of points defining the curve with the specifed number of divisions between each control point.
public Vertices GetVertices(int divisions)
Parameters
divisions
int-
Number of divisions between each control point.
Returns
NextIndex(int)
Gets the next index of a controlpoint
public int NextIndex(int index)
Parameters
index
int-
The index.
Returns
PreviousIndex(int)
Gets the previous index of a controlpoint
public int PreviousIndex(int index)
Parameters
index
int-
The index.
Returns
Remove(Vector2)
Removes the point
public void Remove(Vector2 point)
Parameters
point
Vector2-
The point
RemoveAt(int)
Removes the at using the specified index
public void RemoveAt(int index)
Parameters
index
int-
The index
Rotate(float)
Rotate the control points by the defined value in radians.
public void Rotate(float value)
Parameters
value
float-
The amount to rotate by in radians.
Scale(ref Vector2)
Scales the control points by the specified vector.
public void Scale(ref Vector2 value)
Parameters
value
Vector2-
The Value.
SubdivideEvenly(int)
Subdivides the evenly using the specified divisions
public List<Vector3> SubdivideEvenly(int divisions)
Parameters
divisions
int-
The divisions
Returns
ToString()
Returns the string
public override string ToString()
Returns
- string
-
The string
Translate(ref Vector2)
Translates the control points by the specified vector.
public void Translate(ref Vector2 vector)
Parameters
vector
Vector2-
The vector.