Struct BezierCurve
Represents a bezier curve with as many points as you want.
Inherited Members
Namespace: OpenTK.Mathematics
Assembly: OpenTK.Mathematics.dll
Syntax
[Serializable]
public struct BezierCurve
Constructors
BezierCurve(params Vector2[])
Initializes a new instance of the BezierCurve struct.
Declaration
public BezierCurve(params Vector2[] points)
Parameters
Type | Name | Description |
---|---|---|
Vector2[] | points | The points. |
BezierCurve(IEnumerable<Vector2>)
Initializes a new instance of the BezierCurve struct.
Declaration
public BezierCurve(IEnumerable<Vector2> points)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<Vector2> | points | The points. |
BezierCurve(float, params Vector2[])
Initializes a new instance of the BezierCurve struct.
Declaration
public BezierCurve(float parallel, params Vector2[] points)
Parameters
Type | Name | Description |
---|---|---|
float | parallel | The parallel value. |
Vector2[] | points | The points. |
BezierCurve(float, IEnumerable<Vector2>)
Initializes a new instance of the BezierCurve struct.
Declaration
public BezierCurve(float parallel, IEnumerable<Vector2> points)
Parameters
Type | Name | Description |
---|---|---|
float | parallel | The parallel value. |
IEnumerable<Vector2> | points | The points. |
Fields
Parallel
The parallel value.
Declaration
public float Parallel
Field Value
Type | Description |
---|---|
float |
Remarks
This value defines whether the curve should be calculated as a parallel curve to the original bezier curve. A value of 0.0f represents the original curve, 5.0f i.e. stands for a curve that has always a distance of 5.0f to the orignal curve at any point.
Properties
Points
Gets the points of this curve.
Declaration
public IList<Vector2> Points { get; }
Property Value
Type | Description |
---|---|
IList<Vector2> |
Remarks
The first point and the last points represent the anchor points.
Methods
CalculateLength(IList<Vector2>, float, float)
Calculates the length of the specified bezier curve.
Declaration
[Pure]
public static float CalculateLength(IList<Vector2> points, float precision, float parallel)
Parameters
Type | Name | Description |
---|---|---|
IList<Vector2> | points | The points. |
float | precision | The precision value. |
float | parallel | The parallel value. |
Returns
Type | Description |
---|---|
float | Length of curve. |
Remarks
The precision gets better as the precision
value gets smaller.
The parallel
parameter defines whether the curve should be calculated as a
parallel curve to the original bezier curve. A value of 0.0f represents
the original curve, 5.0f represents a curve that has always a distance
of 5.0f to the orignal curve.
CalculateLength(IList<Vector2>, float)
Calculates the length of the specified bezier curve.
Declaration
[Pure]
public static float CalculateLength(IList<Vector2> points, float precision)
Parameters
Type | Name | Description |
---|---|---|
IList<Vector2> | points | The points. |
float | precision | The precision value. |
Returns
Type | Description |
---|---|
float | The precision gets better as the |
CalculateLength(float)
Calculates the length of this bezier curve.
Declaration
[Pure]
public float CalculateLength(float precision)
Parameters
Type | Name | Description |
---|---|---|
float | precision | The precision. |
Returns
Type | Description |
---|---|
float | Length of curve. |
Remarks
The precision gets better as the precision
value gets smaller.
CalculatePoint(IList<Vector2>, float, float)
Calculates the point on the given bezier curve with the specified t parameter.
Declaration
[Pure]
public static Vector2 CalculatePoint(IList<Vector2> points, float t, float parallel)
Parameters
Type | Name | Description |
---|---|---|
IList<Vector2> | points | The points. |
float | t | The t parameter, a value between 0.0f and 1.0f. |
float | parallel | The parallel value. |
Returns
Type | Description |
---|---|
Vector2 | Resulting point. |
Remarks
The parallel
parameter defines whether the curve should be calculated as a
parallel curve to the original bezier curve. A value of 0.0f represents
the original curve, 5.0f represents a curve that has always a distance
of 5.0f to the orignal curve.
CalculatePoint(IList<Vector2>, float)
Calculates the point on the given bezier curve with the specified t parameter.
Declaration
[Pure]
public static Vector2 CalculatePoint(IList<Vector2> points, float t)
Parameters
Type | Name | Description |
---|---|---|
IList<Vector2> | points | The points. |
float | t | The t parameter, a value between 0.0f and 1.0f. |
Returns
Type | Description |
---|---|
Vector2 | Resulting point. |
CalculatePoint(float)
Calculates the point with the specified t.
Declaration
[Pure]
public Vector2 CalculatePoint(float t)
Parameters
Type | Name | Description |
---|---|---|
float | t | The t value, between 0.0f and 1.0f. |
Returns
Type | Description |
---|---|
Vector2 | Resulting point. |