Constructors
BezierF
#Create a new bezier segment from four control point coordinates.
BezierF
#public BezierF(PointF p0, PointF p1, PointF p2, PointF p3)
Create a new segment from the four control points.
Parameters:
| p0 (PointF) | First point. |
| p1 (PointF) | Second point. |
| p2 (PointF) | Third point. |
| p3 (PointF) | Fourth point. |
BezierF
#public BezierF(PointF p0, PointF p1, PointF p2)
Create a new segment which exactly matches a degree=2, 3-point bezier curve.
Parameters:
| p0 (PointF) | First point. |
| p1 (PointF) | Second point. |
| p2 (PointF) | Third point. |
Properties
Length
#Gets the length of this segment. The length is computed to a tolerance of 1e-4, so if you need a more accurate length, you need to scale the curve up first, then divide the resulting length by your scaling factor.
P0
#public PointF P0 { get; }
Gets the first control point of the bezier. This is synonymous with the start of the segment.
P3
#public PointF P3 { get; }
Gets the fourth (and final) control-point of the bezier. This is synonymous with the end of the segment.
Methods
AlignedForm
#Compute the axis aligned bezier segment. This involves moving P0 to (0,0) and rotating the entire segment until the y-coordinate of P3 equals zero.
Returns: Axis aligned bezier.
CanonicalForm
#Compute the canonical bezier form. The canonical form consists of a linear transformation such that P0 ends up at (0,0), P1 ends up at (0,1) and P2 ends up at (1,1). The exact location of P3 can then be used to infer certain properties of the original bezier segment, such as intersections, cusps and inflection count.
Returns: Canonical form.
Distance
#Gets the distance from this bezier to a point.
Parameters:
| point (PointF) | Point. |
Returns: Distance.
DistanceFromStart
#Find the parameter on the curve with a certain Euclidean distance from the start.
Parameters:
| distance (float) |
Extremes
#Solve all parameters along the segment where the x and y coordinates are local extremes.
Inflections
#Compute the inflection parameters for this curve.
Returns: An array of either zero, one or two inflection parameters.
ParameterAtLength
#Gets the bezier parameter at the arc-length. This is approximate.
Parameters:
| length (float) |
PointAt
#Evaluate the point at a given parameter.
Parameters:
| t (float) | Parameter. |
Returns: Point at parameter.
Project
#Find the parameter on the finite segment closest to the given point.
Parameters:
| point (PointF) | Search locus. |
Returns: Parameter on bezier domain.
Split
#Split this curve into two subcurves.
TangentAt
#Evaluate the (non-unitised) tangent at a given parameter.
Parameters:
| t (float) | Parameter. |
Returns: Tangent at parameter.
ToPolyline
#Convert this bezier to an array of points. Regardless of maxError, there will always be points at extremes and inflection points.
Parameters:
| maxError (float) | Maximum deviation between polyline segments and bezier spline. |
Returns: Point array.
Translate
#Move this bezier.