Table of Contents

Struct LinearBezier

Namespace
Xui.Core.Curves2D
Assembly
Core.dll

Represents a linear Bézier curve, equivalent to a straight line between two points.

public readonly struct LinearBezier : ICurve
Implements
Inherited Members

Remarks

This is the simplest form of Bézier curve, defined by two points P0 and P1. It is often used for edges of polygonal paths or degenerate forms of higher-order Béziers.

Constructors

LinearBezier(Point, Point)

Initializes a new LinearBezier curve with the given start and end points.

public LinearBezier(Point p0, Point p1)

Parameters

p0 Point

The starting point.

p1 Point

The ending point.

Fields

P0

The start point of the curve.

public readonly Point P0

Field Value

Point

P1

The end point of the curve.

public readonly Point P1

Field Value

Point

Properties

this[NFloat]

Indexer-style access to the interpolated point at parameter t.

public Point this[NFloat t] { get; }

Parameters

t NFloat

Property Value

Point

Methods

Length()

Returns the exact length of the line segment.

public NFloat Length()

Returns

NFloat

Length(NFloat)

Returns the length of the line segment. This overload ignores the precision parameter.

public NFloat Length(NFloat precision)

Parameters

precision NFloat

Returns

NFloat

Lerp(NFloat)

Computes the point on the line at parameter t using linear interpolation.

public Point Lerp(NFloat t)

Parameters

t NFloat

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

Returns

Point

Tangent(NFloat)

Returns the constant tangent vector of the line segment.

public Vector Tangent(NFloat t)

Parameters

t NFloat

The curve parameter (ignored since the tangent is constant).

Returns

Vector

Operators

implicit operator LinearBezier((Point p0, Point p1))

Implicitly converts a tuple of two points into a LinearBezier.

public static implicit operator LinearBezier((Point p0, Point p1) value)

Parameters

value (Point p0, Point p1)

Returns

LinearBezier

implicit operator CubicBezier(LinearBezier)

Implicitly converts this LinearBezier to a CubicBezier curve. Intermediate control points are interpolated at 1/3 and 2/3 for smooth spacing.

public static implicit operator CubicBezier(LinearBezier linear)

Parameters

linear LinearBezier

Returns

CubicBezier

implicit operator QuadraticBezier(LinearBezier)

Implicitly converts this LinearBezier to a QuadraticBezier curve. The intermediate point is set to the midpoint for visual smoothness.

public static implicit operator QuadraticBezier(LinearBezier linear)

Parameters

linear LinearBezier

Returns

QuadraticBezier

implicit operator LinearBezier(LinearSpline)

Implicitly converts a LinearSpline to a LinearBezier.

public static implicit operator LinearBezier(LinearSpline spline)

Parameters

spline LinearSpline

Returns

LinearBezier