Table of Contents

Struct Segment

Namespace
Xui.Core.Curves2D
Assembly
Core.dll

Represents a straight line segment from P0 to P1. Implements the ICurve interface for compatibility with other curve types.

public readonly struct Segment : ICurve
Implements
Inherited Members

Constructors

Segment(Point, Point)

Initializes a new line from p0 to p1.

public Segment(Point p0, Point p1)

Parameters

p0 Point
p1 Point

Fields

P0

The starting point of the line segment.

public readonly Point P0

Field Value

Point

P1

The ending point of the line segment.

public readonly Point P1

Field Value

Point

Properties

this[NFloat]

Provides indexer access as an alias for Lerp(NFloat).

public Point this[NFloat t] { get; }

Parameters

t NFloat

Property Value

Point

Methods

Length()

Computes an approximate arc length using 16 steps.

public NFloat Length()

Returns

NFloat

Length(NFloat)

Computes a refined approximation of arc length with a specified precision.

public NFloat Length(NFloat precision)

Parameters

precision NFloat

Returns

NFloat

Lerp(NFloat)

Evaluates the curve at the given normalized parameter t in [0, 1].

public Point Lerp(NFloat t)

Parameters

t NFloat

Returns

Point

Tangent(NFloat)

Computes the tangent vector at the specified t.

public Vector Tangent(NFloat t)

Parameters

t NFloat

Returns

Vector

Operators

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

Converts a tuple to a Segment.

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

Parameters

value (Point p0, Point p1)

Returns

Segment