get

operator fun List<Segment>.get(side: RectSide): Segment

edges[RectSide] => Segment
Returns the edge that visually faces side's way, whatever the loop's pose or orientation.

A geometric lookup, not an index: the loop's winding is read off the edges themselves, each edge's outward normal derived from its carrier, and the edge whose outward normal points most nearly along side's direction — down for RectSide.BOTTOM, right for RectSide.RIGHT, up, left — is the answer, raw at full Double precision. On a freshly built Polygon.Rectangle the answers coincide with the ordinals (edges[BOTTOM] is edges[0]); after a motor, a mirror, or negation the lookup follows the visual side. The answer is unambiguous while the rectangle is tilted less than 45° — at exactly 45° two edges tie and the pick is arbitrary. Meaningful on a rectangle's Polygon.edges; any other closed loop is scanned all the same, answering its most side-facing edge. edges[RIGHT] spells the lookup.

Receiver

The edge loop to scan — a rectangle's Polygon.edges for the names to be truthful.

Return

The Segment facing side's way.

Parameters

side

The visual side whose edge to read.

Throws

When the list is empty.