← Standard library

Line2

struct Line2
import Line2 from Wax;

A finite 2D line segment between start and end. Closest-point queries clamp to the segment; coincident endpoints represent a single point.

Geometry2D.wax:210

Members

startfield

public float2 start

The first endpoint.

Geometry2D.wax:214

endfield

public float2 end

The second endpoint.

Geometry2D.wax:218

constructorconstructor

public constructor (float2 start, float2 end)

Stores both endpoints.

Geometry2D.wax:223

lengthgetter

public get length() : float

The Euclidean distance between endpoints.

Geometry2D.wax:231

directiongetter

public get direction() : float2

The normalized end-minus-start vector, or zero for coincident endpoints.

Geometry2D.wax:238

ClosestPointmethod

public fn ClosestPoint(float2 point) : float2

Returns the closest point on the closed segment. Coincident endpoints return start.

Geometry2D.wax:246

DistanceTomethod

public fn DistanceTo(float2 point) : float

Returns the Euclidean distance to the closest point on the closed segment.

Geometry2D.wax:261

ToStringmethod

public fn ToString() : string

Provided by the compiler.

ToStringBuffermethod

public fn ToStringBuffer(StringBuilder builder) : int32

Provided by the compiler.