coerceOn

infix fun <P : Polygon> P.coerceOn(support: Polygon): P

Polygon coerceOn Polygon => Polygon
Returns this polygon translated along the shortest straight path until it touches support, or this untouched when it already touches.

The equality constraint beside coerceOut and coerceIn: where those accept every pose that does not violate their region, this one accepts exactly the touching poses. A subject reaching into support's solid region is resolved through collide by the minimal position fix subject * T(normal * depth) — a translation along the penetration's correcting normal by its raw depth, landing exactly where coerceOut lands; a subject clear of it is drawn in through gap by the translation closing its shortest segment, subject * T(end - start). A touching subject has neither — both existence gates round at the SCALE quantum — and returns this itself. The support's orientation decides which side is solid, and with it where the subject comes to rest: on a classic support it rests against the loop from outside, on an inside-out one against the loop's inner wall. The overlapping half inherits collide's contract — sound for a convex loop on support, the subject convex too against a classic support, one penetration resolved per call, a subject violating several faces at once converging by coercing again; the separated half asks no convexity of either operand. The result is the receiver's own class — the translation returns through Polygon.copy.

Receiver

The subject polygon to rest on support.

Return

The translated polygon as the receiver's class, or this untouched when it already touches.

Parameters

support

The polygon whose oriented solid region the subject comes to rest against.

Type Parameters

P

The receiver's type, preserved in the result.

Throws

when the translation lands two consecutive vertices rounded-coincident at the SCALE quantum.