Table of Contents

Struct CubicBezier3

Namespace
Xui.Core.Curves3D
Assembly
Xui.Core.dll

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

p0 Point3
p1 Point3
p2 Point3
p3 Point3

Fields

P0

The starting point of the curve.

public readonly Point3 P0

Field Value

Point3

P1

The first control point, influencing the curve near P0.

public readonly Point3 P1

Field Value

Point3

P2

The second control point, influencing the curve near P3.

public readonly Point3 P2

Field Value

Point3

P3

The ending point of the curve.

public readonly Point3 P3

Field Value

Point3

Properties

this[float]

Evaluates the curve at the given parameter t. Alias for Lerp(float).

public Point3 this[float t] { get; }

Parameters

t float

Property Value

Point3

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

QuadraticBezier3

Methods

Length()

Approximates the arc length using 16 uniform samples.

public float Length()

Returns

float

Length(float)

Approximates the arc length using adaptive subdivision until the error per segment is within precision.

public float Length(float precision)

Parameters

precision float

Returns

float

Lerp(float)

Evaluates the curve at parameter t using De Casteljau's algorithm.

public Point3 Lerp(float t)

Parameters

t float

A normalized parameter in the range [0, 1].

Returns

Point3

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

t float

The split parameter in the range (0, 1).

Returns

(CubicBezier3 left, CubicBezier3 right)

Tangent(float)

Returns the tangent vector of the curve at parameter t.

public Vector3 Tangent(float t)

Parameters

t float

A normalized parameter in the range [0, 1].

Returns

Vector3

ToString()

Returns the fully qualified type name of this instance.

public override string ToString()

Returns

string

The fully qualified type name.