Represents a quadric bezier curve with two anchor and one control point. More...
Public Member Functions | |
| BezierCurveQuadric (Vector2 startAnchor, Vector2 endAnchor, Vector2 controlPoint) | |
| Constructs a new BezierCurveQuadric. | |
| BezierCurveQuadric (float parallel, Vector2 startAnchor, Vector2 endAnchor, Vector2 controlPoint) | |
| Constructs a new BezierCurveQuadric. | |
| Vector2 | CalculatePoint (float t) |
| Calculates the point with the specified t. | |
| float | CalculateLength (float precision) |
| Calculates the length of this bezier curve. | |
Public Attributes | |
| Vector2 | StartAnchor |
| Start anchor point. | |
| Vector2 | EndAnchor |
| End anchor point. | |
| Vector2 | ControlPoint |
| Control point, controls the direction of both endings of the curve. | |
| float | Parallel |
| The parallel value. | |
Represents a quadric bezier curve with two anchor and one control point.
Definition at line 21 of file BezierCurveQuadric.cs.
| OpenTK.BezierCurveQuadric.BezierCurveQuadric | ( | Vector2 | startAnchor, | |
| Vector2 | endAnchor, | |||
| Vector2 | controlPoint | |||
| ) |
Constructs a new BezierCurveQuadric.
| startAnchor | The start anchor. | |
| endAnchor | The end anchor. | |
| controlPoint | The control point. |
Definition at line 59 of file BezierCurveQuadric.cs.
00060 { 00061 this.StartAnchor = startAnchor; 00062 this.EndAnchor = endAnchor; 00063 this.ControlPoint = controlPoint; 00064 this.Parallel = 0.0f; 00065 }
| OpenTK.BezierCurveQuadric.BezierCurveQuadric | ( | float | parallel, | |
| Vector2 | startAnchor, | |||
| Vector2 | endAnchor, | |||
| Vector2 | controlPoint | |||
| ) |
Constructs a new BezierCurveQuadric.
| parallel | The parallel value. | |
| startAnchor | The start anchor. | |
| endAnchor | The end anchor. | |
| controlPoint | The control point. |
Definition at line 74 of file BezierCurveQuadric.cs.
00075 { 00076 this.Parallel = parallel; 00077 this.StartAnchor = startAnchor; 00078 this.EndAnchor = endAnchor; 00079 this.ControlPoint = controlPoint; 00080 }
| float OpenTK.BezierCurveQuadric.CalculateLength | ( | float | precision | ) |
Calculates the length of this bezier curve.
| precision | The precision. |
The precision gets better when the precision value gets smaller.
Definition at line 134 of file BezierCurveQuadric.cs.
00135 { 00136 float length = 0.0f; 00137 Vector2 old = CalculatePoint(0.0f); 00138 00139 for (float i = precision; i < (1.0f + precision); i += precision) 00140 { 00141 Vector2 n = CalculatePoint(i); 00142 length += (n - old).Length; 00143 old = n; 00144 } 00145 00146 return length; 00147 }
| Vector2 OpenTK.BezierCurveQuadric.CalculatePoint | ( | float | t | ) |
Calculates the point with the specified t.
| t | The t value, between 0.0f and 1.0f. |
Definition at line 91 of file BezierCurveQuadric.cs.
00092 { 00093 Vector2 r = new Vector2(); 00094 float c = 1.0f - t; 00095 00096 r.X = (c * c * StartAnchor.X) + (2 * t * c * ControlPoint.X) + (t * t * EndAnchor.X); 00097 r.Y = (c * c * StartAnchor.Y) + (2 * t * c * ControlPoint.Y) + (t * t * EndAnchor.Y); 00098 00099 if (Parallel == 0.0f) 00100 return r; 00101 00102 Vector2 perpendicular = new Vector2(); 00103 00104 if (t == 0.0f) 00105 perpendicular = ControlPoint - StartAnchor; 00106 else 00107 perpendicular = r - CalculatePointOfDerivative(t); 00108 00109 return r + Vector2.Normalize(perpendicular).PerpendicularRight * Parallel; 00110 }
Control point, controls the direction of both endings of the curve.
Definition at line 38 of file BezierCurveQuadric.cs.
End anchor point.
Definition at line 33 of file BezierCurveQuadric.cs.
The parallel value.
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.f to the orignal curve at any point.
Definition at line 47 of file BezierCurveQuadric.cs.
Start anchor point.
Definition at line 28 of file BezierCurveQuadric.cs.
1.6.1