// Generated API outline. Implementation bodies omitted. #nullable enable using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Linq; using System.Net.Http; using System.Threading.Tasks; using System.Threading; using System; using nfloat = System.Runtime.InteropServices.NFloat; using static Xui.Core.Math2D.Constants; namespace Xui.Core.Curves3D { using Xui.Core.Math3D; /// /// Provides factory methods for constructing 3D Bézier curves. /// public static class Bezier3 { /// /// Creates a linear (degree-1) Bézier curve — a straight line from /// to . /// public static LinearBezier3 Linear(Point3 p0, Point3 p1); /// /// Creates a quadratic (degree-2) Bézier curve with one control point. /// /// The start point. /// The control point. /// The end point. public static QuadraticBezier3 Quadratic(Point3 p0, Point3 p1, Point3 p2); /// /// Creates a cubic (degree-3) Bézier curve with two control points. /// /// The start point. /// The first control point. /// The second control point. /// The end point. public static CubicBezier3 Cubic(Point3 p0, Point3 p1, Point3 p2, Point3 p3); } /// /// 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 to , /// shaped by the two interior control points and . /// 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 { /// The starting point of the curve. public readonly Point3 P0; /// The first control point, influencing the curve near . public readonly Point3 P1; /// The second control point, influencing the curve near . public readonly Point3 P2; /// The ending point of the curve. public readonly Point3 P3; /// /// Initializes a new with the specified control points. /// public CubicBezier3(Point3 p0, Point3 p1, Point3 p2, Point3 p3); /// /// Evaluates the curve at parameter using De Casteljau's algorithm. /// /// A normalized parameter in the range [0, 1]. public Point3 Lerp(float t); /// /// Returns the tangent vector of the curve at parameter . /// /// A normalized parameter in the range [0, 1]. public Vector3 Tangent(float t); /// /// Evaluates the curve at the given parameter . /// Alias for . /// public Point3 this[float t] { get; } /// /// Approximates the arc length using 16 uniform samples. /// public float Length(); /// /// Approximates the arc length using adaptive subdivision until the error per /// segment is within . /// public float Length(float precision); /// /// Subdivides this curve at parameter using De Casteljau's algorithm, /// returning the left and right sub-curves. /// /// The split parameter in the range (0, 1). public (CubicBezier3 left, CubicBezier3 right) Subdivide(float t); /// /// 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; } /// Returns the fully qualified type name of this instance. /// The fully qualified type name. public override string ToString(); } /// /// 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 { /// /// Evaluates the curve at the given parameter and returns the /// corresponding point in 3D space. /// /// A normalized parameter in the range [0, 1]. Point3 Lerp(float t); /// /// Returns the tangent (first derivative) vector of the curve at parameter . /// /// A normalized parameter in the range [0, 1]. Vector3 Tangent(float t); /// /// Evaluates the curve at the given parameter . /// Alias for . /// Point3 this[float t] { get; } /// /// Approximates the arc length of the curve using 16 uniform samples. /// float Length(); /// /// Approximates the arc length of the curve using adaptive subdivision /// until the error is within . /// /// The maximum allowed error per segment. float Length(float precision); } /// /// Represents a linear (degree-1) Bézier curve in 3D space — a straight line segment /// from to . /// public readonly struct LinearBezier3 : ICurve3 { /// The starting point of the segment. public readonly Point3 P0; /// The ending point of the segment. public readonly Point3 P1; /// /// Initializes a new with the specified endpoints. /// public LinearBezier3(Point3 p0, Point3 p1); /// /// Evaluates the segment at parameter . /// /// A normalized parameter in the range [0, 1]. public Point3 Lerp(float t); /// /// Returns the constant tangent (direction) of the segment. /// /// Ignored — the tangent is constant for a linear segment. public Vector3 Tangent(float t); /// /// Evaluates the curve at the given parameter . /// Alias for . /// public Point3 this[float t] { get; } /// /// Returns the length of the segment (the Euclidean distance from to ). /// public float Length(); /// /// Returns the length of the segment. /// The parameter is ignored for linear segments. /// public float Length(float precision); /// /// Converts this linear segment to a with a midpoint control. /// public QuadraticBezier3 ToQuadratic(); /// /// Converts this linear segment to a with collinear controls. /// public CubicBezier3 ToCubic(); /// Returns the fully qualified type name of this instance. /// The fully qualified type name. public override string ToString(); } /// /// 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 to , /// pulled toward the control point . Points are computed using /// De Casteljau's algorithm for numerical stability. /// public readonly struct QuadraticBezier3 : ICurve3 { /// The starting point of the curve. public readonly Point3 P0; /// The control point, which influences the curvature. public readonly Point3 P1; /// The ending point of the curve. public readonly Point3 P2; /// /// Initializes a new with the specified control points. /// public QuadraticBezier3(Point3 p0, Point3 p1, Point3 p2); /// /// Evaluates the curve at parameter using De Casteljau's algorithm. /// /// A normalized parameter in the range [0, 1]. public Point3 Lerp(float t); /// /// Returns the tangent vector of the curve at parameter . /// /// A normalized parameter in the range [0, 1]. public Vector3 Tangent(float t); /// /// Evaluates the curve at the given parameter . /// Alias for . /// public Point3 this[float t] { get; } /// /// Approximates the arc length using 16 uniform samples. /// public float Length(); /// /// Approximates the arc length using adaptive subdivision until the error per /// segment is within . /// public float Length(float precision); /// /// Subdivides this curve at parameter using De Casteljau's algorithm, /// returning the left and right sub-curves. /// /// The split parameter in the range (0, 1). public (QuadraticBezier3 left, QuadraticBezier3 right) Subdivide(float t); /// /// Elevates this quadratic curve to an equivalent . /// public CubicBezier3 ToCubic(); /// Returns the fully qualified type name of this instance. /// The fully qualified type name. public override string ToString(); } }