Penetration

class Penetration(val edge: Segment, val depth: Double, val normal: Direction)

One polygon's resolved penetration into a region it may not occupy: the violated face, how deep, and the way out.

The single violation resolved by collide and escape; situations violating several faces at once converge by resolving and querying again. Displacing the subject by depth along normal resolves this penetration.

Constructors

Link copied to clipboard
constructor(edge: Segment, depth: Double, normal: Direction)

Properties

Link copied to clipboard

The penetration depth past edge — a raw Euclidean distance, positive at the SCALE quantum.

Link copied to clipboard

The violated face — always the queried polygon's own edge, never the subject's.

Link copied to clipboard

The correcting direction of the penetration — unit length, pointed out of the region the subject may not occupy: the queried polygon's solid region for collide, the complement of it for escape.

Functions

Link copied to clipboard
operator fun Penetration?.invoke(onPenetration: (Penetration) -> Unit): Penetration?

Penetration? { onPenetration } => Penetration?
Runs onPenetration on the penetration when there is one, and returns the receiver unchanged either way.

Link copied to clipboard
open override fun toString(): String

Returns the raw components — full stored precision, no rounding.