# Xui.Core.Curves2D

Assembly: **Xui.Core** · [C# declarations](index.cs) · [Assembly overview](../index.md)

## Types

- [`readonly struct Arc`](#api-f83183d396a4308c)
- [`readonly struct Arc3Point`](#api-f5d1f59cac155d8c)
- [`readonly struct ArcEndpoint`](#api-8256d3937061eb79)
- [`class Bezier`](#api-6f0a4721d3ec23d7)
- [`readonly struct CubicBezier`](#api-89d521afa77106f1)
- [`struct CubicBezier.SubcurveNode`](#api-6997dea7640aae23)
- [`readonly struct CubicSpline`](#api-be0f3e4591b4f614)
- [`interface ICurve`](#api-8d8c93a9c77408cf)
- [`readonly struct LinearBezier`](#api-2dfd3ec1cf7a9236)
- [`readonly struct LinearSpline`](#api-8cfb67ae8cb30752)
- [`readonly struct MonotonicArc3Point`](#api-79c3739095ba2b14)
- [`readonly struct MonotonicCubicBezier`](#api-c92b8350d85dd6f9)
- [`readonly struct MonotonicQuadraticBezier`](#api-4a47781d1af607b8)
- [`readonly struct QuadraticBezier`](#api-a20f8fcebabf2793)
- [`readonly struct QuadraticSpline`](#api-23561b566f7da338)
- [`readonly struct Segment`](#api-0d370c7667d8c88e)
- [`class Spline`](#api-fec9f8a21a996996)

<a id="api-f83183d396a4308c"></a>

## `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`](../xui-core-curves2d/index.md#api-d3936a92210cd982) to [`Xui.Core.Curves2D.Arc.EndAngle`](../xui-core-curves2d/index.md#api-4b80717defb8dec3), optionally applying rotation and winding direction.

```csharp
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);
}
```

<a id="api-864b4ccf090965c5"></a>

### [`Arc.Arc(Point center, NFloat rx, NFloat ry, NFloat rotation, NFloat startAngle, NFloat endAngle, Winding winding = Winding.ClockWise)`](#api-864b4ccf090965c5)


```csharp
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`](../xui-core-curves2d/index.md#api-f83183d396a4308c) with the given center, radii, rotation, angles, and winding direction.

- **`center`** — The center point of the arc&#39;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.

<a id="api-60d934bacf4cd2f6"></a>

### [`Point Arc.Center`](#api-60d934bacf4cd2f6)


```csharp
public readonly Point Center;
```

The center point of the arc&#39;s ellipse.

<a id="api-4b80717defb8dec3"></a>

### [`NFloat Arc.EndAngle`](#api-4b80717defb8dec3)


```csharp
public readonly nfloat EndAngle;
```

The angle (in radians) at which the arc ends, before rotation is applied.

<a id="api-ea4ffbbf01422a5c"></a>

### [`Point Arc.Evaluate(NFloat t)`](#api-ea4ffbbf01422a5c)


```csharp
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.

<a id="api-159796cfbcbef9bb"></a>

### [`Point Arc.EvaluateAtAngle(NFloat θ)`](#api-159796cfbcbef9bb)


```csharp
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 like `t`, but an absolute angle used in parametric arc equations.

**Returns:** The corresponding [`Xui.Core.Math2D.Point`](../xui-core-math2d/index.md#api-7dfbe8f77fb7adae) on the arc&#39;s ellipse at the given angle, after applying the arc&#39;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`](../xui-core-curves2d/index.md#api-152639daaff6f17e) and translated to [`Xui.Core.Curves2D.Arc.Center`](../xui-core-curves2d/index.md#api-60d934bacf4cd2f6). This method is useful when working directly with angle-based metrics like vertical extrema (e.g., θ = π/2 or 3π/2).

<a id="api-0cd06f04dfb296a1"></a>

### [`Point Arc.this[NFloat t]`](#api-0cd06f04dfb296a1)


```csharp
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.

<a id="api-02d4eba3286e76ad"></a>

### [`NFloat Arc.Length()`](#api-02d4eba3286e76ad)


```csharp
public nfloat Length();
```

Approximates the arc length using uniform sampling with 16 segments.

**Returns:** The approximate total arc length.

<a id="api-2e8b04a945f0fa15"></a>

### [`NFloat Arc.Length(NFloat flatness)`](#api-2e8b04a945f0fa15)


```csharp
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.

<a id="api-aeee86da21ded43f"></a>

### [`Point Arc.Lerp(NFloat t)`](#api-aeee86da21ded43f)


```csharp
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].

<a id="api-7475a0404926bbff"></a>

### [`NFloat Arc.RadiusX`](#api-7475a0404926bbff)


```csharp
public readonly nfloat RadiusX;
```

The horizontal radius of the arc.

<a id="api-8d1c310c85054f45"></a>

### [`NFloat Arc.RadiusY`](#api-8d1c310c85054f45)


```csharp
public readonly nfloat RadiusY;
```

The vertical radius of the arc.

<a id="api-152639daaff6f17e"></a>

### [`NFloat Arc.Rotation`](#api-152639daaff6f17e)


```csharp
public readonly nfloat Rotation;
```

The clockwise rotation (in radians) applied to the arc relative to the X axis.

<a id="api-d3936a92210cd982"></a>

### [`NFloat Arc.StartAngle`](#api-d3936a92210cd982)


```csharp
public readonly nfloat StartAngle;
```

The angle (in radians) at which the arc starts, before rotation is applied.

<a id="api-05f13a4db6059481"></a>

### [`NFloat Arc.SweepAngle`](#api-05f13a4db6059481)


```csharp
public nfloat SweepAngle { get; }
```

Gets the signed sweep angle of the arc, in radians. Adjusts automatically for the specified [`Xui.Core.Curves2D.Arc.Winding`](../xui-core-curves2d/index.md#api-58b0655bca06a95a).

<a id="api-c88dfa9f3720b641"></a>

### [`Vector Arc.Tangent(NFloat t)`](#api-c88dfa9f3720b641)


```csharp
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.

<a id="api-1aaf5daa6f0595e0"></a>

### [`void Arc.ToArc3Segments(Span<Arc3Point> buffer, out int count)`](#api-1aaf5daa6f0595e0)


```csharp
public void ToArc3Segments(Span<Arc3Point> buffer, out int count);
```

Splits this arc into a series of [`Xui.Core.Curves2D.Arc3Point`](../xui-core-curves2d/index.md#api-f5d1f59cac155d8c) segments, each spanning ≤ 90&#176; 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 to `buffer`.

This method ensures consistent arc tessellation by aligning segment edges with X or Y axes and bounding each by ≤ 90&#176;, suitable for round rects or shader-compatible curves.

<a id="api-f143292fb95ed07a"></a>

### [`ArcEndpoint Arc.ToEndpointArc()`](#api-f143292fb95ed07a)


```csharp
public ArcEndpoint ToEndpointArc();
```

Converts this arc to an endpoint-parameterized [`Xui.Core.Curves2D.ArcEndpoint`](../xui-core-curves2d/index.md#api-8256d3937061eb79) 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&#176;), 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`](../xui-core-curves2d/index.md#api-8256d3937061eb79) structure that approximates this arc using endpoint-based parametrization.

<a id="api-d3ffaa74ece2d9fe"></a>

### [`(ArcEndpoint, ArcEndpoint?) Arc.ToEndpointArcs()`](#api-d3ffaa74ece2d9fe)


```csharp
public (ArcEndpoint, ArcEndpoint? ) ToEndpointArcs();
```

Converts this arc to one or two endpoint-parameterized arcs, depending on the arc&#39;s sweep angle.

If the arc forms a complete or nearly complete circle (i.e., the sweep angle approaches &#177;360&#176; 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`](../xui-core-curves2d/index.md#api-8256d3937061eb79) is returned with appropriate flags set for direction and size.

**Returns:** A tuple of one or two [`Xui.Core.Curves2D.ArcEndpoint`](../xui-core-curves2d/index.md#api-8256d3937061eb79) 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, or `null` if the arc fits in a single segment.

<a id="api-58b0655bca06a95a"></a>

### [`Winding Arc.Winding`](#api-58b0655bca06a95a)


```csharp
public readonly Winding Winding;
```

Specifies whether the arc is drawn clockwise or counter-clockwise.


<a id="api-f5d1f59cac155d8c"></a>

## `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/index.md#api-e066ebe40471b316), [`Xui.Core.Curves2D.Arc3Point.P1`](../xui-core-curves2d/index.md#api-140e5b61d1967f37), and [`Xui.Core.Curves2D.Arc3Point.P2`](../xui-core-curves2d/index.md#api-3cc1255516d55bde). 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.

```csharp
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();
}
```

<a id="api-2f824246570249b9"></a>

### [`Arc3Point.Arc3Point(Point p0, Point p1, Point p2)`](#api-2f824246570249b9)


```csharp
public Arc3Point(Point p0, Point p1, Point p2);
```

Initializes a new [`Xui.Core.Curves2D.Arc3Point`](../xui-core-curves2d/index.md#api-f5d1f59cac155d8c) defined by three on-curve points.

<a id="api-d9e7c53dd96439f5"></a>

### [`Point Arc3Point.this[NFloat t]`](#api-d9e7c53dd96439f5)


```csharp
public Point this[nfloat t] { get; }
```

Provides indexer access as an alias for [`Xui.Core.Curves2D.ICurve.Lerp(System.Runtime.InteropServices.NFloat)`](../xui-core-curves2d/index.md#api-340b78f1ab945e75).

<a id="api-835613e1cd2b81f4"></a>

### [`NFloat Arc3Point.Length()`](#api-835613e1cd2b81f4)


```csharp
public nfloat Length();
```

Computes an approximate arc length using 16 steps.

<a id="api-aa6aea0ab4e3c4aa"></a>

### [`NFloat Arc3Point.Length(NFloat precision)`](#api-aa6aea0ab4e3c4aa)


```csharp
public nfloat Length(nfloat precision);
```

Computes a refined approximation of arc length with a specified precision.

<a id="api-bad29b7a53f0681b"></a>

### [`Point Arc3Point.Lerp(NFloat t)`](#api-bad29b7a53f0681b)


```csharp
public Point Lerp(nfloat t);
```

Evaluates the curve at the given normalized parameter t in [0, 1].

<a id="api-e066ebe40471b316"></a>

### [`Point Arc3Point.P0`](#api-e066ebe40471b316)


```csharp
public readonly Point P0;
```

The starting point of the arc.

<a id="api-140e5b61d1967f37"></a>

### [`Point Arc3Point.P1`](#api-140e5b61d1967f37)


```csharp
public readonly Point P1;
```

A point on the arc between [`Xui.Core.Curves2D.Arc3Point.P0`](../xui-core-curves2d/index.md#api-e066ebe40471b316) and [`Xui.Core.Curves2D.Arc3Point.P2`](../xui-core-curves2d/index.md#api-3cc1255516d55bde).

<a id="api-3cc1255516d55bde"></a>

### [`Point Arc3Point.P2`](#api-3cc1255516d55bde)


```csharp
public readonly Point P2;
```

The ending point of the arc.

<a id="api-a4b533bcfb602e3a"></a>

### [`MonotonicArc3Point Arc3Point.SplitIntoYMonotonicCurves()`](#api-a4b533bcfb602e3a)


```csharp
public MonotonicArc3Point SplitIntoYMonotonicCurves();
```

Splits the arc into one or two Y-monotonic [`Xui.Core.Curves2D.Arc3Point`](../xui-core-curves2d/index.md#api-f5d1f59cac155d8c) 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.

<a id="api-7d8822841324612f"></a>

### [`Vector Arc3Point.Tangent(NFloat t)`](#api-7d8822841324612f)


```csharp
public Vector Tangent(nfloat t);
```

Computes the tangent vector at the specified t.

<a id="api-2e0261095cf84241"></a>

### [`Arc? Arc3Point.ToCenterArc()`](#api-2e0261095cf84241)


```csharp
public Arc? ToCenterArc();
```

Converts this three-point arc into a center-based [`Xui.Core.Curves2D.Arc`](../xui-core-curves2d/index.md#api-f83183d396a4308c) if the arc is valid.

**Returns:** A valid [`Xui.Core.Curves2D.Arc`](../xui-core-curves2d/index.md#api-f83183d396a4308c) 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`](../xui-core-curves2d/index.md#api-0d370c7667d8c88e) from [`Xui.Core.Curves2D.Arc3Point.P0`](../xui-core-curves2d/index.md#api-e066ebe40471b316) to [`Xui.Core.Curves2D.Arc3Point.P2`](../xui-core-curves2d/index.md#api-3cc1255516d55bde).

<a id="api-fb9d73768b2eaa46"></a>

### [`ArcEndpoint? Arc3Point.ToEndpointArc()`](#api-fb9d73768b2eaa46)


```csharp
public ArcEndpoint? ToEndpointArc();
```

Converts this arc to an endpoint-based [`Xui.Core.Curves2D.ArcEndpoint`](../xui-core-curves2d/index.md#api-8256d3937061eb79) format, if valid.

<a id="api-62bff9e5ebab4d4a"></a>

### [`Arc3Point.implicit operator Arc3Point((Point p0, Point p1, Point p2) value)`](#api-62bff9e5ebab4d4a)


```csharp
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`](../xui-core-curves2d/index.md#api-f5d1f59cac155d8c).


<a id="api-8256d3937061eb79"></a>

## `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.

```csharp
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);
}
```

<a id="api-b251b780afeb11e7"></a>

### [`ArcEndpoint.ArcEndpoint(Point start, Point end, NFloat rx, NFloat ry, NFloat rotation, bool largeArc, Winding winding)`](#api-b251b780afeb11e7)


```csharp
public ArcEndpoint(Point start, Point end, nfloat rx, nfloat ry, nfloat rotation, bool largeArc, Winding winding);
```

Initializes a new [`Xui.Core.Curves2D.ArcEndpoint`](../xui-core-curves2d/index.md#api-8256d3937061eb79) 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).

<a id="api-e01fdf55388dfb23"></a>

### [`Point ArcEndpoint.End`](#api-e01fdf55388dfb23)


```csharp
public readonly Point End;
```

The end point of the arc.

<a id="api-c9f84890b86943c8"></a>

### [`Point ArcEndpoint.Evaluate(NFloat t)`](#api-c9f84890b86943c8)


```csharp
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.

<a id="api-0df9696a6338f78b"></a>

### [`Point ArcEndpoint.this[NFloat t]`](#api-0df9696a6338f78b)


```csharp
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.

<a id="api-a3cfa450fd7b2a1b"></a>

### [`bool ArcEndpoint.LargeArc`](#api-a3cfa450fd7b2a1b)


```csharp
public readonly bool LargeArc;
```

If true, the arc is the longer (greater than 180&#176;) of the two possible arcs between points.

<a id="api-07500f5f897e94ca"></a>

### [`NFloat ArcEndpoint.Length()`](#api-07500f5f897e94ca)


```csharp
public nfloat Length();
```

Approximates the arc length using uniform sampling with 16 segments.

**Returns:** The approximate total arc length.

<a id="api-621382b5f77c41b3"></a>

### [`NFloat ArcEndpoint.Length(NFloat flatness)`](#api-621382b5f77c41b3)


```csharp
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.

<a id="api-dad9763fcab14a64"></a>

### [`Point ArcEndpoint.Lerp(NFloat t)`](#api-dad9763fcab14a64)


```csharp
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].

<a id="api-64a5ba1b74b3dfb2"></a>

### [`NFloat ArcEndpoint.RadiusX`](#api-64a5ba1b74b3dfb2)


```csharp
public readonly nfloat RadiusX;
```

The horizontal radius of the arc.

<a id="api-8610b29971a95513"></a>

### [`NFloat ArcEndpoint.RadiusY`](#api-8610b29971a95513)


```csharp
public readonly nfloat RadiusY;
```

The vertical radius of the arc.

<a id="api-45b771a443aa8ac4"></a>

### [`NFloat ArcEndpoint.Rotation`](#api-45b771a443aa8ac4)


```csharp
public readonly nfloat Rotation;
```

The clockwise rotation (in radians) applied to the arc&#39;s ellipse relative to the X axis.

<a id="api-5f2bb22392440ba3"></a>

### [`Point ArcEndpoint.Start`](#api-5f2bb22392440ba3)


```csharp
public readonly Point Start;
```

The start point of the arc.

<a id="api-8c5d835f0288daf8"></a>

### [`Vector ArcEndpoint.Tangent(NFloat t)`](#api-8c5d835f0288daf8)


```csharp
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.

<a id="api-fdb25751c95a59b8"></a>

### [`void ArcEndpoint.ToArc3Segments(Span<Arc3Point> buffer, out int count)`](#api-fdb25751c95a59b8)


```csharp
public void ToArc3Segments(Span<Arc3Point> buffer, out int count);
```

Splits this arc into a series of [`Xui.Core.Curves2D.Arc3Point`](../xui-core-curves2d/index.md#api-f5d1f59cac155d8c) segments, each spanning ≤ 90&#176; 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 to `buffer`.

This method converts the arc into a center-based [`Xui.Core.Curves2D.Arc`](../xui-core-curves2d/index.md#api-f83183d396a4308c) representation, then delegates to its [`Xui.Core.Curves2D.Arc.ToArc3Segments(System.Span{Xui.Core.Curves2D.Arc3Point},System.Int32@)`](../xui-core-curves2d/index.md#api-1aaf5daa6f0595e0) method. Each resulting [`Xui.Core.Curves2D.Arc3Point`](../xui-core-curves2d/index.md#api-f5d1f59cac155d8c) segment spans ≤ 90&#176; and is safe for monotonic tessellation.

<a id="api-c32920b3783a52cf"></a>

### [`Arc ArcEndpoint.ToCenterArc()`](#api-c32920b3783a52cf)


```csharp
public Arc ToCenterArc();
```

Converts this endpoint-parameterized arc to a center-based [`Xui.Core.Curves2D.Arc`](../xui-core-curves2d/index.md#api-f83183d396a4308c).

**Returns:** A new [`Xui.Core.Curves2D.Arc`](../xui-core-curves2d/index.md#api-f83183d396a4308c) representing the same shape.

<a id="api-5bd7e1b0fc156278"></a>

### [`Winding ArcEndpoint.Winding`](#api-5bd7e1b0fc156278)


```csharp
public readonly Winding Winding;
```

The direction in which the arc is drawn (clockwise or counter-clockwise).


<a id="api-6f0a4721d3ec23d7"></a>

## `class Bezier`

Static helper methods for constructing B&#233;zier curves.

```csharp
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);
}
```

<a id="api-be98b62e9b0a138b"></a>

### [`CubicBezier Bezier.Cubic(Point p0, Point p1, Point p2, Point p3)`](#api-be98b62e9b0a138b)


```csharp
public static CubicBezier Cubic(Point p0, Point p1, Point p2, Point p3);
```

Creates a cubic B&#233;zier curve from four control points.

<a id="api-699b50bf27659303"></a>

### [`LinearBezier Bezier.Linear(Point p0, Point p1)`](#api-699b50bf27659303)


```csharp
public static LinearBezier Linear(Point p0, Point p1);
```

Creates a linear B&#233;zier curve from two points.

<a id="api-5e9ad151f2b5fcef"></a>

### [`QuadraticBezier Bezier.Quadratic(Point p0, Point p1, Point p2)`](#api-5e9ad151f2b5fcef)


```csharp
public static QuadraticBezier Quadratic(Point p0, Point p1, Point p2);
```

Creates a quadratic B&#233;zier curve from three control points.


<a id="api-89d521afa77106f1"></a>

## `readonly struct CubicBezier`

Represents a cubic B&#233;zier curve defined by four control points.

A cubic B&#233;zier curve provides smooth interpolation between [`Xui.Core.Curves2D.CubicBezier.P0`](../xui-core-curves2d/index.md#api-a46fb7d8199e585b) and [`Xui.Core.Curves2D.CubicBezier.P3`](../xui-core-curves2d/index.md#api-287fdf101d7596aa), influenced by the control points [`Xui.Core.Curves2D.CubicBezier.P1`](../xui-core-curves2d/index.md#api-15983c0e9457e2ce) and [`Xui.Core.Curves2D.CubicBezier.P2`](../xui-core-curves2d/index.md#api-3b31cd941cdc9c59). This is commonly used in vector graphics, animation timing, and layout paths.

```csharp
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);
    }
}
```

<a id="api-4048cd42f64a1961"></a>

### [`CubicBezier.CubicBezier(Point p0, Point p1, Point p2, Point p3)`](#api-4048cd42f64a1961)


```csharp
public CubicBezier(Point p0, Point p1, Point p2, Point p3);
```

Initializes a new cubic B&#233;zier curve with the specified control points.

<a id="api-b33c4c27b6a3d2be"></a>

### [`NFloat CubicBezier.ClosestT(Point target)`](#api-b33c4c27b6a3d2be)


```csharp
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`.

<a id="api-24e90a432d0100e4"></a>

### [`NFloat CubicBezier.ClosestT(Point target, NFloat precision)`](#api-24e90a432d0100e4)


```csharp
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 for `t` convergence. Smaller values yield more accurate results.

**Returns:** The `t` value where the curve is closest to `target` within the specified `precision`.

<a id="api-623509eea29dc132"></a>

### [`CubicBezier CubicBezier.Drag(NFloat t, Vector delta)`](#api-623509eea29dc132)


```csharp
public CubicBezier Drag(nfloat t, Vector delta);
```

Returns a new [`Xui.Core.Curves2D.CubicBezier`](../xui-core-curves2d/index.md#api-89d521afa77106f1) 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 at `t`.

**Returns:** A new [`Xui.Core.Curves2D.CubicBezier`](../xui-core-curves2d/index.md#api-89d521afa77106f1) 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.

<a id="api-3a68e1914ed1608c"></a>

### [`CubicBezier CubicBezier.DragAt(Point origin, Vector delta)`](#api-3a68e1914ed1608c)


```csharp
public CubicBezier DragAt(Point origin, Vector delta);
```

Returns a new cubic B&#233;zier curve with adjusted control points so the point on the curve nearest to `origin` is moved by `delta`.

<a id="api-63f598eb2d092eed"></a>

### [`CubicBezier CubicBezier.DragAt(Point origin, Vector delta, NFloat precision)`](#api-63f598eb2d092eed)


```csharp
public CubicBezier DragAt(Point origin, Vector delta, nfloat precision);
```

Returns a new cubic B&#233;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`.

<a id="api-8b433330c614c5c3"></a>

### [`Point CubicBezier.this[NFloat t]`](#api-8b433330c614c5c3)


```csharp
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].

<a id="api-ab673e5db1807dae"></a>

### [`NFloat CubicBezier.Length()`](#api-ab673e5db1807dae)


```csharp
public nfloat Length();
```

Approximates the arc length of the curve using uniform sampling with 16 segments.

<a id="api-4628eec0709662d2"></a>

### [`NFloat CubicBezier.Length(NFloat precision)`](#api-4628eec0709662d2)


```csharp
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.

<a id="api-5ab487cb17258244"></a>

### [`Point CubicBezier.Lerp(NFloat t)`](#api-5ab487cb17258244)


```csharp
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].

<a id="api-a46fb7d8199e585b"></a>

### [`Point CubicBezier.P0`](#api-a46fb7d8199e585b)


```csharp
public readonly Point P0;
```

The starting point of the curve.

<a id="api-15983c0e9457e2ce"></a>

### [`Point CubicBezier.P1`](#api-15983c0e9457e2ce)


```csharp
public readonly Point P1;
```

The first control point, influencing the curve near [`Xui.Core.Curves2D.CubicBezier.P0`](../xui-core-curves2d/index.md#api-a46fb7d8199e585b).

<a id="api-3b31cd941cdc9c59"></a>

### [`Point CubicBezier.P2`](#api-3b31cd941cdc9c59)


```csharp
public readonly Point P2;
```

The second control point, influencing the curve near [`Xui.Core.Curves2D.CubicBezier.P3`](../xui-core-curves2d/index.md#api-287fdf101d7596aa).

<a id="api-287fdf101d7596aa"></a>

### [`Point CubicBezier.P3`](#api-287fdf101d7596aa)


```csharp
public readonly Point P3;
```

The ending point of the curve.

<a id="api-9af86142d1f7d964"></a>

### [`QuadraticBezier CubicBezier.QuadraticApproximation`](#api-9af86142d1f7d964)


```csharp
public QuadraticBezier QuadraticApproximation { get; }
```

Returns a quadratic B&#233;zier that approximates this cubic by averaging the endpoint tangents. Suitable as a fast approximation when subdivision is not required.

<a id="api-7425cd0b4c74da2b"></a>

### [`MonotonicCubicBezier CubicBezier.SplitIntoYMonotonicCurves()`](#api-7425cd0b4c74da2b)


```csharp
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`](../xui-core-curves2d/index.md#api-c92b8350d85dd6f9).

<a id="api-59cad75e9340a0b3"></a>

### [`(CubicBezier, CubicBezier) CubicBezier.Subdivide(NFloat t)`](#api-59cad75e9340a0b3)


```csharp
public (CubicBezier, CubicBezier) Subdivide(nfloat t);
```

Subdivides this cubic B&#233;zier curve at parameter t, returning two curves.

<a id="api-392a8f30c89278f3"></a>

### [`Vector CubicBezier.Tangent(NFloat t)`](#api-392a8f30c89278f3)


```csharp
public Vector Tangent(nfloat t);
```

Computes the tangent vector of the curve at parameter `t`.

- **`t`** — A normalized parameter in the range [0, 1].

<a id="api-befff81020d7940b"></a>

### [`void CubicBezier.ToQuadratics(Span<QuadraticBezier> buffer, NFloat precision, out int count)`](#api-befff81020d7940b)


```csharp
public void ToQuadratics(Span<QuadraticBezier> buffer, nfloat precision, out int count);
```

Converts this cubic B&#233;zier curve into a sequence of Y-monotonic quadratic B&#233;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 to `buffer`.

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&#233;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.

<a id="api-09ae7e2c2853bb7c"></a>

### [`CubicBezier.implicit operator CubicBezier((Point p0, Point p1, Point p2, Point p3) value)`](#api-09ae7e2c2853bb7c)


```csharp
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`](../xui-core-curves2d/index.md#api-89d521afa77106f1).

- **`value`** — A tuple representing the start point, two control points, and end point.

<a id="api-bb460aea1ed57745"></a>

### [`CubicBezier.implicit operator CubicBezier(CubicSpline spline)`](#api-bb460aea1ed57745)


```csharp
public static implicit operator CubicBezier(CubicSpline spline);
```

Implicitly converts this cubic Catmull–Rom spline to a [`Xui.Core.Curves2D.CubicBezier`](../xui-core-curves2d/index.md#api-89d521afa77106f1).

Uses the canonical Catmull–Rom to B&#233;zier mapping, interpolating between P1 and P2.

<a id="api-7f7af728d5474cde"></a>

### [`CubicBezier.implicit operator CubicBezier(QuadraticBezier quadratic)`](#api-7f7af728d5474cde)


```csharp
public static implicit operator CubicBezier(QuadraticBezier quadratic);
```

Implicitly converts a [`Xui.Core.Curves2D.QuadraticBezier`](../xui-core-curves2d/index.md#api-a20f8fcebabf2793) to a [`Xui.Core.Curves2D.CubicBezier`](../xui-core-curves2d/index.md#api-89d521afa77106f1) using interpolation for smooth parameterization.

This conversion evaluates the quadratic B&#233;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.


<a id="api-6997dea7640aae23"></a>

## `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@)`](../xui-core-curves2d/index.md#api-befff81020d7940b). Each node holds a cubic segment, its quadratic approximation, and a flatness error measure.

```csharp
public struct SubcurveNode
{
    public CubicBezier Segment;
    public QuadraticBezier QuadraticBezierApproximation;
    public nfloat Precision;
    public ushort NextIndex;
    public SubcurveNode(CubicBezier segment, ushort nextIndex = 0);
}
```

<a id="api-755ea9ffca3e4edf"></a>

### [`SubcurveNode.SubcurveNode(CubicBezier segment, ushort nextIndex = 0)`](#api-755ea9ffca3e4edf)


```csharp
public SubcurveNode(CubicBezier segment, ushort nextIndex = 0);
```

Initializes a new node representing a quadratic approximation of a cubic B&#233;zier segment in a linked list.

- **`segment`** — The original cubic B&#233;zier segment.

- **`nextIndex`** — Index of the next node in the chain. Use 0 if this is the last node.

<a id="api-f21b305c7a4745ec"></a>

### [`ushort SubcurveNode.NextIndex`](#api-f21b305c7a4745ec)


```csharp
public ushort NextIndex;
```

Index of the next node in the linked chain; 0 indicates this is the last node.

<a id="api-0c2dae22df879a05"></a>

### [`NFloat SubcurveNode.Precision`](#api-0c2dae22df879a05)


```csharp
public nfloat Precision;
```

The maximum perpendicular deviation of the approximation from the original cubic.

<a id="api-0eda967b598273e3"></a>

### [`QuadraticBezier SubcurveNode.QuadraticBezierApproximation`](#api-0eda967b598273e3)


```csharp
public QuadraticBezier QuadraticBezierApproximation;
```

The quadratic B&#233;zier approximation of [`Xui.Core.Curves2D.CubicBezier.SubcurveNode.Segment`](../xui-core-curves2d/index.md#api-87171e218f70fa12).

<a id="api-87171e218f70fa12"></a>

### [`CubicBezier SubcurveNode.Segment`](#api-87171e218f70fa12)


```csharp
public CubicBezier Segment;
```

The cubic B&#233;zier segment represented by this node.


<a id="api-be0f3e4591b4f614"></a>

## `readonly struct CubicSpline`

Represents a 4-point spline segment using Catmull–Rom interpolation. The curve interpolates smoothly between [`Xui.Core.Curves2D.CubicSpline.P1`](../xui-core-curves2d/index.md#api-403d35ac58e14d19) and [`Xui.Core.Curves2D.CubicSpline.P2`](../xui-core-curves2d/index.md#api-22c4b25a1e6bb608).

Catmull–Rom splines are useful for generating smooth curves through a sequence of points with minimal configuration. This implementation produces a C&#185;-continuous cubic curve, influenced by neighboring control points [`Xui.Core.Curves2D.CubicSpline.P0`](../xui-core-curves2d/index.md#api-27921a110f019e8e) and [`Xui.Core.Curves2D.CubicSpline.P3`](../xui-core-curves2d/index.md#api-8c762aa33109c2b8). The segment can also be converted into a [`Xui.Core.Curves2D.CubicBezier`](../xui-core-curves2d/index.md#api-89d521afa77106f1) for drawing or compatibility.

```csharp
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);
}
```

<a id="api-62fc88d87fc8b3ec"></a>

### [`CubicSpline.CubicSpline(Point p0, Point p1, Point p2, Point p3)`](#api-62fc88d87fc8b3ec)


```csharp
public CubicSpline(Point p0, Point p1, Point p2, Point p3);
```

Initializes a new Catmull–Rom spline segment from four control points.

<a id="api-e6af998a80a81fcc"></a>

### [`Point CubicSpline.this[NFloat t]`](#api-e6af998a80a81fcc)


```csharp
public Point this[nfloat t] { get; }
```

Indexer-style access to evaluate the curve at a given parameter.

<a id="api-da2b97a97a1895a4"></a>

### [`NFloat CubicSpline.Length()`](#api-da2b97a97a1895a4)


```csharp
public nfloat Length();
```

Approximates the arc length of the curve using uniform sampling with 16 segments.

<a id="api-361d77d872949c4c"></a>

### [`NFloat CubicSpline.Length(NFloat precision)`](#api-361d77d872949c4c)


```csharp
public nfloat Length(nfloat precision);
```

Approximates the arc length using recursive adaptive subdivision.

- **`precision`** — The tolerance used to decide subdivision depth.

<a id="api-98d860dfe655195a"></a>

### [`Point CubicSpline.Lerp(NFloat t)`](#api-98d860dfe655195a)


```csharp
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].

<a id="api-27921a110f019e8e"></a>

### [`Point CubicSpline.P0`](#api-27921a110f019e8e)


```csharp
public readonly Point P0;
```

The control point before the start of the curve.

<a id="api-403d35ac58e14d19"></a>

### [`Point CubicSpline.P1`](#api-403d35ac58e14d19)


```csharp
public readonly Point P1;
```

The starting point of the interpolated segment.

<a id="api-22c4b25a1e6bb608"></a>

### [`Point CubicSpline.P2`](#api-22c4b25a1e6bb608)


```csharp
public readonly Point P2;
```

The ending point of the interpolated segment.

<a id="api-8c762aa33109c2b8"></a>

### [`Point CubicSpline.P3`](#api-8c762aa33109c2b8)


```csharp
public readonly Point P3;
```

The control point after the end of the curve.

<a id="api-d7b7f9e1ead84dcf"></a>

### [`Vector CubicSpline.Tangent(NFloat t)`](#api-d7b7f9e1ead84dcf)


```csharp
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].

<a id="api-52e378c7b031bcb9"></a>

### [`CubicSpline.implicit operator CubicBezier(CubicSpline s)`](#api-52e378c7b031bcb9)


```csharp
public static implicit operator CubicBezier(CubicSpline s);
```

Converts this Catmull–Rom spline segment to an equivalent [`Xui.Core.Curves2D.CubicBezier`](../xui-core-curves2d/index.md#api-89d521afa77106f1). The resulting curve interpolates between [`Xui.Core.Curves2D.CubicSpline.P1`](../xui-core-curves2d/index.md#api-403d35ac58e14d19) and [`Xui.Core.Curves2D.CubicSpline.P2`](../xui-core-curves2d/index.md#api-22c4b25a1e6bb608).


<a id="api-8d8c93a9c77408cf"></a>

## `interface ICurve`

Represents a common interface for evaluable 2D curves.

```csharp
public interface ICurve
{
    Point Lerp(nfloat t);
    Vector Tangent(nfloat t);
    Point this[nfloat t] { get; }

    nfloat Length();
    nfloat Length(nfloat precision);
}
```

<a id="api-a332872e99c2ac28"></a>

### [`Point ICurve.this[NFloat t]`](#api-a332872e99c2ac28)


```csharp
Point this[nfloat t] { get; }
```

Provides indexer access as an alias for [`Xui.Core.Curves2D.ICurve.Lerp(System.Runtime.InteropServices.NFloat)`](../xui-core-curves2d/index.md#api-340b78f1ab945e75).

<a id="api-bb7c0262351a4d11"></a>

### [`NFloat ICurve.Length()`](#api-bb7c0262351a4d11)


```csharp
nfloat Length();
```

Computes an approximate arc length using 16 steps.

<a id="api-56ffd8593063e4aa"></a>

### [`NFloat ICurve.Length(NFloat precision)`](#api-56ffd8593063e4aa)


```csharp
nfloat Length(nfloat precision);
```

Computes a refined approximation of arc length with a specified precision.

<a id="api-340b78f1ab945e75"></a>

### [`Point ICurve.Lerp(NFloat t)`](#api-340b78f1ab945e75)


```csharp
Point Lerp(nfloat t);
```

Evaluates the curve at the given normalized parameter t in [0, 1].

<a id="api-f8a98b796e367268"></a>

### [`Vector ICurve.Tangent(NFloat t)`](#api-f8a98b796e367268)


```csharp
Vector Tangent(nfloat t);
```

Computes the tangent vector at the specified t.


<a id="api-2dfd3ec1cf7a9236"></a>

## `readonly struct LinearBezier`

Represents a linear B&#233;zier curve, equivalent to a straight line between two points.

This is the simplest form of B&#233;zier curve, defined by two points [`Xui.Core.Curves2D.LinearBezier.P0`](../xui-core-curves2d/index.md#api-b94ca73885b62718) and [`Xui.Core.Curves2D.LinearBezier.P1`](../xui-core-curves2d/index.md#api-b04326b5dae1eeeb). It is often used for edges of polygonal paths or degenerate forms of higher-order B&#233;ziers.

```csharp
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);
}
```

<a id="api-533683e46ad00427"></a>

### [`LinearBezier.LinearBezier(Point p0, Point p1)`](#api-533683e46ad00427)


```csharp
public LinearBezier(Point p0, Point p1);
```

Initializes a new [`Xui.Core.Curves2D.LinearBezier`](../xui-core-curves2d/index.md#api-2dfd3ec1cf7a9236) curve with the given start and end points.

- **`p0`** — The starting point.

- **`p1`** — The ending point.

<a id="api-b5690fb8d24f1383"></a>

### [`Point LinearBezier.this[NFloat t]`](#api-b5690fb8d24f1383)


```csharp
public Point this[nfloat t] { get; }
```

Indexer-style access to the interpolated point at parameter `t`.

<a id="api-bc83204852a5e0e6"></a>

### [`NFloat LinearBezier.Length()`](#api-bc83204852a5e0e6)


```csharp
public nfloat Length();
```

Returns the exact length of the line segment.

<a id="api-e3abb9a29b657a46"></a>

### [`NFloat LinearBezier.Length(NFloat precision)`](#api-e3abb9a29b657a46)


```csharp
public nfloat Length(nfloat precision);
```

Returns the length of the line segment. This overload ignores the `precision` parameter.

<a id="api-70e4c642deaaf782"></a>

### [`Point LinearBezier.Lerp(NFloat t)`](#api-70e4c642deaaf782)


```csharp
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].

<a id="api-b94ca73885b62718"></a>

### [`Point LinearBezier.P0`](#api-b94ca73885b62718)


```csharp
public readonly Point P0;
```

The start point of the curve.

<a id="api-b04326b5dae1eeeb"></a>

### [`Point LinearBezier.P1`](#api-b04326b5dae1eeeb)


```csharp
public readonly Point P1;
```

The end point of the curve.

<a id="api-cfca080b1bb8c6cf"></a>

### [`Vector LinearBezier.Tangent(NFloat t)`](#api-cfca080b1bb8c6cf)


```csharp
public Vector Tangent(nfloat t);
```

Returns the constant tangent vector of the line segment.

- **`t`** — The curve parameter (ignored since the tangent is constant).

<a id="api-bf45f93eeb5e3710"></a>

### [`LinearBezier.implicit operator LinearBezier((Point p0, Point p1) value)`](#api-bf45f93eeb5e3710)


```csharp
public static implicit operator LinearBezier((Point p0, Point p1) value);
```

Implicitly converts a tuple of two points into a [`Xui.Core.Curves2D.LinearBezier`](../xui-core-curves2d/index.md#api-2dfd3ec1cf7a9236).

<a id="api-e1b89af199205fc2"></a>

### [`LinearBezier.implicit operator CubicBezier(LinearBezier linear)`](#api-e1b89af199205fc2)


```csharp
public static implicit operator CubicBezier(LinearBezier linear);
```

Implicitly converts this [`Xui.Core.Curves2D.LinearBezier`](../xui-core-curves2d/index.md#api-2dfd3ec1cf7a9236) to a [`Xui.Core.Curves2D.CubicBezier`](../xui-core-curves2d/index.md#api-89d521afa77106f1) curve. Intermediate control points are interpolated at 1/3 and 2/3 for smooth spacing.

<a id="api-b3429796c71ba7d9"></a>

### [`LinearBezier.implicit operator QuadraticBezier(LinearBezier linear)`](#api-b3429796c71ba7d9)


```csharp
public static implicit operator QuadraticBezier(LinearBezier linear);
```

Implicitly converts this [`Xui.Core.Curves2D.LinearBezier`](../xui-core-curves2d/index.md#api-2dfd3ec1cf7a9236) to a [`Xui.Core.Curves2D.QuadraticBezier`](../xui-core-curves2d/index.md#api-a20f8fcebabf2793) curve. The intermediate point is set to the midpoint for visual smoothness.

<a id="api-ed04309964549e6c"></a>

### [`LinearBezier.implicit operator LinearBezier(LinearSpline spline)`](#api-ed04309964549e6c)


```csharp
public static implicit operator LinearBezier(LinearSpline spline);
```

Implicitly converts a [`Xui.Core.Curves2D.LinearSpline`](../xui-core-curves2d/index.md#api-8cfb67ae8cb30752) to a [`Xui.Core.Curves2D.LinearBezier`](../xui-core-curves2d/index.md#api-2dfd3ec1cf7a9236).


<a id="api-8cfb67ae8cb30752"></a>

## `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`](../xui-core-curves2d/index.md#api-dfb67f6154424b9f) and [`Xui.Core.Curves2D.LinearSpline.P1`](../xui-core-curves2d/index.md#api-7bbbf5a02b5b82c1). It is the simplest form of spline, useful for polyline paths, control handles, and degenerate B&#233;zier cases.

```csharp
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);
}
```

<a id="api-e2ee3f57edc74e5d"></a>

### [`LinearSpline.LinearSpline(Point p0, Point p1)`](#api-e2ee3f57edc74e5d)


```csharp
public LinearSpline(Point p0, Point p1);
```

Initializes a new [`Xui.Core.Curves2D.LinearSpline`](../xui-core-curves2d/index.md#api-8cfb67ae8cb30752) segment between two points.

- **`p0`** — The starting point of the spline.

- **`p1`** — The ending point of the spline.

<a id="api-a9e81a88a59eb67a"></a>

### [`Point LinearSpline.this[NFloat t]`](#api-a9e81a88a59eb67a)


```csharp
public Point this[nfloat t] { get; }
```

Evaluates the point on the spline at the specified parameter.

<a id="api-242952e400266ccd"></a>

### [`NFloat LinearSpline.Length()`](#api-242952e400266ccd)


```csharp
public nfloat Length();
```

Returns the length of the segment.

<a id="api-8ef99aea4212e5f2"></a>

### [`NFloat LinearSpline.Length(NFloat precision)`](#api-8ef99aea4212e5f2)


```csharp
public nfloat Length(nfloat precision);
```

Returns the length of the segment. Precision is ignored for linear splines.

<a id="api-a388e343f3814cef"></a>

### [`Point LinearSpline.Lerp(NFloat t)`](#api-a388e343f3814cef)


```csharp
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.

<a id="api-dfb67f6154424b9f"></a>

### [`Point LinearSpline.P0`](#api-dfb67f6154424b9f)


```csharp
public readonly Point P0;
```

The starting point of the line segment.

<a id="api-7bbbf5a02b5b82c1"></a>

### [`Point LinearSpline.P1`](#api-7bbbf5a02b5b82c1)


```csharp
public readonly Point P1;
```

The ending point of the line segment.

<a id="api-c287975361aefcbc"></a>

### [`Vector LinearSpline.Tangent(NFloat t)`](#api-c287975361aefcbc)


```csharp
public Vector Tangent(nfloat t);
```

Gets the constant tangent vector of the line segment.

- **`t`** — A normalized parameter (unused, since the tangent is constant).

<a id="api-a8c4ddbbe0409e35"></a>

### [`LinearSpline.implicit operator LinearBezier(LinearSpline s)`](#api-a8c4ddbbe0409e35)


```csharp
public static implicit operator LinearBezier(LinearSpline s);
```

Converts this linear spline to a [`Xui.Core.Curves2D.LinearBezier`](../xui-core-curves2d/index.md#api-2dfd3ec1cf7a9236).


<a id="api-79c3739095ba2b14"></a>

## `readonly struct MonotonicArc3Point`

Represents one or two [`Xui.Core.Curves2D.Arc3Point`](../xui-core-curves2d/index.md#api-f5d1f59cac155d8c) segments that are each monotonic in the Y direction.

```csharp
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; }
}
```

<a id="api-686094a7efd9668b"></a>

### [`MonotonicArc3Point.MonotonicArc3Point(Arc3Point only)`](#api-686094a7efd9668b)


```csharp
public MonotonicArc3Point(Arc3Point only);
```

Creates a single-segment monotonic arc.

<a id="api-fc626b6e6136a03d"></a>

### [`MonotonicArc3Point.MonotonicArc3Point(Arc3Point first, Arc3Point second)`](#api-fc626b6e6136a03d)


```csharp
public MonotonicArc3Point(Arc3Point first, Arc3Point second);
```

Creates a two-segment Y-monotonic arc.

<a id="api-4191a95b7d687dd4"></a>

### [`Arc3Point MonotonicArc3Point.First`](#api-4191a95b7d687dd4)


```csharp
public readonly Arc3Point First;
```

The first monotonic segment.

<a id="api-139e647f14517170"></a>

### [`bool MonotonicArc3Point.IsSplit`](#api-139e647f14517170)


```csharp
public bool IsSplit { get; }
```

True if the arc was split into two segments.

<a id="api-1875a23834404a5e"></a>

### [`Arc3Point? MonotonicArc3Point.Second`](#api-1875a23834404a5e)


```csharp
public readonly Arc3Point? Second;
```

The optional second segment, if the arc was split.


<a id="api-c92b8350d85dd6f9"></a>

## `readonly struct MonotonicCubicBezier`

Holds one, two, or three Y-monotonic cubic B&#233;zier segments that together represent the result of splitting a single cubic at its Y-derivative roots.

```csharp
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);
}
```

<a id="api-0741e1ebb6463d5b"></a>

### [`MonotonicCubicBezier.MonotonicCubicBezier(CubicBezier first, CubicBezier? second = null, CubicBezier? third = null)`](#api-0741e1ebb6463d5b)


```csharp
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.

<a id="api-9980915ebcb0c10d"></a>

### [`CubicBezier MonotonicCubicBezier.First`](#api-9980915ebcb0c10d)


```csharp
public readonly CubicBezier First;
```

The first (and always present) Y-monotonic segment.

<a id="api-5f54a0a2f50b06ba"></a>

### [`CubicBezier? MonotonicCubicBezier.Second`](#api-5f54a0a2f50b06ba)


```csharp
public readonly CubicBezier? Second;
```

The second Y-monotonic segment, or `null` if the original had at most one Y-extremum.

<a id="api-6ec897f1a4e32b2e"></a>

### [`CubicBezier? MonotonicCubicBezier.Third`](#api-6ec897f1a4e32b2e)


```csharp
public readonly CubicBezier? Third;
```

The third Y-monotonic segment, or `null` if the original had fewer than two Y-extrema.


<a id="api-4a47781d1af607b8"></a>

## `readonly struct MonotonicQuadraticBezier`

Holds one or two Y-monotonic quadratic B&#233;zier segments that together represent a single quadratic curve split at its Y-extremum.

```csharp
public readonly struct MonotonicQuadraticBezier
{
    public readonly QuadraticBezier First;
    public readonly QuadraticBezier? Second;
    public MonotonicQuadraticBezier(QuadraticBezier first, QuadraticBezier? second = null);
}
```

<a id="api-87352bcc4c602913"></a>

### [`MonotonicQuadraticBezier.MonotonicQuadraticBezier(QuadraticBezier first, QuadraticBezier? second = null)`](#api-87352bcc4c602913)


```csharp
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.

<a id="api-2803926e3a2a5e3f"></a>

### [`QuadraticBezier MonotonicQuadraticBezier.First`](#api-2803926e3a2a5e3f)


```csharp
public readonly QuadraticBezier First;
```

The first (and always present) Y-monotonic segment.

<a id="api-9a448f306bc7afd0"></a>

### [`QuadraticBezier? MonotonicQuadraticBezier.Second`](#api-9a448f306bc7afd0)


```csharp
public readonly QuadraticBezier? Second;
```

The second Y-monotonic segment, or `null` if no split was needed.


<a id="api-a20f8fcebabf2793"></a>

## `readonly struct QuadraticBezier`

Represents a quadratic B&#233;zier curve defined by three control points.

A quadratic B&#233;zier curve smoothly interpolates between [`Xui.Core.Curves2D.QuadraticBezier.P0`](../xui-core-curves2d/index.md#api-28a3f22da3b7e412) and [`Xui.Core.Curves2D.QuadraticBezier.P2`](../xui-core-curves2d/index.md#api-4b85e8de595ea6d8). The curve is influenced by a single control point [`Xui.Core.Curves2D.QuadraticBezier.P1`](../xui-core-curves2d/index.md#api-12e7ae99341d49ee). Quadratic B&#233;ziers are widely used in vector graphics, font rendering, and easing functions.

```csharp
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);
}
```

<a id="api-68beea86986d78d0"></a>

### [`QuadraticBezier.QuadraticBezier(Point p0, Point p1, Point p2)`](#api-68beea86986d78d0)


```csharp
public QuadraticBezier(Point p0, Point p1, Point p2);
```

Initializes a new quadratic B&#233;zier curve with the specified control points.

<a id="api-22e23d56f393dd55"></a>

### [`NFloat QuadraticBezier.ClosestT(Point target)`](#api-22e23d56f393dd55)


```csharp
public nfloat ClosestT(Point target);
```

Finds the `t` value where the curve is closest to `target`. Uses uniform sampling across 16 points.

<a id="api-17508873e69ec9a9"></a>

### [`NFloat QuadraticBezier.ClosestT(Point target, NFloat precision)`](#api-17508873e69ec9a9)


```csharp
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`.

<a id="api-32a407b58d624521"></a>

### [`QuadraticBezier QuadraticBezier.Drag(NFloat t, Vector delta)`](#api-32a407b58d624521)


```csharp
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`](../xui-core-curves2d/index.md#api-28a3f22da3b7e412) and [`Xui.Core.Curves2D.QuadraticBezier.P2`](../xui-core-curves2d/index.md#api-4b85e8de595ea6d8) fixed.

<a id="api-4a7afe743a66fde6"></a>

### [`QuadraticBezier QuadraticBezier.DragAt(Point origin, Vector delta)`](#api-4a7afe743a66fde6)


```csharp
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.

<a id="api-7da1cef2d6a7e42c"></a>

### [`QuadraticBezier QuadraticBezier.DragAt(Point origin, Vector delta, NFloat precision)`](#api-7da1cef2d6a7e42c)


```csharp
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.

<a id="api-45b4a8494736d639"></a>

### [`Point QuadraticBezier.this[NFloat t]`](#api-45b4a8494736d639)


```csharp
public Point this[nfloat t] { get; }
```

Evaluates the point on the curve at the specified parameter.

<a id="api-52cfa880e8deb142"></a>

### [`NFloat QuadraticBezier.Length()`](#api-52cfa880e8deb142)


```csharp
public nfloat Length();
```

Approximates the arc length using uniform sampling over 16 segments.

**Returns:** The approximate total length of the curve.

<a id="api-dc2776e9bbaa0ee8"></a>

### [`NFloat QuadraticBezier.Length(NFloat precision)`](#api-dc2776e9bbaa0ee8)


```csharp
public nfloat Length(nfloat precision);
```

Approximates the arc length using recursive adaptive subdivision.

- **`precision`** — The maximum allowed error for curve flatness.

<a id="api-96c4d755a8d807c5"></a>

### [`Point QuadraticBezier.Lerp(NFloat t)`](#api-96c4d755a8d807c5)


```csharp
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.

<a id="api-28a3f22da3b7e412"></a>

### [`Point QuadraticBezier.P0`](#api-28a3f22da3b7e412)


```csharp
public readonly Point P0;
```

The starting point of the curve.

<a id="api-12e7ae99341d49ee"></a>

### [`Point QuadraticBezier.P1`](#api-12e7ae99341d49ee)


```csharp
public readonly Point P1;
```

The control point that influences the curvature of the segment.

<a id="api-4b85e8de595ea6d8"></a>

### [`Point QuadraticBezier.P2`](#api-4b85e8de595ea6d8)


```csharp
public readonly Point P2;
```

The ending point of the curve.

<a id="api-b3c694a944e3d6dc"></a>

### [`MonotonicQuadraticBezier QuadraticBezier.SplitIntoYMonotonicCurves()`](#api-b3c694a944e3d6dc)


```csharp
public MonotonicQuadraticBezier SplitIntoYMonotonicCurves();
```

Splits the current quadratic B&#233;zier curve into two segments if it is not monotonic in the Y direction.

**Returns:** A [`Xui.Core.Curves2D.MonotonicQuadraticBezier`](../xui-core-curves2d/index.md#api-4a47781d1af607b8) 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&#39;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.

<a id="api-bb6240ea3f86419c"></a>

### [`(QuadraticBezier, QuadraticBezier) QuadraticBezier.Subdivide(NFloat t)`](#api-bb6240ea3f86419c)


```csharp
public (QuadraticBezier, QuadraticBezier) Subdivide(nfloat t);
```

Subdivides this quadratic B&#233;zier curve at parameter t, returning two curves.

<a id="api-9056e3ed570441dd"></a>

### [`Vector QuadraticBezier.Tangent(NFloat t)`](#api-9056e3ed570441dd)


```csharp
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.

<a id="api-924af22b00bf3826"></a>

### [`QuadraticBezier.implicit operator QuadraticBezier((Point p0, Point p1, Point p2) value)`](#api-924af22b00bf3826)


```csharp
public static implicit operator QuadraticBezier((Point p0, Point p1, Point p2) value);
```

Converts a tuple of 3 points to a [`Xui.Core.Curves2D.QuadraticBezier`](../xui-core-curves2d/index.md#api-a20f8fcebabf2793).

<a id="api-7e797b6510911051"></a>

### [`QuadraticBezier.implicit operator QuadraticBezier(QuadraticSpline spline)`](#api-7e797b6510911051)


```csharp
public static implicit operator QuadraticBezier(QuadraticSpline spline);
```

Converts a [`Xui.Core.Curves2D.QuadraticSpline`](../xui-core-curves2d/index.md#api-23561b566f7da338) to a [`Xui.Core.Curves2D.QuadraticBezier`](../xui-core-curves2d/index.md#api-a20f8fcebabf2793).


<a id="api-23561b566f7da338"></a>

## `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`](../xui-core-curves2d/index.md#api-9ec1990b33e47280) and [`Xui.Core.Curves2D.QuadraticSpline.P2`](../xui-core-curves2d/index.md#api-d8f12386ad802426), with [`Xui.Core.Curves2D.QuadraticSpline.P1`](../xui-core-curves2d/index.md#api-91a426f13a13cb37) acting as the control point that defines curvature.

```csharp
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);
}
```

<a id="api-abd32f062792394a"></a>

### [`QuadraticSpline.QuadraticSpline(Point p0, Point p1, Point p2)`](#api-abd32f062792394a)


```csharp
public QuadraticSpline(Point p0, Point p1, Point p2);
```

Initializes a new [`Xui.Core.Curves2D.QuadraticSpline`](../xui-core-curves2d/index.md#api-23561b566f7da338) with the given start, control, and end points.

<a id="api-d11bef8c4865ac1a"></a>

### [`Point QuadraticSpline.this[NFloat t]`](#api-d11bef8c4865ac1a)


```csharp
public Point this[nfloat t] { get; }
```

Evaluates the point on the spline at parameter `t`.

<a id="api-caf5d34d98a9c2a5"></a>

### [`NFloat QuadraticSpline.Length()`](#api-caf5d34d98a9c2a5)


```csharp
public nfloat Length();
```

Approximates the total arc length of the spline using a fixed 16-sample De Casteljau subdivision.

<a id="api-3d755b428d1ef42d"></a>

### [`NFloat QuadraticSpline.Length(NFloat precision)`](#api-3d755b428d1ef42d)


```csharp
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.

<a id="api-8788cfdd58ba166e"></a>

### [`Point QuadraticSpline.Lerp(NFloat t)`](#api-8788cfdd58ba166e)


```csharp
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.

<a id="api-9ec1990b33e47280"></a>

### [`Point QuadraticSpline.P0`](#api-9ec1990b33e47280)


```csharp
public readonly Point P0;
```

The start point of the spline.

<a id="api-91a426f13a13cb37"></a>

### [`Point QuadraticSpline.P1`](#api-91a426f13a13cb37)


```csharp
public readonly Point P1;
```

The control point that defines the curvature of the arc.

<a id="api-d8f12386ad802426"></a>

### [`Point QuadraticSpline.P2`](#api-d8f12386ad802426)


```csharp
public readonly Point P2;
```

The end point of the spline.

<a id="api-8d5763dc9c1799e5"></a>

### [`Vector QuadraticSpline.Tangent(NFloat t)`](#api-8d5763dc9c1799e5)


```csharp
public Vector Tangent(nfloat t);
```

Computes the tangent vector at parameter `t` on the spline.

- **`t`** — A normalized parameter between 0 and 1.

<a id="api-66013a130d474de3"></a>

### [`QuadraticSpline.implicit operator QuadraticBezier(QuadraticSpline s)`](#api-66013a130d474de3)


```csharp
public static implicit operator QuadraticBezier(QuadraticSpline s);
```

Converts this spline to a [`Xui.Core.Curves2D.QuadraticBezier`](../xui-core-curves2d/index.md#api-a20f8fcebabf2793) curve with the same control points.


<a id="api-0d370c7667d8c88e"></a>

## `readonly struct Segment`

Represents a straight line segment from [`Xui.Core.Curves2D.Segment.P0`](../xui-core-curves2d/index.md#api-1a9574bc88dbd0f6) to [`Xui.Core.Curves2D.Segment.P1`](../xui-core-curves2d/index.md#api-aac611780f61ebef). Implements the [`Xui.Core.Curves2D.ICurve`](../xui-core-curves2d/index.md#api-8d8c93a9c77408cf) interface for compatibility with other curve types.

```csharp
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);
}
```

<a id="api-1aa2ecf1f5e98ab1"></a>

### [`Segment.Segment(Point p0, Point p1)`](#api-1aa2ecf1f5e98ab1)


```csharp
public Segment(Point p0, Point p1);
```

Initializes a new line from `p0` to `p1`.

<a id="api-027cf63eef9a2806"></a>

### [`Point Segment.this[NFloat t]`](#api-027cf63eef9a2806)


```csharp
public Point this[nfloat t] { get; }
```

Provides indexer access as an alias for [`Xui.Core.Curves2D.ICurve.Lerp(System.Runtime.InteropServices.NFloat)`](../xui-core-curves2d/index.md#api-340b78f1ab945e75).

<a id="api-754147c49b2282d4"></a>

### [`NFloat Segment.Length()`](#api-754147c49b2282d4)


```csharp
public nfloat Length();
```

Computes an approximate arc length using 16 steps.

<a id="api-9fa1d4cf2558e752"></a>

### [`NFloat Segment.Length(NFloat precision)`](#api-9fa1d4cf2558e752)


```csharp
public nfloat Length(nfloat precision);
```

Computes a refined approximation of arc length with a specified precision.

<a id="api-527db128cbe615e3"></a>

### [`Point Segment.Lerp(NFloat t)`](#api-527db128cbe615e3)


```csharp
public Point Lerp(nfloat t);
```

Evaluates the curve at the given normalized parameter t in [0, 1].

<a id="api-1a9574bc88dbd0f6"></a>

### [`Point Segment.P0`](#api-1a9574bc88dbd0f6)


```csharp
public readonly Point P0;
```

The starting point of the line segment.

<a id="api-aac611780f61ebef"></a>

### [`Point Segment.P1`](#api-aac611780f61ebef)


```csharp
public readonly Point P1;
```

The ending point of the line segment.

<a id="api-b706da9e618e3d63"></a>

### [`Vector Segment.Tangent(NFloat t)`](#api-b706da9e618e3d63)


```csharp
public Vector Tangent(nfloat t);
```

Computes the tangent vector at the specified t.

<a id="api-42fdbf8148bd8fae"></a>

### [`Segment.implicit operator Segment((Point p0, Point p1) value)`](#api-42fdbf8148bd8fae)


```csharp
public static implicit operator Segment((Point p0, Point p1) value);
```

Converts a tuple to a [`Xui.Core.Curves2D.Segment`](../xui-core-curves2d/index.md#api-0d370c7667d8c88e).


<a id="api-fec9f8a21a996996"></a>

## `class Spline`

Provides factory methods for creating spline segments of various degrees.

```csharp
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);
}
```

<a id="api-d940efc1e5b2f67f"></a>

### [`CubicSpline Spline.Cubic(Point p0, Point p1, Point p2, Point p3)`](#api-d940efc1e5b2f67f)


```csharp
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`.

<a id="api-4826e9eceeead911"></a>

### [`LinearSpline Spline.Linear(Point p0, Point p1)`](#api-4826e9eceeead911)


```csharp
public static LinearSpline Linear(Point p0, Point p1);
```

Creates a linear spline (degree 1) between two points.

<a id="api-07a9ec8e70f4ef6a"></a>

### [`QuadraticSpline Spline.Quadratic(Point p0, Point p1, Point p2)`](#api-07a9ec8e70f4ef6a)


```csharp
public static QuadraticSpline Quadratic(Point p0, Point p1, Point p2);
```

Creates a quadratic spline (degree 2) between three points.

