Struct LinearBezier
Represents a linear Bézier curve, equivalent to a straight line between two points.
public readonly struct LinearBezier : ICurve
- Implements
- Inherited Members
Remarks
This is the simplest form of Bézier curve, defined by two points P0 and P1. It is often used for edges of polygonal paths or degenerate forms of higher-order Béziers.
Constructors
LinearBezier(Point, Point)
Initializes a new LinearBezier curve with the given start and end points.
public LinearBezier(Point p0, Point p1)
Parameters
Fields
P0
The start point of the curve.
public readonly Point P0
Field Value
P1
The end point of the curve.
public readonly Point P1
Field Value
Properties
this[NFloat]
Indexer-style access to the interpolated point at parameter t
.
public Point this[NFloat t] { get; }
Parameters
t
NFloat
Property Value
Methods
Length()
Returns the exact length of the line segment.
public NFloat Length()
Returns
Length(NFloat)
Returns the length of the line segment. This overload ignores the precision
parameter.
public NFloat Length(NFloat precision)
Parameters
precision
NFloat
Returns
Lerp(NFloat)
Computes the point on the line at parameter t
using linear interpolation.
public Point Lerp(NFloat t)
Parameters
t
NFloatA normalized parameter in the range [0, 1].
Returns
Tangent(NFloat)
Returns the constant tangent vector of the line segment.
public Vector Tangent(NFloat t)
Parameters
t
NFloatThe curve parameter (ignored since the tangent is constant).
Returns
Operators
implicit operator LinearBezier((Point p0, Point p1))
Implicitly converts a tuple of two points into a LinearBezier.
public static implicit operator LinearBezier((Point p0, Point p1) value)
Parameters
Returns
implicit operator CubicBezier(LinearBezier)
Implicitly converts this LinearBezier to a CubicBezier curve. Intermediate control points are interpolated at 1/3 and 2/3 for smooth spacing.
public static implicit operator CubicBezier(LinearBezier linear)
Parameters
linear
LinearBezier
Returns
implicit operator QuadraticBezier(LinearBezier)
Implicitly converts this LinearBezier to a QuadraticBezier curve. The intermediate point is set to the midpoint for visual smoothness.
public static implicit operator QuadraticBezier(LinearBezier linear)
Parameters
linear
LinearBezier
Returns
implicit operator LinearBezier(LinearSpline)
Implicitly converts a LinearSpline to a LinearBezier.
public static implicit operator LinearBezier(LinearSpline spline)
Parameters
spline
LinearSpline