Xui.Core.Curves2D
Assembly: Xui.Core · C# declarations · Assembly overview
Types
readonly struct Arcreadonly struct Arc3Pointreadonly struct ArcEndpointclass Bezierreadonly struct CubicBezierstruct CubicBezier.SubcurveNodereadonly struct CubicSplineinterface ICurvereadonly struct LinearBezierreadonly struct LinearSplinereadonly struct MonotonicArc3Pointreadonly struct MonotonicCubicBezierreadonly struct MonotonicQuadraticBezierreadonly struct QuadraticBezierreadonly struct QuadraticSplinereadonly struct Segmentclass Spline
readonly struct Arc
Represents a circular or elliptical arc defined by a center point, radii, rotation, and sweep angles.
Arcs are useful for describing elliptical curves in vector graphics, layout paths, and stroke outlines. They interpolate smoothly from Xui.Core.Curves2D.Arc.StartAngle to Xui.Core.Curves2D.Arc.EndAngle, optionally applying rotation and winding direction.
public readonly struct Arc : ICurve
{
public readonly Point Center;
public readonly nfloat RadiusX;
public readonly nfloat RadiusY;
public readonly nfloat Rotation;
public readonly nfloat StartAngle;
public readonly nfloat EndAngle;
public readonly Winding Winding;
public Arc(Point center, nfloat rx, nfloat ry, nfloat rotation, nfloat startAngle, nfloat endAngle, Winding winding = Winding.ClockWise);
public Point this[nfloat t] { get; }
public Point Lerp(nfloat t);
public Point Evaluate(nfloat t);
public Vector Tangent(nfloat t);
public nfloat Length();
public nfloat Length(nfloat flatness);
public nfloat SweepAngle { get; }
public ArcEndpoint ToEndpointArc();
public (ArcEndpoint, ArcEndpoint? ) ToEndpointArcs();
public Point EvaluateAtAngle(nfloat θ);
public void ToArc3Segments(Span<Arc3Point> buffer, out int count);
}
Arc.Arc(Point center, NFloat rx, NFloat ry, NFloat rotation, NFloat startAngle, NFloat endAngle, Winding winding = Winding.ClockWise)
public Arc(Point center, nfloat rx, nfloat ry, nfloat rotation, nfloat startAngle, nfloat endAngle, Winding winding = Winding.ClockWise);
Initializes a new Xui.Core.Curves2D.Arc with the given center, radii, rotation, angles, and winding direction.
center— The center point of the arc's ellipse.rx— The horizontal radius.ry— The vertical radius.rotation— The clockwise rotation in radians applied to the ellipse.startAngle— The start angle of the arc in radians (before rotation).endAngle— The end angle of the arc in radians (before rotation).winding— Whether the arc is drawn clockwise or counter-clockwise.
Point Arc.Center
public readonly Point Center;
The center point of the arc's ellipse.
NFloat Arc.EndAngle
public readonly nfloat EndAngle;
The angle (in radians) at which the arc ends, before rotation is applied.
Point Arc.Evaluate(NFloat t)
public Point Evaluate(nfloat t);
Evaluates the arc at a normalized parameter t, returning the corresponding point.
t— A normalized value in the range [0, 1].
Returns: The corresponding point on the rotated ellipse arc.
Point Arc.EvaluateAtAngle(NFloat θ)
public Point EvaluateAtAngle(nfloat θ);
Evaluates the position on the ellipse at a given angle θ (in radians), relative to the unrotated ellipse center.
θ— The angle in radians, measured from the X axis of the unrotated ellipse. This is not a normalized parameter liket, but an absolute angle used in parametric arc equations.
Returns: The corresponding Xui.Core.Math2D.Point on the arc's ellipse at the given angle, after applying the arc's rotation and translating from its center.
The point is computed using the parametric equation of an axis-aligned ellipse: (x, y) = (rx * cos(θ), ry * sin(θ)), then rotated by Xui.Core.Curves2D.Arc.Rotation and translated to Xui.Core.Curves2D.Arc.Center. This method is useful when working directly with angle-based metrics like vertical extrema (e.g., θ = π/2 or 3π/2).
Point Arc.this[NFloat t]
public Point this[nfloat t] { get; }
Gets the interpolated point on the arc at the specified parameter t.
t— A normalized value from 0 to 1 representing the progression along the arc.
NFloat Arc.Length()
public nfloat Length();
Approximates the arc length using uniform sampling with 16 segments.
Returns: The approximate total arc length.
NFloat Arc.Length(NFloat flatness)
public nfloat Length(nfloat flatness);
Approximates the arc length using recursive adaptive subdivision.
flatness— The maximum allowed error per segment for arc approximation.
Returns: The computed arc length within the specified flatness tolerance.
Point Arc.Lerp(NFloat t)
public Point Lerp(nfloat t);
Computes the interpolated point on the arc at a given parameter t.
t— A normalized value in the range [0, 1].
NFloat Arc.RadiusX
public readonly nfloat RadiusX;
The horizontal radius of the arc.
NFloat Arc.RadiusY
public readonly nfloat RadiusY;
The vertical radius of the arc.
NFloat Arc.Rotation
public readonly nfloat Rotation;
The clockwise rotation (in radians) applied to the arc relative to the X axis.
NFloat Arc.StartAngle
public readonly nfloat StartAngle;
The angle (in radians) at which the arc starts, before rotation is applied.
NFloat Arc.SweepAngle
public nfloat SweepAngle { get; }
Gets the signed sweep angle of the arc, in radians. Adjusts automatically for the specified Xui.Core.Curves2D.Arc.Winding.
Vector Arc.Tangent(NFloat t)
public Vector Tangent(nfloat t);
Computes the tangent vector at parameter t on the arc.
t— A normalized value in the range [0, 1].
Returns: The normalized tangent vector at the evaluated point on the arc.
void Arc.ToArc3Segments(Span<Arc3Point> buffer, out int count)
public void ToArc3Segments(Span<Arc3Point> buffer, out int count);
Splits this arc into a series of Xui.Core.Curves2D.Arc3Point segments, each spanning ≤ 90° and aligned so that one edge is axis-aligned.
buffer— A span to receive the output segments. Must have space for up to 4 entries.count— The number of segments written tobuffer.
This method ensures consistent arc tessellation by aligning segment edges with X or Y axes and bounding each by ≤ 90°, suitable for round rects or shader-compatible curves.
ArcEndpoint Arc.ToEndpointArc()
public ArcEndpoint ToEndpointArc();
Converts this arc to an endpoint-parameterized Xui.Core.Curves2D.ArcEndpoint representation.
This method generates a single arc segment between the start and end points of the original arc, preserving the sweep direction and determining whether the arc is the larger of the two possible segments. If the arc forms a complete circle (i.e., the start and end points match and the sweep covers 360°), the endpoint position is nudged slightly to avoid rendering ambiguities in formats that do not support full-circle arcs directly.
Returns: An Xui.Core.Curves2D.ArcEndpoint structure that approximates this arc using endpoint-based parametrization.
(ArcEndpoint, ArcEndpoint?) Arc.ToEndpointArcs()
public (ArcEndpoint, ArcEndpoint? ) ToEndpointArcs();
Converts this arc to one or two endpoint-parameterized arcs, depending on the arc's sweep angle.
If the arc forms a complete or nearly complete circle (i.e., the sweep angle approaches ±360° and the start and end points match), the arc is split into two half-circle segments to avoid rendering issues in formats that do not support full-circle arcs directly. Otherwise, a single Xui.Core.Curves2D.ArcEndpoint is returned with appropriate flags set for direction and size.
Returns: A tuple of one or two Xui.Core.Curves2D.ArcEndpoint instances that collectively represent the same elliptical arc:
Item1– The first arc segment (always non-null).Item2– The second arc segment if the arc is split, ornullif the arc fits in a single segment.
Winding Arc.Winding
public readonly Winding Winding;
Specifies whether the arc is drawn clockwise or counter-clockwise.
readonly struct Arc3Point
Represents a circular arc defined by three points: start, mid (on-curve), and end.
The arc is guaranteed to pass through all three control points Xui.Core.Curves2D.Arc3Point.P0, Xui.Core.Curves2D.Arc3Point.P1, and Xui.Core.Curves2D.Arc3Point.P2. The arc lies on the unique circle that intersects these points and is useful for geometric primitives, shader-based SDF rendering, and polygonal arc approximation.
public readonly struct Arc3Point : ICurve
{
public readonly Point P0;
public readonly Point P1;
public readonly Point P2;
public Arc3Point(Point p0, Point p1, Point p2);
public Arc? ToCenterArc();
public ArcEndpoint? ToEndpointArc();
public Point Lerp(nfloat t);
public Vector Tangent(nfloat t);
public Point this[nfloat t] { get; }
public nfloat Length();
public nfloat Length(nfloat precision);
public static implicit operator Arc3Point((Point p0, Point p1, Point p2) value);
public MonotonicArc3Point SplitIntoYMonotonicCurves();
}
Arc3Point.Arc3Point(Point p0, Point p1, Point p2)
public Arc3Point(Point p0, Point p1, Point p2);
Initializes a new Xui.Core.Curves2D.Arc3Point defined by three on-curve points.
Point Arc3Point.this[NFloat t]
public Point this[nfloat t] { get; }
Provides indexer access as an alias for Xui.Core.Curves2D.ICurve.Lerp(System.Runtime.InteropServices.NFloat).
NFloat Arc3Point.Length()
public nfloat Length();
Computes an approximate arc length using 16 steps.
NFloat Arc3Point.Length(NFloat precision)
public nfloat Length(nfloat precision);
Computes a refined approximation of arc length with a specified precision.
Point Arc3Point.Lerp(NFloat t)
public Point Lerp(nfloat t);
Evaluates the curve at the given normalized parameter t in [0, 1].
Point Arc3Point.P0
public readonly Point P0;
The starting point of the arc.
Point Arc3Point.P1
public readonly Point P1;
A point on the arc between Xui.Core.Curves2D.Arc3Point.P0 and Xui.Core.Curves2D.Arc3Point.P2.
Point Arc3Point.P2
public readonly Point P2;
The ending point of the arc.
MonotonicArc3Point Arc3Point.SplitIntoYMonotonicCurves()
public MonotonicArc3Point SplitIntoYMonotonicCurves();
Splits the arc into one or two Y-monotonic Xui.Core.Curves2D.Arc3Point segments.
This method finds the angle θ where the Y value of the arc reaches an extremum. If this point lies within the arc, the arc is split at that angle into two Y-monotonic sub-arcs. If no vertical extremum is found within the arc range, the arc is already monotonic.
Vector Arc3Point.Tangent(NFloat t)
public Vector Tangent(nfloat t);
Computes the tangent vector at the specified t.
Arc? Arc3Point.ToCenterArc()
public Arc? ToCenterArc();
Converts this three-point arc into a center-based Xui.Core.Curves2D.Arc if the arc is valid.
Returns: A valid Xui.Core.Curves2D.Arc if the input points define a circular segment; otherwise null. If the result is null, consider falling back to a straight Xui.Core.Curves2D.Segment from Xui.Core.Curves2D.Arc3Point.P0 to Xui.Core.Curves2D.Arc3Point.P2.
ArcEndpoint? Arc3Point.ToEndpointArc()
public ArcEndpoint? ToEndpointArc();
Converts this arc to an endpoint-based Xui.Core.Curves2D.ArcEndpoint format, if valid.
Arc3Point.implicit operator Arc3Point((Point p0, Point p1, Point p2) value)
public static implicit operator Arc3Point((Point p0, Point p1, Point p2) value);
Implicitly converts a tuple of 3 points to an Xui.Core.Curves2D.Arc3Point.
readonly struct ArcEndpoint
Represents a circular or elliptical arc defined by radii, rotation, and endpoint parameters.
This arc representation uses start and end points along with size and sweep flags. It is commonly used in vector graphics where the arc shape is inferred from geometry and direction flags.
public readonly struct ArcEndpoint : ICurve
{
public readonly Point Start;
public readonly Point End;
public readonly nfloat RadiusX;
public readonly nfloat RadiusY;
public readonly nfloat Rotation;
public readonly bool LargeArc;
public readonly Winding Winding;
public ArcEndpoint(Point start, Point end, nfloat rx, nfloat ry, nfloat rotation, bool largeArc, Winding winding);
public Point this[nfloat t] { get; }
public Point Lerp(nfloat t);
public Point Evaluate(nfloat t);
public Vector Tangent(nfloat t);
public nfloat Length();
public nfloat Length(nfloat flatness);
public Arc ToCenterArc();
public void ToArc3Segments(Span<Arc3Point> buffer, out int count);
}
ArcEndpoint.ArcEndpoint(Point start, Point end, NFloat rx, NFloat ry, NFloat rotation, bool largeArc, Winding winding)
public ArcEndpoint(Point start, Point end, nfloat rx, nfloat ry, nfloat rotation, bool largeArc, Winding winding);
Initializes a new Xui.Core.Curves2D.ArcEndpoint with the given geometry and flags.
start— The start point of the arc.end— The end point of the arc.rx— The horizontal radius.ry— The vertical radius.rotation— The clockwise rotation in radians applied to the ellipse.largeArc— Whether the arc should be the larger of the two possible arcs.winding— The sweep direction (clockwise or counter-clockwise).
Point ArcEndpoint.End
public readonly Point End;
The end point of the arc.
Point ArcEndpoint.Evaluate(NFloat t)
public Point Evaluate(nfloat t);
Evaluates the arc at a normalized parameter t, returning the corresponding point.
t— A normalized value in the range [0, 1].
Returns: The corresponding point on the arc.
Point ArcEndpoint.this[NFloat t]
public Point this[nfloat t] { get; }
Gets the interpolated point on the arc at the specified parameter t.
t— A normalized value from 0 to 1 representing the progression along the arc.
bool ArcEndpoint.LargeArc
public readonly bool LargeArc;
If true, the arc is the longer (greater than 180°) of the two possible arcs between points.
NFloat ArcEndpoint.Length()
public nfloat Length();
Approximates the arc length using uniform sampling with 16 segments.
Returns: The approximate total arc length.
NFloat ArcEndpoint.Length(NFloat flatness)
public nfloat Length(nfloat flatness);
Approximates the arc length using recursive adaptive subdivision.
flatness— The maximum allowed error per segment for arc approximation.
Returns: The computed arc length within the specified flatness tolerance.
Point ArcEndpoint.Lerp(NFloat t)
public Point Lerp(nfloat t);
Computes the interpolated point on the arc at a given parameter t.
t— A normalized value in the range [0, 1].
NFloat ArcEndpoint.RadiusX
public readonly nfloat RadiusX;
The horizontal radius of the arc.
NFloat ArcEndpoint.RadiusY
public readonly nfloat RadiusY;
The vertical radius of the arc.
NFloat ArcEndpoint.Rotation
public readonly nfloat Rotation;
The clockwise rotation (in radians) applied to the arc's ellipse relative to the X axis.
Point ArcEndpoint.Start
public readonly Point Start;
The start point of the arc.
Vector ArcEndpoint.Tangent(NFloat t)
public Vector Tangent(nfloat t);
Computes the tangent vector at parameter t on the arc.
t— A normalized value in the range [0, 1].
Returns: The normalized tangent vector at the evaluated point on the arc.
void ArcEndpoint.ToArc3Segments(Span<Arc3Point> buffer, out int count)
public void ToArc3Segments(Span<Arc3Point> buffer, out int count);
Splits this arc into a series of Xui.Core.Curves2D.Arc3Point segments, each spanning ≤ 90° and aligned so that one edge is axis-aligned.
buffer— A span to receive the output segments. Must have space for up to 4 entries.count— The number of segments written tobuffer.
This method converts the arc into a center-based Xui.Core.Curves2D.Arc representation, then delegates to its Xui.Core.Curves2D.Arc.ToArc3Segments(System.Span{Xui.Core.Curves2D.Arc3Point},System.Int32@) method. Each resulting Xui.Core.Curves2D.Arc3Point segment spans ≤ 90° and is safe for monotonic tessellation.
Arc ArcEndpoint.ToCenterArc()
public Arc ToCenterArc();
Converts this endpoint-parameterized arc to a center-based Xui.Core.Curves2D.Arc.
Returns: A new Xui.Core.Curves2D.Arc representing the same shape.
Winding ArcEndpoint.Winding
public readonly Winding Winding;
The direction in which the arc is drawn (clockwise or counter-clockwise).
class Bezier
Static helper methods for constructing Bézier curves.
public static class Bezier
{
public static LinearBezier Linear(Point p0, Point p1);
public static QuadraticBezier Quadratic(Point p0, Point p1, Point p2);
public static CubicBezier Cubic(Point p0, Point p1, Point p2, Point p3);
}
CubicBezier Bezier.Cubic(Point p0, Point p1, Point p2, Point p3)
public static CubicBezier Cubic(Point p0, Point p1, Point p2, Point p3);
Creates a cubic Bézier curve from four control points.
LinearBezier Bezier.Linear(Point p0, Point p1)
public static LinearBezier Linear(Point p0, Point p1);
Creates a linear Bézier curve from two points.
QuadraticBezier Bezier.Quadratic(Point p0, Point p1, Point p2)
public static QuadraticBezier Quadratic(Point p0, Point p1, Point p2);
Creates a quadratic Bézier curve from three control points.
readonly struct CubicBezier
Represents a cubic Bézier curve defined by four control points.
A cubic Bézier curve provides smooth interpolation between Xui.Core.Curves2D.CubicBezier.P0 and Xui.Core.Curves2D.CubicBezier.P3, influenced by the control points Xui.Core.Curves2D.CubicBezier.P1 and Xui.Core.Curves2D.CubicBezier.P2. This is commonly used in vector graphics, animation timing, and layout paths.
public readonly struct CubicBezier : ICurve
{
public readonly Point P0;
public readonly Point P1;
public readonly Point P2;
public readonly Point P3;
public CubicBezier(Point p0, Point p1, Point p2, Point p3);
public Point Lerp(nfloat t);
public QuadraticBezier QuadraticApproximation { get; }
public Vector Tangent(nfloat t);
public nfloat Length();
public nfloat Length(nfloat precision);
public Point this[nfloat t] { get; }
public static implicit operator CubicBezier((Point p0, Point p1, Point p2, Point p3) value);
public static implicit operator CubicBezier(QuadraticBezier quadratic);
public static implicit operator CubicBezier(CubicSpline spline);
public CubicBezier Drag(nfloat t, Vector delta);
public CubicBezier DragAt(Point origin, Vector delta);
public CubicBezier DragAt(Point origin, Vector delta, nfloat precision);
public nfloat ClosestT(Point target);
public nfloat ClosestT(Point target, nfloat precision);
public MonotonicCubicBezier SplitIntoYMonotonicCurves();
public (CubicBezier, CubicBezier) Subdivide(nfloat t);
public void ToQuadratics(Span<QuadraticBezier> buffer, nfloat precision, out int count);
public struct SubcurveNode
{
public CubicBezier Segment;
public QuadraticBezier QuadraticBezierApproximation;
public nfloat Precision;
public ushort NextIndex;
public SubcurveNode(CubicBezier segment, ushort nextIndex = 0);
}
}
CubicBezier.CubicBezier(Point p0, Point p1, Point p2, Point p3)
public CubicBezier(Point p0, Point p1, Point p2, Point p3);
Initializes a new cubic Bézier curve with the specified control points.
NFloat CubicBezier.ClosestT(Point target)
public nfloat ClosestT(Point target);
Returns the parameter t ∈ [0, 1] at which the curve is closest to the specified target point. This version uses uniform sampling with 16 segments and is fast enough for interactive use.
target— The point to compare against the curve.
Returns: The approximate t value where the curve is closest to target.
NFloat CubicBezier.ClosestT(Point target, NFloat precision)
public nfloat ClosestT(Point target, nfloat precision);
Returns the parameter t ∈ [0, 1] at which the curve is closest to the specified target point, using recursive ternary subdivision until the difference in t range is less than precision.
target— The point to compare against the curve.precision— The minimum resolution fortconvergence. Smaller values yield more accurate results.
Returns: The t value where the curve is closest to target within the specified precision.
CubicBezier CubicBezier.Drag(NFloat t, Vector delta)
public CubicBezier Drag(nfloat t, Vector delta);
Returns a new Xui.Core.Curves2D.CubicBezier curve where the control points P1 and P2 are adjusted based on a drag gesture at a given parametric position t.
t— A normalized value (between 0 and 1) representing the position on the curve where the drag occurs.delta— The drag vector representing how far the user dragged the point att.
Returns: A new Xui.Core.Curves2D.CubicBezier with P0 and P3 unchanged, and P1 and P2 adjusted proportionally to the drag direction and distance.
The influence of the drag on P1 and P2 is weighted quadratically based on their distance from t along the curve: P1 is influenced by (1 - t)² and P2 by t². This preserves the endpoints while allowing intuitive manipulation of the curve shape.
CubicBezier CubicBezier.DragAt(Point origin, Vector delta)
public CubicBezier DragAt(Point origin, Vector delta);
Returns a new cubic Bézier curve with adjusted control points so the point on the curve nearest to origin is moved by delta.
CubicBezier CubicBezier.DragAt(Point origin, Vector delta, NFloat precision)
public CubicBezier DragAt(Point origin, Vector delta, nfloat precision);
Returns a new cubic Bézier curve with adjusted control points so the point on the curve nearest to origin is moved by delta. Uses recursive refinement based on the specified precision.
Point CubicBezier.this[NFloat t]
public Point this[nfloat t] { get; }
Gets the interpolated point on the curve at the specified parameter.
t— A normalized parameter in the range [0, 1].
NFloat CubicBezier.Length()
public nfloat Length();
Approximates the arc length of the curve using uniform sampling with 16 segments.
NFloat CubicBezier.Length(NFloat precision)
public nfloat Length(nfloat precision);
Approximates the arc length of the curve using recursive adaptive subdivision.
precision— The tolerance value used to determine when a segment is flat enough to stop subdividing. Smaller values result in more accurate results but require more computation.
Point CubicBezier.Lerp(NFloat t)
public Point Lerp(nfloat t);
Computes the interpolated point on the curve at parameter t using De Casteljau’s algorithm.
t— A normalized parameter in the range [0, 1].
Point CubicBezier.P0
public readonly Point P0;
The starting point of the curve.
Point CubicBezier.P1
public readonly Point P1;
The first control point, influencing the curve near Xui.Core.Curves2D.CubicBezier.P0.
Point CubicBezier.P2
public readonly Point P2;
The second control point, influencing the curve near Xui.Core.Curves2D.CubicBezier.P3.
Point CubicBezier.P3
public readonly Point P3;
The ending point of the curve.
QuadraticBezier CubicBezier.QuadraticApproximation
public QuadraticBezier 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.
MonotonicCubicBezier CubicBezier.SplitIntoYMonotonicCurves()
public MonotonicCubicBezier SplitIntoYMonotonicCurves();
Splits this curve at the Y-derivative roots, returning up to three Y-monotonic segments packed into a Xui.Core.Curves2D.MonotonicCubicBezier.
(CubicBezier, CubicBezier) CubicBezier.Subdivide(NFloat t)
public (CubicBezier, CubicBezier) Subdivide(nfloat t);
Subdivides this cubic Bézier curve at parameter t, returning two curves.
Vector CubicBezier.Tangent(NFloat t)
public Vector Tangent(nfloat t);
Computes the tangent vector of the curve at parameter t.
t— A normalized parameter in the range [0, 1].
void CubicBezier.ToQuadratics(Span<QuadraticBezier> buffer, NFloat precision, out int count)
public void ToQuadratics(Span<QuadraticBezier> buffer, nfloat precision, out int count);
Converts this cubic Bézier curve into a sequence of Y-monotonic quadratic Bézier segments, each approximating a portion of the original curve within the specified flatness precision.
buffer— A span to receive the quadratic segments. Must be large enough to hold the result. A typical size is between 4 and 32. Must be at least 3 to accommodate the initial monotonic split.precision— The maximum allowed distance between the original cubic curve and its quadratic approximation. Lower values yield more accurate approximations but may require more output segments.count— The number of segments written tobuffer.
This method uses an adaptive, flatness-aware subdivision strategy. It begins by splitting the cubic curve into up to 3 Y-monotonic segments. Each is then approximated with a quadratic Bézier, and the segments with the highest deviation are recursively subdivided until the total number of segments fits within buffer and all segments meet the precision requirement. The output segments are returned in order, forming a continuous piecewise-curve that follows the original cubic. Suitable for SDF tessellation or scanline-based rasterization.
Throws Thrown if has fewer than 3 elements.: Thrown if buffer has fewer than 3 elements.
CubicBezier.implicit operator CubicBezier((Point p0, Point p1, Point p2, Point p3) value)
public static implicit operator CubicBezier((Point p0, Point p1, Point p2, Point p3) value);
Implicitly converts a tuple of four points into a Xui.Core.Curves2D.CubicBezier.
value— A tuple representing the start point, two control points, and end point.
CubicBezier.implicit operator CubicBezier(CubicSpline spline)
public static implicit operator CubicBezier(CubicSpline spline);
Implicitly converts this cubic Catmull–Rom spline to a Xui.Core.Curves2D.CubicBezier.
Uses the canonical Catmull–Rom to Bézier mapping, interpolating between P1 and P2.
CubicBezier.implicit operator CubicBezier(QuadraticBezier quadratic)
public static implicit operator CubicBezier(QuadraticBezier quadratic);
Implicitly converts a Xui.Core.Curves2D.QuadraticBezier to a Xui.Core.Curves2D.CubicBezier using interpolation for smooth parameterization.
This conversion evaluates the quadratic Bézier at fixed steps (1⁄3 and 2⁄3) to generate the internal control points of the cubic, resulting in a visually smooth upgrade path.
struct CubicBezier.SubcurveNode
A node in the adaptive subdivision linked list used by Xui.Core.Curves2D.CubicBezier.ToQuadratics(System.Span{Xui.Core.Curves2D.QuadraticBezier},System.Runtime.InteropServices.NFloat,System.Int32@). Each node holds a cubic segment, its quadratic approximation, and a flatness error measure.
public struct SubcurveNode
{
public CubicBezier Segment;
public QuadraticBezier QuadraticBezierApproximation;
public nfloat Precision;
public ushort NextIndex;
public SubcurveNode(CubicBezier segment, ushort nextIndex = 0);
}
SubcurveNode.SubcurveNode(CubicBezier segment, ushort nextIndex = 0)
public SubcurveNode(CubicBezier segment, ushort nextIndex = 0);
Initializes a new node representing a quadratic approximation of a cubic Bézier segment in a linked list.
segment— The original cubic Bézier segment.nextIndex— Index of the next node in the chain. Use 0 if this is the last node.
ushort SubcurveNode.NextIndex
public ushort NextIndex;
Index of the next node in the linked chain; 0 indicates this is the last node.
NFloat SubcurveNode.Precision
public nfloat Precision;
The maximum perpendicular deviation of the approximation from the original cubic.
QuadraticBezier SubcurveNode.QuadraticBezierApproximation
public QuadraticBezier QuadraticBezierApproximation;
The quadratic Bézier approximation of Xui.Core.Curves2D.CubicBezier.SubcurveNode.Segment.
CubicBezier SubcurveNode.Segment
public CubicBezier Segment;
The cubic Bézier segment represented by this node.
readonly struct CubicSpline
Represents a 4-point spline segment using Catmull–Rom interpolation. The curve interpolates smoothly between Xui.Core.Curves2D.CubicSpline.P1 and Xui.Core.Curves2D.CubicSpline.P2.
Catmull–Rom splines are useful for generating smooth curves through a sequence of points with minimal configuration. This implementation produces a C¹-continuous cubic curve, influenced by neighboring control points Xui.Core.Curves2D.CubicSpline.P0 and Xui.Core.Curves2D.CubicSpline.P3. The segment can also be converted into a Xui.Core.Curves2D.CubicBezier for drawing or compatibility.
public readonly struct CubicSpline : ICurve
{
public readonly Point P0;
public readonly Point P1;
public readonly Point P2;
public readonly Point P3;
public CubicSpline(Point p0, Point p1, Point p2, Point p3);
public Point Lerp(nfloat t);
public Vector Tangent(nfloat t);
public nfloat Length();
public nfloat Length(nfloat precision);
public Point this[nfloat t] { get; }
public static implicit operator CubicBezier(CubicSpline s);
}
CubicSpline.CubicSpline(Point p0, Point p1, Point p2, Point p3)
public CubicSpline(Point p0, Point p1, Point p2, Point p3);
Initializes a new Catmull–Rom spline segment from four control points.
Point CubicSpline.this[NFloat t]
public Point this[nfloat t] { get; }
Indexer-style access to evaluate the curve at a given parameter.
NFloat CubicSpline.Length()
public nfloat Length();
Approximates the arc length of the curve using uniform sampling with 16 segments.
NFloat CubicSpline.Length(NFloat precision)
public nfloat Length(nfloat precision);
Approximates the arc length using recursive adaptive subdivision.
precision— The tolerance used to decide subdivision depth.
Point CubicSpline.Lerp(NFloat t)
public Point Lerp(nfloat t);
Evaluates the point on the spline at the given parameter t using the Catmull–Rom formula.
t— A normalized parameter in the range [0, 1].
Point CubicSpline.P0
public readonly Point P0;
The control point before the start of the curve.
Point CubicSpline.P1
public readonly Point P1;
The starting point of the interpolated segment.
Point CubicSpline.P2
public readonly Point P2;
The ending point of the interpolated segment.
Point CubicSpline.P3
public readonly Point P3;
The control point after the end of the curve.
Vector CubicSpline.Tangent(NFloat t)
public Vector Tangent(nfloat t);
Computes the tangent vector at parameter t by differentiating the spline.
t— A normalized parameter in the range [0, 1].
CubicSpline.implicit operator CubicBezier(CubicSpline s)
public static implicit operator CubicBezier(CubicSpline s);
Converts this Catmull–Rom spline segment to an equivalent Xui.Core.Curves2D.CubicBezier. The resulting curve interpolates between Xui.Core.Curves2D.CubicSpline.P1 and Xui.Core.Curves2D.CubicSpline.P2.
interface ICurve
Represents a common interface for evaluable 2D curves.
public interface ICurve
{
Point Lerp(nfloat t);
Vector Tangent(nfloat t);
Point this[nfloat t] { get; }
nfloat Length();
nfloat Length(nfloat precision);
}
Point ICurve.this[NFloat t]
Point this[nfloat t] { get; }
Provides indexer access as an alias for Xui.Core.Curves2D.ICurve.Lerp(System.Runtime.InteropServices.NFloat).
NFloat ICurve.Length()
nfloat Length();
Computes an approximate arc length using 16 steps.
NFloat ICurve.Length(NFloat precision)
nfloat Length(nfloat precision);
Computes a refined approximation of arc length with a specified precision.
Point ICurve.Lerp(NFloat t)
Point Lerp(nfloat t);
Evaluates the curve at the given normalized parameter t in [0, 1].
Vector ICurve.Tangent(NFloat t)
Vector Tangent(nfloat t);
Computes the tangent vector at the specified t.
readonly struct LinearBezier
Represents a linear Bézier curve, equivalent to a straight line between two points.
This is the simplest form of Bézier curve, defined by two points Xui.Core.Curves2D.LinearBezier.P0 and Xui.Core.Curves2D.LinearBezier.P1. It is often used for edges of polygonal paths or degenerate forms of higher-order Béziers.
public readonly struct LinearBezier : ICurve
{
public readonly Point P0;
public readonly Point P1;
public LinearBezier(Point p0, Point p1);
public Point Lerp(nfloat t);
public Vector Tangent(nfloat t);
public nfloat Length();
public nfloat Length(nfloat precision);
public Point this[nfloat t] { get; }
public static implicit operator LinearBezier((Point p0, Point p1) value);
public static implicit operator QuadraticBezier(LinearBezier linear);
public static implicit operator CubicBezier(LinearBezier linear);
public static implicit operator LinearBezier(LinearSpline spline);
}
LinearBezier.LinearBezier(Point p0, Point p1)
public LinearBezier(Point p0, Point p1);
Initializes a new Xui.Core.Curves2D.LinearBezier curve with the given start and end points.
p0— The starting point.p1— The ending point.
Point LinearBezier.this[NFloat t]
public Point this[nfloat t] { get; }
Indexer-style access to the interpolated point at parameter t.
NFloat LinearBezier.Length()
public nfloat Length();
Returns the exact length of the line segment.
NFloat LinearBezier.Length(NFloat precision)
public nfloat Length(nfloat precision);
Returns the length of the line segment. This overload ignores the precision parameter.
Point LinearBezier.Lerp(NFloat t)
public Point Lerp(nfloat t);
Computes the point on the line at parameter t using linear interpolation.
t— A normalized parameter in the range [0, 1].
Point LinearBezier.P0
public readonly Point P0;
The start point of the curve.
Point LinearBezier.P1
public readonly Point P1;
The end point of the curve.
Vector LinearBezier.Tangent(NFloat t)
public Vector Tangent(nfloat t);
Returns the constant tangent vector of the line segment.
t— The curve parameter (ignored since the tangent is constant).
LinearBezier.implicit operator LinearBezier((Point p0, Point p1) value)
public static implicit operator LinearBezier((Point p0, Point p1) value);
Implicitly converts a tuple of two points into a Xui.Core.Curves2D.LinearBezier.
LinearBezier.implicit operator CubicBezier(LinearBezier linear)
public static implicit operator CubicBezier(LinearBezier linear);
Implicitly converts this Xui.Core.Curves2D.LinearBezier to a Xui.Core.Curves2D.CubicBezier curve. Intermediate control points are interpolated at 1/3 and 2/3 for smooth spacing.
LinearBezier.implicit operator QuadraticBezier(LinearBezier linear)
public static implicit operator QuadraticBezier(LinearBezier linear);
Implicitly converts this Xui.Core.Curves2D.LinearBezier to a Xui.Core.Curves2D.QuadraticBezier curve. The intermediate point is set to the midpoint for visual smoothness.
LinearBezier.implicit operator LinearBezier(LinearSpline spline)
public static implicit operator LinearBezier(LinearSpline spline);
Implicitly converts a Xui.Core.Curves2D.LinearSpline to a Xui.Core.Curves2D.LinearBezier.
readonly struct LinearSpline
Represents a linear spline segment between two points.
A linear spline defines a straight-line interpolation between Xui.Core.Curves2D.LinearSpline.P0 and Xui.Core.Curves2D.LinearSpline.P1. It is the simplest form of spline, useful for polyline paths, control handles, and degenerate Bézier cases.
public readonly struct LinearSpline : ICurve
{
public readonly Point P0;
public readonly Point P1;
public LinearSpline(Point p0, Point p1);
public Point Lerp(nfloat t);
public Vector Tangent(nfloat t);
public Point this[nfloat t] { get; }
public nfloat Length();
public nfloat Length(nfloat precision);
public static implicit operator LinearBezier(LinearSpline s);
}
LinearSpline.LinearSpline(Point p0, Point p1)
public LinearSpline(Point p0, Point p1);
Initializes a new Xui.Core.Curves2D.LinearSpline segment between two points.
p0— The starting point of the spline.p1— The ending point of the spline.
Point LinearSpline.this[NFloat t]
public Point this[nfloat t] { get; }
Evaluates the point on the spline at the specified parameter.
NFloat LinearSpline.Length()
public nfloat Length();
Returns the length of the segment.
NFloat LinearSpline.Length(NFloat precision)
public nfloat Length(nfloat precision);
Returns the length of the segment. Precision is ignored for linear splines.
Point LinearSpline.Lerp(NFloat t)
public Point Lerp(nfloat t);
Interpolates a point on the segment at the specified parameter.
t— A normalized parameter in the range [0, 1].
Returns: The interpolated point on the line.
Point LinearSpline.P0
public readonly Point P0;
The starting point of the line segment.
Point LinearSpline.P1
public readonly Point P1;
The ending point of the line segment.
Vector LinearSpline.Tangent(NFloat t)
public Vector Tangent(nfloat t);
Gets the constant tangent vector of the line segment.
t— A normalized parameter (unused, since the tangent is constant).
LinearSpline.implicit operator LinearBezier(LinearSpline s)
public static implicit operator LinearBezier(LinearSpline s);
Converts this linear spline to a Xui.Core.Curves2D.LinearBezier.
readonly struct MonotonicArc3Point
Represents one or two Xui.Core.Curves2D.Arc3Point segments that are each monotonic in the Y direction.
public readonly struct MonotonicArc3Point
{
public readonly Arc3Point First;
public readonly Arc3Point? Second;
public MonotonicArc3Point(Arc3Point only);
public MonotonicArc3Point(Arc3Point first, Arc3Point second);
public bool IsSplit { get; }
}
MonotonicArc3Point.MonotonicArc3Point(Arc3Point only)
public MonotonicArc3Point(Arc3Point only);
Creates a single-segment monotonic arc.
MonotonicArc3Point.MonotonicArc3Point(Arc3Point first, Arc3Point second)
public MonotonicArc3Point(Arc3Point first, Arc3Point second);
Creates a two-segment Y-monotonic arc.
Arc3Point MonotonicArc3Point.First
public readonly Arc3Point First;
The first monotonic segment.
bool MonotonicArc3Point.IsSplit
public bool IsSplit { get; }
True if the arc was split into two segments.
Arc3Point? MonotonicArc3Point.Second
public readonly Arc3Point? Second;
The optional second segment, if the arc was split.
readonly struct MonotonicCubicBezier
Holds one, two, or three Y-monotonic cubic Bézier segments that together represent the result of splitting a single cubic at its Y-derivative roots.
public readonly struct MonotonicCubicBezier
{
public readonly CubicBezier First;
public readonly CubicBezier? Second;
public readonly CubicBezier? Third;
public MonotonicCubicBezier(CubicBezier first, CubicBezier? second = null, CubicBezier? third = null);
}
MonotonicCubicBezier.MonotonicCubicBezier(CubicBezier first, CubicBezier? second = null, CubicBezier? third = null)
public MonotonicCubicBezier(CubicBezier first, CubicBezier? second = null, CubicBezier? third = null);
Initializes the struct with one, two, or three Y-monotonic segments.
first— The first monotonic segment.second— The second monotonic segment, if any.third— The third monotonic segment, if any.
CubicBezier MonotonicCubicBezier.First
public readonly CubicBezier First;
The first (and always present) Y-monotonic segment.
CubicBezier? MonotonicCubicBezier.Second
public readonly CubicBezier? Second;
The second Y-monotonic segment, or null if the original had at most one Y-extremum.
CubicBezier? MonotonicCubicBezier.Third
public readonly CubicBezier? Third;
The third Y-monotonic segment, or null if the original had fewer than two Y-extrema.
readonly struct MonotonicQuadraticBezier
Holds one or two Y-monotonic quadratic Bézier segments that together represent a single quadratic curve split at its Y-extremum.
public readonly struct MonotonicQuadraticBezier
{
public readonly QuadraticBezier First;
public readonly QuadraticBezier? Second;
public MonotonicQuadraticBezier(QuadraticBezier first, QuadraticBezier? second = null);
}
MonotonicQuadraticBezier.MonotonicQuadraticBezier(QuadraticBezier first, QuadraticBezier? second = null)
public MonotonicQuadraticBezier(QuadraticBezier first, QuadraticBezier? second = null);
Initializes the struct with one or two Y-monotonic segments.
first— The first monotonic segment.second— The second monotonic segment, if any.
QuadraticBezier MonotonicQuadraticBezier.First
public readonly QuadraticBezier First;
The first (and always present) Y-monotonic segment.
QuadraticBezier? MonotonicQuadraticBezier.Second
public readonly QuadraticBezier? Second;
The second Y-monotonic segment, or null if no split was needed.
readonly struct QuadraticBezier
Represents a quadratic Bézier curve defined by three control points.
A quadratic Bézier curve smoothly interpolates between Xui.Core.Curves2D.QuadraticBezier.P0 and Xui.Core.Curves2D.QuadraticBezier.P2. The curve is influenced by a single control point Xui.Core.Curves2D.QuadraticBezier.P1. Quadratic Béziers are widely used in vector graphics, font rendering, and easing functions.
public readonly struct QuadraticBezier : ICurve
{
public readonly Point P0;
public readonly Point P1;
public readonly Point P2;
public QuadraticBezier(Point p0, Point p1, Point p2);
public Point Lerp(nfloat t);
public Vector Tangent(nfloat t);
public nfloat Length();
public nfloat Length(nfloat precision);
public Point this[nfloat t] { get; }
public static implicit operator QuadraticBezier((Point p0, Point p1, Point p2) value);
public static implicit operator QuadraticBezier(QuadraticSpline spline);
public QuadraticBezier Drag(nfloat t, Vector delta);
public QuadraticBezier DragAt(Point origin, Vector delta);
public QuadraticBezier DragAt(Point origin, Vector delta, nfloat precision);
public nfloat ClosestT(Point target);
public nfloat ClosestT(Point target, nfloat precision);
public MonotonicQuadraticBezier SplitIntoYMonotonicCurves();
public (QuadraticBezier, QuadraticBezier) Subdivide(nfloat t);
}
QuadraticBezier.QuadraticBezier(Point p0, Point p1, Point p2)
public QuadraticBezier(Point p0, Point p1, Point p2);
Initializes a new quadratic Bézier curve with the specified control points.
NFloat QuadraticBezier.ClosestT(Point target)
public nfloat ClosestT(Point target);
Finds the t value where the curve is closest to target. Uses uniform sampling across 16 points.
NFloat QuadraticBezier.ClosestT(Point target, NFloat precision)
public nfloat ClosestT(Point target, nfloat precision);
Finds the t value where the curve is closest to target. Uses recursive ternary subdivision with the specified precision.
QuadraticBezier QuadraticBezier.Drag(NFloat t, Vector delta)
public QuadraticBezier Drag(nfloat t, Vector delta);
Adjusts the control point to drag the curve at t by the given delta. Keeps Xui.Core.Curves2D.QuadraticBezier.P0 and Xui.Core.Curves2D.QuadraticBezier.P2 fixed.
QuadraticBezier QuadraticBezier.DragAt(Point origin, Vector delta)
public QuadraticBezier DragAt(Point origin, Vector delta);
Adjusts the control point so that the curve is moved near origin by delta. Uses coarse sampling to find the closest point.
QuadraticBezier QuadraticBezier.DragAt(Point origin, Vector delta, NFloat precision)
public QuadraticBezier DragAt(Point origin, Vector delta, nfloat precision);
Adjusts the control point so that the curve is moved near origin by delta. Uses adaptive precision to locate the closest point.
Point QuadraticBezier.this[NFloat t]
public Point this[nfloat t] { get; }
Evaluates the point on the curve at the specified parameter.
NFloat QuadraticBezier.Length()
public nfloat Length();
Approximates the arc length using uniform sampling over 16 segments.
Returns: The approximate total length of the curve.
NFloat QuadraticBezier.Length(NFloat precision)
public nfloat Length(nfloat precision);
Approximates the arc length using recursive adaptive subdivision.
precision— The maximum allowed error for curve flatness.
Point QuadraticBezier.Lerp(NFloat t)
public Point Lerp(nfloat t);
Evaluates the curve at parameter t using De Casteljau’s algorithm.
t— A normalized parameter in the range [0, 1].
Returns: The interpolated point on the curve.
Point QuadraticBezier.P0
public readonly Point P0;
The starting point of the curve.
Point QuadraticBezier.P1
public readonly Point P1;
The control point that influences the curvature of the segment.
Point QuadraticBezier.P2
public readonly Point P2;
The ending point of the curve.
MonotonicQuadraticBezier QuadraticBezier.SplitIntoYMonotonicCurves()
public MonotonicQuadraticBezier SplitIntoYMonotonicCurves();
Splits the current quadratic Bézier curve into two segments if it is not monotonic in the Y direction.
Returns: A Xui.Core.Curves2D.MonotonicQuadraticBezier instance containing one or two sub-curves, each guaranteed to be monotonic in Y. If the curve is already Y-monotonic (i.e., has no vertical extrema within (0,1)), a single-segment result is returned.
This method analyzes the derivative of the Y component of the curve to determine if a vertical extremum occurs within the curve's parameter domain. If a critical point is found in (0,1), the curve is split at that point to ensure each resulting segment is Y-monotonic. This is useful for scanline rasterization, tessellation, or other geometry processing that requires monotonic segments.
(QuadraticBezier, QuadraticBezier) QuadraticBezier.Subdivide(NFloat t)
public (QuadraticBezier, QuadraticBezier) Subdivide(nfloat t);
Subdivides this quadratic Bézier curve at parameter t, returning two curves.
Vector QuadraticBezier.Tangent(NFloat t)
public Vector Tangent(nfloat t);
Computes the tangent vector at parameter t.
t— A normalized parameter in the range [0, 1].
Returns: The tangent vector at the specified point.
QuadraticBezier.implicit operator QuadraticBezier((Point p0, Point p1, Point p2) value)
public static implicit operator QuadraticBezier((Point p0, Point p1, Point p2) value);
Converts a tuple of 3 points to a Xui.Core.Curves2D.QuadraticBezier.
QuadraticBezier.implicit operator QuadraticBezier(QuadraticSpline spline)
public static implicit operator QuadraticBezier(QuadraticSpline spline);
Converts a Xui.Core.Curves2D.QuadraticSpline to a Xui.Core.Curves2D.QuadraticBezier.
readonly struct QuadraticSpline
Represents a 3-point quadratic spline segment (parabolic arc) defined by a start point, control point, and end point.
This spline uses the De Casteljau algorithm for interpolation and arc length approximation. The curve passes through Xui.Core.Curves2D.QuadraticSpline.P0 and Xui.Core.Curves2D.QuadraticSpline.P2, with Xui.Core.Curves2D.QuadraticSpline.P1 acting as the control point that defines curvature.
public readonly struct QuadraticSpline : ICurve
{
public readonly Point P0;
public readonly Point P1;
public readonly Point P2;
public QuadraticSpline(Point p0, Point p1, Point p2);
public Point Lerp(nfloat t);
public Vector Tangent(nfloat t);
public nfloat Length();
public nfloat Length(nfloat precision);
public Point this[nfloat t] { get; }
public static implicit operator QuadraticBezier(QuadraticSpline s);
}
QuadraticSpline.QuadraticSpline(Point p0, Point p1, Point p2)
public QuadraticSpline(Point p0, Point p1, Point p2);
Initializes a new Xui.Core.Curves2D.QuadraticSpline with the given start, control, and end points.
Point QuadraticSpline.this[NFloat t]
public Point this[nfloat t] { get; }
Evaluates the point on the spline at parameter t.
NFloat QuadraticSpline.Length()
public nfloat Length();
Approximates the total arc length of the spline using a fixed 16-sample De Casteljau subdivision.
NFloat QuadraticSpline.Length(NFloat precision)
public nfloat Length(nfloat precision);
Approximates the arc length with adaptive subdivision using the specified precision tolerance.
precision— The maximum allowed error in the approximation.
Point QuadraticSpline.Lerp(NFloat t)
public Point Lerp(nfloat t);
Computes the point on the spline at parameter t using De Casteljau interpolation.
t— A normalized parameter between 0 and 1.
Point QuadraticSpline.P0
public readonly Point P0;
The start point of the spline.
Point QuadraticSpline.P1
public readonly Point P1;
The control point that defines the curvature of the arc.
Point QuadraticSpline.P2
public readonly Point P2;
The end point of the spline.
Vector QuadraticSpline.Tangent(NFloat t)
public Vector Tangent(nfloat t);
Computes the tangent vector at parameter t on the spline.
t— A normalized parameter between 0 and 1.
QuadraticSpline.implicit operator QuadraticBezier(QuadraticSpline s)
public static implicit operator QuadraticBezier(QuadraticSpline s);
Converts this spline to a Xui.Core.Curves2D.QuadraticBezier curve with the same control points.
readonly struct Segment
Represents a straight line segment from Xui.Core.Curves2D.Segment.P0 to Xui.Core.Curves2D.Segment.P1. Implements the Xui.Core.Curves2D.ICurve interface for compatibility with other curve types.
public readonly struct Segment : ICurve
{
public readonly Point P0;
public readonly Point P1;
public Segment(Point p0, Point p1);
public Point Lerp(nfloat t);
public Vector Tangent(nfloat t);
public Point this[nfloat t] { get; }
public nfloat Length();
public nfloat Length(nfloat precision);
public static implicit operator Segment((Point p0, Point p1) value);
}
Segment.Segment(Point p0, Point p1)
public Segment(Point p0, Point p1);
Initializes a new line from p0 to p1.
Point Segment.this[NFloat t]
public Point this[nfloat t] { get; }
Provides indexer access as an alias for Xui.Core.Curves2D.ICurve.Lerp(System.Runtime.InteropServices.NFloat).
NFloat Segment.Length()
public nfloat Length();
Computes an approximate arc length using 16 steps.
NFloat Segment.Length(NFloat precision)
public nfloat Length(nfloat precision);
Computes a refined approximation of arc length with a specified precision.
Point Segment.Lerp(NFloat t)
public Point Lerp(nfloat t);
Evaluates the curve at the given normalized parameter t in [0, 1].
Point Segment.P0
public readonly Point P0;
The starting point of the line segment.
Point Segment.P1
public readonly Point P1;
The ending point of the line segment.
Vector Segment.Tangent(NFloat t)
public Vector Tangent(nfloat t);
Computes the tangent vector at the specified t.
Segment.implicit operator Segment((Point p0, Point p1) value)
public static implicit operator Segment((Point p0, Point p1) value);
Converts a tuple to a Xui.Core.Curves2D.Segment.
class Spline
Provides factory methods for creating spline segments of various degrees.
public static class Spline
{
public static LinearSpline Linear(Point p0, Point p1);
public static QuadraticSpline Quadratic(Point p0, Point p1, Point p2);
public static CubicSpline Cubic(Point p0, Point p1, Point p2, Point p3);
}
CubicSpline Spline.Cubic(Point p0, Point p1, Point p2, Point p3)
public static CubicSpline Cubic(Point p0, Point p1, Point p2, Point p3);
Creates a cubic spline (degree 3) using Catmull–Rom interpolation through P1 and P2.
This produces a smooth segment influenced by surrounding control points p0 and p3.
LinearSpline Spline.Linear(Point p0, Point p1)
public static LinearSpline Linear(Point p0, Point p1);
Creates a linear spline (degree 1) between two points.
QuadraticSpline Spline.Quadratic(Point p0, Point p1, Point p2)
public static QuadraticSpline Quadratic(Point p0, Point p1, Point p2);
Creates a quadratic spline (degree 2) between three points.