Skip to content

@technobuddha > library > Geometry > Line Segment

Function: normalizeLineSegment()

ts
function normalizeLineSegment(line: LineSegment): LineSegment;

Defined in: normalize-line-segment.ts:12

Returns a LineSegment where the point with the higher y-coordinate is always the starting point (x0, y0). If the original line's y1 is greater than y0, the line is returned as-is. Otherwise, the start and end points are swapped.

Parameters

ParameterTypeDescription
lineLineSegmentThe line segment to process.

Returns

LineSegment

A LineSegment with the topmost point as the starting point.