Struct CubicBezier3
Represents a cubic (degree-3) Bézier curve in 3D space, defined by a start point, two control points, and an end point.
public readonly struct CubicBezier3 : ICurve3
- Implements
- Inherited Members
Remarks
A cubic Bézier provides smooth interpolation from P0 to P3, shaped by the two interior control points P1 and P2. Points are computed using De Casteljau's algorithm for numerical stability. This is the standard curve type for 3D animation paths and splines.
Constructors
CubicBezier3(Point3, Point3, Point3, Point3)
Initializes a new CubicBezier3 with the specified control points.
public CubicBezier3(Point3 p0, Point3 p1, Point3 p2, Point3 p3)
Parameters
Fields
P0
The starting point of the curve.
public readonly Point3 P0
Field Value
P1
The first control point, influencing the curve near P0.
public readonly Point3 P1
Field Value
P2
The second control point, influencing the curve near P3.
public readonly Point3 P2
Field Value
P3
The ending point of the curve.
public readonly Point3 P3
Field Value
Properties
this[float]
Evaluates the curve at the given parameter t.
Alias for Lerp(float).
public Point3 this[float t] { get; }
Parameters
tfloat
Property Value
QuadraticApproximation
Returns a quadratic Bézier that approximates this cubic by averaging the endpoint tangents. Suitable as a fast approximation when subdivision is not required.
public QuadraticBezier3 QuadraticApproximation { get; }
Property Value
Methods
Length()
Approximates the arc length using 16 uniform samples.
public float Length()
Returns
Length(float)
Approximates the arc length using adaptive subdivision until the error per
segment is within precision.
public float Length(float precision)
Parameters
precisionfloat
Returns
Lerp(float)
Evaluates the curve at parameter t using De Casteljau's algorithm.
public Point3 Lerp(float t)
Parameters
tfloatA normalized parameter in the range [0, 1].
Returns
Subdivide(float)
Subdivides this curve at parameter t using De Casteljau's algorithm,
returning the left and right sub-curves.
public (CubicBezier3 left, CubicBezier3 right) Subdivide(float t)
Parameters
tfloatThe split parameter in the range (0, 1).
Returns
Tangent(float)
Returns the tangent vector of the curve at parameter t.
public Vector3 Tangent(float t)
Parameters
tfloatA normalized parameter in the range [0, 1].
Returns
ToString()
Returns the fully qualified type name of this instance.
public override string ToString()
Returns
- string
The fully qualified type name.