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 PathInheritance
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
verticesVector2[]-
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> ControlPointsField Value
_deltaT
The delta
private float _deltaTField 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
pointVector2-
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
p0Vector2-
The
p1Vector2-
The
p2Vector2-
The
p3Vector2-
The
amountfloat-
The amount
resultVector2-
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
timefloat-
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
timefloat-
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
divisionsint-
Number of divisions between each control point.
Returns
NextIndex(int)
Gets the next index of a controlpoint
public int NextIndex(int index)Parameters
indexint-
The index.
Returns
PreviousIndex(int)
Gets the previous index of a controlpoint
public int PreviousIndex(int index)Parameters
indexint-
The index.
Returns
Remove(Vector2)
Removes the point
public void Remove(Vector2 point)Parameters
pointVector2-
The point
RemoveAt(int)
Removes the at using the specified index
public void RemoveAt(int index)Parameters
indexint-
The index
Rotate(float)
Rotate the control points by the defined value in radians.
public void Rotate(float value)Parameters
valuefloat-
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
valueVector2-
The Value.
SubdivideEvenly(int)
Subdivides the evenly using the specified divisions
public List<Vector3> SubdivideEvenly(int divisions)Parameters
divisionsint-
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
vectorVector2-
The vector.