Bezier |
public class BezierCurve
The BezierCurve type exposes the following members.
Name | Description | |
---|---|---|
BezierCurve | Creates Bezier curve with the specified control points list. Note that each curve segment requires 3 control points (one for the position on the curve and two to define tangents to that position). |
Name | Description | |
---|---|---|
ControlPoints | Gets a list of control points. |
Name | Description | |
---|---|---|
CreateBezierCurve(Int32) | Returns a Point3DCollection that defines the Bezier curve. | |
CreateBezierCurve(IListPoint3D, Int32) | Returns a Point3DCollection that defines the Bezier curve with the specified controlPoints (contains points on the curve and tangent control points). | |
CreateBezierCurveThroughPoints(IListPoint3D, Int32) | Returns a Point3DCollection that defines the Bezier curve that goes through curvePositions. | |
CreateBezierCurveThroughPoints(IListPoint3D, Double, Int32) | Returns a Point3DCollection that defines the Bezier curve that goes through curvePositions. | |
CreateFromCurvePositions(IListPoint3D) | Returns an instance of BezierCurve that is created by the curvePositions. The method calculates all the control points (tangent positions) based on the default curve scale. | |
CreateFromCurvePositions(IListPoint3D, Double) | Returns an instance of BezierCurve that is created by the curvePositions. The method calculates all the control points (tangent positions) based on the curveScale. | |
GetPositionOnCurve | Returns a Point3D that lies on the Bezier curve. The t argument can have any value from 0 to 1; 0 meaning the first control point and 1 meaning the last control point. |
Name | Description | |
---|---|---|
DEFAULT_CURVE_SCALE | Default curve scale |
Bezier curves is a curve that goes through specified points and where the curvature at the specified points is defined by tangent points that define tangents to the specified points.
The specified points (the points the curve will go though) and tangent points are define in a single control points list (IList<Point3D>).
The structure of the control points is the following:
control point index = 0: start position of the curve
control point index = 1: point that define tangent from the curve start position to the next position
control point index = 2: point that define tangent from the previous position to this position
control point index = 3: the second position on the curve
control point index = 4: point that define tangent from this position to the next position
... (3 control points for other positions - 2 for tangents and one for curve position)
control point index = n - 2: point that define tangent from the previous position to the last position
control point index = n - 1: the last position on the curve
It is possible to define the Bezier curves with specifying all the control points. But because it could be quite hard to define all the tangent control points, it is also possible to define the Bezier curve by just specifying the curve positions and defining the curve scale that define how far from the curve positions the tangent control points are defined. This way the curve scale defines the curvature of the curve.
The BezierCurve instance can be created by specifying all the control points in the BezierCurve constructor. It is also possible to create the BezierCurve instance by calling the static CreateFromCurvePositions(IListPoint3D) or CreateFromCurvePositions(IListPoint3D, Double) method.
To make the curve smooth, more points are created between two control points. The number of additional points is defined by positionsPerSegment number.
The easiest way to create the curve is to use the static CreateBezierCurve(IListPoint3D, Int32) or CreateBezierCurveThroughPoints(IListPoint3D, Int32) methods. Both methods return Point3DCollection that define the curve.
For advanced usage it is possible to create an instance of the BSpline class. This enables calling GetPositionOnCurve(Double) method than can return any position on the curve defined by the t parameter. The t parameter can have any value from 0 to 1; 0 meaning the first control point and 1 meaning the last control point.
NOTE: To create a B-spline or NURBS curve use the BSpline class.