BezierF

References
public readonly struct BezierF
Represents a single unweighted, four point bezier span.

Constructors

BezierF

#
Create a new bezier segment from four control point coordinates.
public BezierF(
x0,
X of first control point.
y0,
Y of first control point.
x1,
X of second control point.
y1,
Y of second control point.
x2,
X of third control point.
y2,
Y of third control point.
x3,
X of fourth control point.
y3
Y of fourth control point.
)

BezierF

#
Create a new segment from the four control points.
public BezierF(
PointF
p0,
First point.
PointF
p1,
Second point.
PointF
p2,
Third point.
PointF
p3
Fourth point.
)

BezierF

#
Create a new segment which exactly matches a degree=2, 3-point bezier curve.
public BezierF(
PointF
p0,
First point.
PointF
p1,
Second point.
PointF
p2
Third point.
)

Properties

Bounds

#
Gets the boundingbox of this segment.
public RectangleF Bounds { get; }

Classification

#
Gets the classification of the bezier type based on its canonical form.
public BezierShapeClassification Classification { get; }

IsClosed

#
Gets whether this curve is closed.
public bool IsClosed { get; }

IsEmpty

#
Geta whether this bezier segment is empty.
public bool IsEmpty { get; }

IsValid

#
Gets whether all the coordinates are valid numbers.
public bool IsValid { get; }

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.
public float Length { get; }

P0

#
Gets the first control point of the bezier. This is synonymous with the start of the segment.
public PointF P0 { get; }

P1

#
Gets the second control point of the bezier.
public PointF P1 { get; }

P2

#
Gets the third control-point of the bezier.
public PointF P2 { get; }

P3

#
Gets the fourth (and final) control-point of the bezier. This is synonymous with the end of the segment.
public PointF P3 { get; }

T0

#
Gets the normalised tangent at the start of the segment.
public SizeF T0 { get; }

T3

#
Gets the normalised tangent at the end of the segment.
public SizeF T3 { get; }

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.
[EditorBrowsable(EditorBrowsableState.Never)] public BezierF AlignedForm()
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.
[EditorBrowsable(EditorBrowsableState.Never)] public BezierF CanonicalForm()
Canonical form.

Distance

#
Gets the distance from this bezier to a point.
public float Distance(
PointF
point
Point.
)
Distance.

DistanceFromStart

#
Find the parameter on the curve with a certain Euclidean distance from the start.
public float DistanceFromStart(
distance
)

Extremes

#
Solve all parameters along the segment where the x and y coordinates are local extremes.
public void Extremes(
out float[]
x,
Array of parameters for x-extremes.
out float[]
y
Array of parameters for y-extremes.
)

Inflections

#
Compute the inflection parameters for this curve.
public float[] Inflections()
An array of either zero, one or two inflection parameters.

ParameterAtLength

#
Gets the bezier parameter at the arc-length. This is approximate.
public float ParameterAtLength(
length
)

PointAt

#
Evaluate the point at a given parameter.
public PointF PointAt(
t
Parameter.
)
Point at parameter.

Project

#
Find the parameter on the finite segment closest to the given point.
public float Project(
PointF
point
Search locus.
)
Parameter on bezier domain.

Reverse

#
Create a reversed bezier segment.
public BezierF Reverse()

Split

#
Split this curve into two subcurves.
public void Split(
t,
Splitting parameter, must be in the [0,1] range.
out BezierF
left,
Part of bezier on the subdomain [0, t].
out BezierF
right
Part of bezier o the subdomain [t, 1].
)

TangentAt

#
Evaluate the (non-unitised) tangent at a given parameter.
public SizeF TangentAt(
t
Parameter.
)
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.
public PointF[] ToPolyline(
maxError
Maximum deviation between polyline segments and bezier spline.
)
Point array.

Translate

#
Move this bezier.
public BezierF Translate(
dx,
Horizontal displacement.
dy
Vertical displacement.
)
Moved bezier.

Trim

#
Trim part of this bezier.
public BezierF Trim(
t0,
First trimming parameter.
t1
Second trimming parameter.
)
Bezier segment in between trimming parameters.