Package-level declarations

The transform tier: the versors that move shapes — Motor (rotations and translations, built by the T and R factories) and Flector (reflections and glide reflections, built by F and G) — applied with shape * versor and composed with versor * versor. The per-shape actions live in the primitives and composites subpackages; a receiver typed only as Shape moves through the same spelling — the Shape * Versor dispatch delegates to the per-shape actions, preserving the receiver's class.

The factory family

Versors are built by four factories over plain Euclidean and primitive inputs — the half coefficients of the versor representation stay inside the factories, so arguments are true distances, angles, and mirror lines.

FactoryResult
T(dx, dy)
T(direction)
the translating Motor — by (dx, dy), or by a Direction's free vector
R(center, angle)the Motor rotating counter-clockwise by the angle about the center
F(line)the Flector reflecting across the line
G(line, glide)the Flector reflecting across the line, then gliding glide units along it

Degenerate inputs: a mirror line at infinity throws DegenerateFlectorException; R about an at-infinity center degrades to a translator, throwing DegenerateMotorException only at a half-turn.

The composition family

Versors compose with * into the single versor performing the left operand's motion first, then the right's. Composition is exactly associative with the action, (u * A) * B == u * (A * B), so a stored composite motion behaves identically to chained applications. Every versor is stored unitized and unitization survives composition, so composing never throws.

PairingResult
Motor * MotorMotor — two rigid motions chain into one
Flector * FlectorMotor — the orientation flips cancel
Flector * Motor
Motor * Flector
Flector — one flip remains
Versor * VersorVersor — the dispatch for operands typed as Versor

Types

Link copied to clipboard
class Flector : Versor

A mirror motion of the plane — a reflection across a line, or a glide reflection along one — applied to a shape with *. Built by the F (reflection) and G (glide reflection) factories.

Link copied to clipboard
class Motor : Versor

A rigid motion of the plane — a rotation about a point, or a translation — applied to a shape with *. Built by the T (translation) and R (rotation) factories.

Link copied to clipboard
sealed interface Versor

Umbrella over the motion types applied to shapes with * — Motor (rotations and translations) and Flector (reflections and glide reflections).

Functions

Link copied to clipboard
fun F(line: Line): Flector

Builds the flector reflecting across line.

Link copied to clipboard
fun G(line: Line, glide: Double): Flector

Builds the flector reflecting across line and gliding glide units along it.

Link copied to clipboard
fun R(center: FlatPoint, angle: Angle): Motor

Builds the motor rotating counter-clockwise by angle about center.

Link copied to clipboard
fun T(direction: Direction): Motor

Builds the motor translating by direction — a free vector's magnitude and orientation taken as a displacement.

fun T(dx: Double, dy: Double): Motor

Builds the motor translating by (dx, dy).

Link copied to clipboard
operator fun <T : Shape> T.times(versor: Versor): T

Shape * Versor => Shape
Returns this shape moved by versor.

operator fun Flector.times(next: Flector): Motor

Flector * Flector => Motor
Returns the single motor performing this motion, then next's.

operator fun Flector.times(next: Motor): Flector

Flector * Motor => Flector
Returns the single flector performing this motion, then next's.

operator fun Motor.times(next: Flector): Flector

Motor * Flector => Flector
Returns the single flector performing this motion, then next's.

operator fun Motor.times(next: Motor): Motor

Motor * Motor => Motor
Returns the single motor performing this motion, then next's.

operator fun Versor.times(next: Versor): Versor

Versor * Versor => Versor
Returns the single versor performing this motion, then next's.