Direction

class Direction(dx: Double, dy: Double) : FlatPoint

A free vector — magnitude and orientation with no position; the FlatPoint refinement guaranteed to lie at infinity.

The at-infinity flat point dx·e41 + dy·e42, its weight stored as exact 0.0 — not merely a value that rounds to zero at the SCALE quantum — so even the raw arithmetic of the operations cannot leak a position back in. A free vector doubles as a displacement: its length the distance, its orientation the heading. The refinement adds no data, only the guarantee: a direction and a plain FlatPoint carrying the same components are the same value and compare equal, in both directions (see FlatPoint.equals). FlatPoint.toDirection converts a computed flat point, admitting exactly the points at infinity.

Parameters

dx

The e41 component: the vector's x-extent.

dy

The e42 component: the vector's y-extent.

Constructors

Link copied to clipboard
constructor(dx: Double, dy: Double)

Builds the free vector (dx, dy); the zero direction is legal.

Properties

Link copied to clipboard

The heading of this free vector — its raw polar angle, measured counter-clockwise from the positive X direction, in (−180°, 180°].

Link copied to clipboard

The attitude, degenerate for a point — pure weight, no direction.

Link copied to clipboard

Whether this point lies at infinity — a free vector rather than a position.

Link copied to clipboard

The Euclidean magnitude √(px² + py²) — raw.

Link copied to clipboard
val px: Double

The e41 component — the Euclidean x-coordinate when finite.

Link copied to clipboard
val py: Double

The e42 component — the Euclidean y-coordinate when finite.

Link copied to clipboard
val pz: Double

The e43 weight — 1 when finite; rounds to 0 at infinity (kept raw).

Link copied to clipboard

This free vector as a Direction — the refinement carrying the at-infinity guarantee.

Link copied to clipboard

This position as a RoundPoint — the conformal lift.

Functions

Link copied to clipboard

FlatPoint contract RoundPoint => RoundPoint
Returns the flat point's position as a round point sized by minus the squared distance to the given point.

Link copied to clipboard
open override fun copy(flatPoint: FlatPoint): Direction

Returns this object rebuilt around the replacement geometry flatPoint — the hook the shape-preserving operations return through, re-establishing the at-infinity guarantee.

Link copied to clipboard

FlatPoint distanceTo FlatPoint => Double
Returns the raw Euclidean distance between the two points.

infix fun FlatPoint.distanceTo(line: Line): Double

FlatPoint distanceTo Line => Double
Returns the raw perpendicular distance from the point to the line.

FlatPoint distanceTo RoundPoint => Double
Returns the raw Euclidean distance between the flat point and the round point's position.

Link copied to clipboard
infix fun FlatPoint.dot(circle: Circle): Double

FlatPoint dot Circle => Double
Returns the raw point-against-circle probe: positive inside, zero on the circle, negative outside, for a finite point and a classic circle.

infix fun FlatPoint.dot(other: FlatPoint): Double

FlatPoint dot FlatPoint => Double
Returns the raw inner product of two flat points — zero when they coincide, −½·d² for finite points d apart.

infix fun FlatPoint.dot(line: Line): Double

FlatPoint dot Line => Double
Returns the line's equation evaluated at the point: zero when the point lies on the line, the raw signed distance to it otherwise.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean

Rounded identity: equal when every component matches at the SCALE quantum.

Link copied to clipboard
infix fun FlatPoint.expand(circle: Circle): Line

FlatPoint expand Circle => Line
Returns the line through the point and the circle's center.

infix fun FlatPoint.expand(line: Line): Line

FlatPoint expand Line => Line
Returns the line through the point perpendicular to the given line.

Link copied to clipboard
open override fun hashCode(): Int

Returns the hash of the rounded components, consistent with equals.

Link copied to clipboard
infix fun FlatPoint.join(other: FlatPoint): Line

FlatPoint join FlatPoint => Line
Returns the line through both points, oriented so its normal points to the left of the travel from this point to other.

infix fun FlatPoint.join(point: RoundPoint): Line

FlatPoint join RoundPoint => Line
Returns the line through the flat point and the round point.

Link copied to clipboard
operator fun Direction.minus(other: Direction): Direction

Direction - Direction => Direction
Returns the vector difference of the two free vectors: this displacement with other undone.

operator fun FlatPoint.minus(other: FlatPoint): Direction

FlatPoint - FlatPoint => Direction
Returns the free vector from other to this point: the displacement that carries other onto this point.

Link copied to clipboard
infix fun FlatPoint.on(polygon: Polygon): Boolean

FlatPoint on Polygon => Boolean
Returns whether the point lies on the polygon's boundary.

infix fun FlatPoint.on(segment: Segment): Boolean

FlatPoint on Segment => Boolean
Returns whether the point lies on the segment itself, endpoints included.

infix fun FlatPoint.on(circle: Circle): Boolean

FlatPoint on Circle => Boolean
Returns whether the point lies on the circle.

infix fun FlatPoint.on(line: Line): Boolean

FlatPoint on Line => Boolean
Returns whether the point lies on the line.

Link copied to clipboard
operator fun Direction.plus(other: Direction): Direction

Direction + Direction => Direction
Returns the vector sum of the two free vectors: both displacements applied together.

Link copied to clipboard
infix fun FlatPoint.project(segment: Segment): FlatPoint

FlatPoint project Segment => FlatPoint
Returns the point of the segment nearest to this point: the perpendicular foot when it falls within the segment, else the nearer endpoint.

infix fun FlatPoint.project(circle: Circle): Dipole

FlatPoint project Circle => Dipole
Returns the dipole where the circle crosses the radial line through the point.

infix fun FlatPoint.project(line: Line): FlatPoint

FlatPoint project Line => FlatPoint
Returns the point's perpendicular foot on the line.

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

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

Link copied to clipboard

Returns the components rounded at the SCALE quantum — the debug-output convention of every primitive.

Link copied to clipboard

-Direction => Direction
Returns the opposite free vector: the same length, reversed heading.