Table of Contents

Struct BezierCurve2

Namespace
Thunder.UnitsNET.Vectors.Geometry
Assembly
Thunder.UnitsNET.Vectors.Geometry.dll

A cubic Bézier curve defined by four LengthPoint2 control points.

The curve passes through P0 at t = 0 and P3 at t = 1. P1 and P2 are tangent guides — the curve is attracted to them but does not (in general) pass through them.

Use Evaluate(Ratio) for an exact position at a given curve parameter, and ToPath(int) to convert to an arc-length parameterised LengthPath2 for distance-based traversal.

public readonly record struct BezierCurve2 : IEquatable<BezierCurve2>
Implements
Inherited Members

Constructors

BezierCurve2(LengthPoint2, LengthPoint2, LengthPoint2, LengthPoint2)

A cubic Bézier curve defined by four LengthPoint2 control points.

The curve passes through P0 at t = 0 and P3 at t = 1. P1 and P2 are tangent guides — the curve is attracted to them but does not (in general) pass through them.

Use Evaluate(Ratio) for an exact position at a given curve parameter, and ToPath(int) to convert to an arc-length parameterised LengthPath2 for distance-based traversal.

public BezierCurve2(LengthPoint2 P0, LengthPoint2 P1, LengthPoint2 P2, LengthPoint2 P3)

Parameters

P0 LengthPoint2

Start point (curve passes through this at t = 0).

P1 LengthPoint2

First control point (tangent guide near start).

P2 LengthPoint2

Second control point (tangent guide near end).

P3 LengthPoint2

End point (curve passes through this at t = 1).

Properties

P0

Start point (curve passes through this at t = 0).

public LengthPoint2 P0 { get; init; }

Property Value

LengthPoint2

P1

First control point (tangent guide near start).

public LengthPoint2 P1 { get; init; }

Property Value

LengthPoint2

P2

Second control point (tangent guide near end).

public LengthPoint2 P2 { get; init; }

Property Value

LengthPoint2

P3

End point (curve passes through this at t = 1).

public LengthPoint2 P3 { get; init; }

Property Value

LengthPoint2

Methods

Evaluate(double)

Returns the world-space position on the curve at parameter t.

t = 0 returns P0; t = 1 returns P3. Values outside [0, 1] extrapolate beyond the endpoints.

public LengthPoint2 Evaluate(double t)

Parameters

t double

Curve parameter in [0, 1].

Returns

LengthPoint2

The interpolated world-space position.

Evaluate(Ratio)

Returns the world-space position on the curve at parameter t.

t = 0 returns P0; t = 1 returns P3. Values outside [0, 1] extrapolate beyond the endpoints.

public LengthPoint2 Evaluate(Ratio t)

Parameters

t Ratio

Curve parameter as a UnitsNet.Ratio (normalized 0–1).

Returns

LengthPoint2

The interpolated world-space position.

TangentAt(double)

Returns the forward direction (tangent) of the curve at parameter t.

public Direction2 TangentAt(double t)

Parameters

t double

Curve parameter in [0, 1].

Returns

Direction2

The unit tangent direction at that point on the curve.

TangentAt(Ratio)

Returns the forward direction (tangent) of the curve at parameter t.

public Direction2 TangentAt(Ratio t)

Parameters

t Ratio

Curve parameter as a UnitsNet.Ratio (normalized 0–1).

Returns

Direction2

The unit tangent direction at that point on the curve.

ToPath(int)

Returns a LengthPath2 that approximates this curve as a polyline with resolution + 1 uniformly-spaced waypoints.

public LengthPath2 ToPath(int resolution = 64)

Parameters

resolution int

Number of segments. Must be ≥ 1. Defaults to 64.

Returns

LengthPath2

A LengthPath2 approximating this curve.

v0.5.0 ▼