Xui.Core.Curves3D
Assembly: Xui.Core · C# declarations · Assembly overview
Types
class Bezier3readonly struct CubicBezier3interface ICurve3readonly struct LinearBezier3readonly struct QuadraticBezier3
class Bezier3
Provides factory methods for constructing 3D Bézier curves.
public static class Bezier3
{
public static LinearBezier3 Linear(Point3 p0, Point3 p1);
public static QuadraticBezier3 Quadratic(Point3 p0, Point3 p1, Point3 p2);
public static CubicBezier3 Cubic(Point3 p0, Point3 p1, Point3 p2, Point3 p3);
}
CubicBezier3 Bezier3.Cubic(Point3 p0, Point3 p1, Point3 p2, Point3 p3)
public static CubicBezier3 Cubic(Point3 p0, Point3 p1, Point3 p2, Point3 p3);
Creates a cubic (degree-3) Bézier curve with two control points.
p0— The start point.p1— The first control point.p2— The second control point.p3— The end point.
LinearBezier3 Bezier3.Linear(Point3 p0, Point3 p1)
public static LinearBezier3 Linear(Point3 p0, Point3 p1);
Creates a linear (degree-1) Bézier curve — a straight line from p0 to p1.
QuadraticBezier3 Bezier3.Quadratic(Point3 p0, Point3 p1, Point3 p2)
public static QuadraticBezier3 Quadratic(Point3 p0, Point3 p1, Point3 p2);
Creates a quadratic (degree-2) Bézier curve with one control point.
p0— The start point.p1— The control point.p2— The end point.
readonly 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.
A cubic Bézier provides smooth interpolation from Xui.Core.Curves3D.CubicBezier3.P0 to Xui.Core.Curves3D.CubicBezier3.P3, shaped by the two interior control points Xui.Core.Curves3D.CubicBezier3.P1 and Xui.Core.Curves3D.CubicBezier3.P2. Points are computed using De Casteljau's algorithm for numerical stability. This is the standard curve type for 3D animation paths and splines.
public readonly struct CubicBezier3 : ICurve3
{
public readonly Point3 P0;
public readonly Point3 P1;
public readonly Point3 P2;
public readonly Point3 P3;
public CubicBezier3(Point3 p0, Point3 p1, Point3 p2, Point3 p3);
public Point3 Lerp(float t);
public Vector3 Tangent(float t);
public Point3 this[float t] { get; }
public float Length();
public float Length(float precision);
public (CubicBezier3 left, CubicBezier3 right) Subdivide(float t);
public QuadraticBezier3 QuadraticApproximation { get; }
public override string ToString();
}
CubicBezier3.CubicBezier3(Point3 p0, Point3 p1, Point3 p2, Point3 p3)
public CubicBezier3(Point3 p0, Point3 p1, Point3 p2, Point3 p3);
Initializes a new Xui.Core.Curves3D.CubicBezier3 with the specified control points.
Point3 CubicBezier3.this[float t]
public Point3 this[float t] { get; }
Evaluates the curve at the given parameter t. Alias for Xui.Core.Curves3D.ICurve3.Lerp(System.Single).
float CubicBezier3.Length()
public float Length();
Approximates the arc length using 16 uniform samples.
float CubicBezier3.Length(float precision)
public float Length(float precision);
Approximates the arc length using adaptive subdivision until the error per segment is within precision.
Point3 CubicBezier3.Lerp(float t)
public Point3 Lerp(float t);
Evaluates the curve at parameter t using De Casteljau's algorithm.
t— A normalized parameter in the range [0, 1].
Point3 CubicBezier3.P0
public readonly Point3 P0;
The starting point of the curve.
Point3 CubicBezier3.P1
public readonly Point3 P1;
The first control point, influencing the curve near Xui.Core.Curves3D.CubicBezier3.P0.
Point3 CubicBezier3.P2
public readonly Point3 P2;
The second control point, influencing the curve near Xui.Core.Curves3D.CubicBezier3.P3.
Point3 CubicBezier3.P3
public readonly Point3 P3;
The ending point of the curve.
QuadraticBezier3 CubicBezier3.QuadraticApproximation
public QuadraticBezier3 QuadraticApproximation { get; }
Returns a quadratic Bézier that approximates this cubic by averaging the endpoint tangents. Suitable as a fast approximation when subdivision is not required.
(CubicBezier3 left, CubicBezier3 right) CubicBezier3.Subdivide(float t)
public (CubicBezier3 left, CubicBezier3 right) Subdivide(float t);
Subdivides this curve at parameter t using De Casteljau's algorithm, returning the left and right sub-curves.
t— The split parameter in the range (0, 1).
Vector3 CubicBezier3.Tangent(float t)
public Vector3 Tangent(float t);
Returns the tangent vector of the curve at parameter t.
t— A normalized parameter in the range [0, 1].
string CubicBezier3.ToString()
public override string ToString();
Returns the fully qualified type name of this instance.
Returns: The fully qualified type name.
interface ICurve3
Defines a parametric curve in 3D space.
The parameter t ranges from 0 to 1, where 0 is the start and 1 is the end of the curve.
public interface ICurve3
{
Point3 Lerp(float t);
Vector3 Tangent(float t);
Point3 this[float t] { get; }
float Length();
float Length(float precision);
}
Point3 ICurve3.this[float t]
Point3 this[float t] { get; }
Evaluates the curve at the given parameter t. Alias for Xui.Core.Curves3D.ICurve3.Lerp(System.Single).
float ICurve3.Length()
float Length();
Approximates the arc length of the curve using 16 uniform samples.
float ICurve3.Length(float precision)
float Length(float precision);
Approximates the arc length of the curve using adaptive subdivision until the error is within precision.
precision— The maximum allowed error per segment.
Point3 ICurve3.Lerp(float t)
Point3 Lerp(float t);
Evaluates the curve at the given parameter t and returns the corresponding point in 3D space.
t— A normalized parameter in the range [0, 1].
Vector3 ICurve3.Tangent(float t)
Vector3 Tangent(float t);
Returns the tangent (first derivative) vector of the curve at parameter t.
t— A normalized parameter in the range [0, 1].
readonly struct LinearBezier3
Represents a linear (degree-1) Bézier curve in 3D space — a straight line segment from Xui.Core.Curves3D.LinearBezier3.P0 to Xui.Core.Curves3D.LinearBezier3.P1.
public readonly struct LinearBezier3 : ICurve3
{
public readonly Point3 P0;
public readonly Point3 P1;
public LinearBezier3(Point3 p0, Point3 p1);
public Point3 Lerp(float t);
public Vector3 Tangent(float t);
public Point3 this[float t] { get; }
public float Length();
public float Length(float precision);
public QuadraticBezier3 ToQuadratic();
public CubicBezier3 ToCubic();
public override string ToString();
}
LinearBezier3.LinearBezier3(Point3 p0, Point3 p1)
public LinearBezier3(Point3 p0, Point3 p1);
Initializes a new Xui.Core.Curves3D.LinearBezier3 with the specified endpoints.
Point3 LinearBezier3.this[float t]
public Point3 this[float t] { get; }
Evaluates the curve at the given parameter t. Alias for Xui.Core.Curves3D.ICurve3.Lerp(System.Single).
float LinearBezier3.Length()
public float Length();
Returns the length of the segment (the Euclidean distance from Xui.Core.Curves3D.LinearBezier3.P0 to Xui.Core.Curves3D.LinearBezier3.P1).
float LinearBezier3.Length(float precision)
public float Length(float precision);
Returns the length of the segment. The precision parameter is ignored for linear segments.
Point3 LinearBezier3.Lerp(float t)
public Point3 Lerp(float t);
Evaluates the segment at parameter t.
t— A normalized parameter in the range [0, 1].
Point3 LinearBezier3.P0
public readonly Point3 P0;
The starting point of the segment.
Point3 LinearBezier3.P1
public readonly Point3 P1;
The ending point of the segment.
Vector3 LinearBezier3.Tangent(float t)
public Vector3 Tangent(float t);
Returns the constant tangent (direction) of the segment.
t— Ignored — the tangent is constant for a linear segment.
CubicBezier3 LinearBezier3.ToCubic()
public CubicBezier3 ToCubic();
Converts this linear segment to a Xui.Core.Curves3D.CubicBezier3 with collinear controls.
QuadraticBezier3 LinearBezier3.ToQuadratic()
public QuadraticBezier3 ToQuadratic();
Converts this linear segment to a Xui.Core.Curves3D.QuadraticBezier3 with a midpoint control.
string LinearBezier3.ToString()
public override string ToString();
Returns the fully qualified type name of this instance.
Returns: The fully qualified type name.
readonly struct QuadraticBezier3
Represents a quadratic (degree-2) Bézier curve in 3D space, defined by a start point, one control point, and an end point.
A quadratic Bézier provides smooth interpolation from Xui.Core.Curves3D.QuadraticBezier3.P0 to Xui.Core.Curves3D.QuadraticBezier3.P2, pulled toward the control point Xui.Core.Curves3D.QuadraticBezier3.P1. Points are computed using De Casteljau's algorithm for numerical stability.
public readonly struct QuadraticBezier3 : ICurve3
{
public readonly Point3 P0;
public readonly Point3 P1;
public readonly Point3 P2;
public QuadraticBezier3(Point3 p0, Point3 p1, Point3 p2);
public Point3 Lerp(float t);
public Vector3 Tangent(float t);
public Point3 this[float t] { get; }
public float Length();
public float Length(float precision);
public (QuadraticBezier3 left, QuadraticBezier3 right) Subdivide(float t);
public CubicBezier3 ToCubic();
public override string ToString();
}
QuadraticBezier3.QuadraticBezier3(Point3 p0, Point3 p1, Point3 p2)
public QuadraticBezier3(Point3 p0, Point3 p1, Point3 p2);
Initializes a new Xui.Core.Curves3D.QuadraticBezier3 with the specified control points.
Point3 QuadraticBezier3.this[float t]
public Point3 this[float t] { get; }
Evaluates the curve at the given parameter t. Alias for Xui.Core.Curves3D.ICurve3.Lerp(System.Single).
float QuadraticBezier3.Length()
public float Length();
Approximates the arc length using 16 uniform samples.
float QuadraticBezier3.Length(float precision)
public float Length(float precision);
Approximates the arc length using adaptive subdivision until the error per segment is within precision.
Point3 QuadraticBezier3.Lerp(float t)
public Point3 Lerp(float t);
Evaluates the curve at parameter t using De Casteljau's algorithm.
t— A normalized parameter in the range [0, 1].
Point3 QuadraticBezier3.P0
public readonly Point3 P0;
The starting point of the curve.
Point3 QuadraticBezier3.P1
public readonly Point3 P1;
The control point, which influences the curvature.
Point3 QuadraticBezier3.P2
public readonly Point3 P2;
The ending point of the curve.
(QuadraticBezier3 left, QuadraticBezier3 right) QuadraticBezier3.Subdivide(float t)
public (QuadraticBezier3 left, QuadraticBezier3 right) Subdivide(float t);
Subdivides this curve at parameter t using De Casteljau's algorithm, returning the left and right sub-curves.
t— The split parameter in the range (0, 1).
Vector3 QuadraticBezier3.Tangent(float t)
public Vector3 Tangent(float t);
Returns the tangent vector of the curve at parameter t.
t— A normalized parameter in the range [0, 1].
CubicBezier3 QuadraticBezier3.ToCubic()
public CubicBezier3 ToCubic();
Elevates this quadratic curve to an equivalent Xui.Core.Curves3D.CubicBezier3.
string QuadraticBezier3.ToString()
public override string ToString();
Returns the fully qualified type name of this instance.
Returns: The fully qualified type name.