Line

open class Line : Primitive

An oriented infinite line in the plane, or a weighted line at infinity — the 2D line.

The grade-3 blade gx·e423 + gy·e431 + gz·e412, cutting the plane along gx·x + gy·y + gz = 0. The constructor unitizes by the gradient magnitude ‖(gx, gy)‖, so a finite line stores its unit normal in (gx, gy) and the origin's signed distance in gz. Orientation is data: −g cuts the same point set with the opposite orientation and equals distinguishes them (canonical for unoriented equivalence). A weight that rounds to zero leaves the line at infinity with all three components raw — at-infinity magnitudes are data, so Line(0, 0, 5) != Line(0, 0, 1). Components are stored raw at full Double precision; equals/hashCode compare rounded at the SCALE quantum.

Constructors

Link copied to clipboard
constructor(gx: Double, gy: Double, gz: Double)

Builds the line (gx, gy, gz), unitized and zero-sanitized.

Properties

Link copied to clipboard

The line's running direction as a free vector, 90° CCW from normal.

Link copied to clipboard
open val canonical: Line

The canonical representative of this line — useful for unoriented equivalence.

Link copied to clipboard
val gx: Double

The e423 component — the unit normal's x-component when finite.

Link copied to clipboard
val gy: Double

The e431 component — the unit normal's y-component when finite.

Link copied to clipboard
val gz: Double

The e412 component — the origin's signed distance when finite; the raw at-infinity magnitude otherwise.

Link copied to clipboard

Whether this line lies at infinity — a weighted horizon rather than a line in the plane.

Link copied to clipboard

The distance from the origin |gz| — raw.

Link copied to clipboard

The unit normal as a free vector — Direction (gx, gy).

Functions

Link copied to clipboard
infix fun Line.angleTo(other: Line): Angle

Line angleTo Line => Angle
Returns the signed angle turning this line's direction onto other's — counter-clockwise positive, in (−π, π].

Link copied to clipboard
infix fun Line.antiproject(dipole: Dipole): Circle

Line antiproject Dipole => Circle
Returns the circle through the dipole's endpoints incident with the line's crossing of their perpendicular bisector.

infix fun Line.antiproject(flatPoint: FlatPoint): Line

Line antiproject FlatPoint => Line
Returns the parallel to the line through the point.

infix fun Line.antiproject(point: RoundPoint): Line

Line antiproject RoundPoint => Line
Returns the parallel to the line through the point.

Link copied to clipboard
infix fun Line.contract(dipole: Dipole): RoundPoint

Line contract Dipole => RoundPoint
Returns the point where the line crosses the dipole's perpendicular bisector.

infix fun Line.contract(flatPoint: FlatPoint): RoundPoint

Line contract FlatPoint => RoundPoint
Returns the line's running direction as a point at infinity, weighted by the flat point.

infix fun Line.contract(point: RoundPoint): Dipole

Line contract RoundPoint => Dipole
Returns the dipole on the line centered at the point's perpendicular foot, its squared radius minus the squared distance to the line.

Link copied to clipboard
open fun copy(line: Line): Line

Returns this object rebuilt around the replacement geometry line — the hook the shape-preserving operations return through.

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

Rounded, orientation-sensitive identity: equal when every component matches at the SCALE quantum.

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 Line.intersects(polygon: Polygon): Boolean

Line intersects Polygon => Boolean
Returns whether the line reaches the polygon's solid region.

infix fun Line.intersects(segment: Segment): Boolean

Line intersects Segment => Boolean
Returns whether the line touches or crosses the segment.

Link copied to clipboard
infix fun Line.meet(segment: Segment): RoundPoint?

Line meet Segment => RoundPoint?
Returns the point where the line crosses the segment, or null when it misses.

infix fun Line.meet(circle: Circle): Dipole

Line meet Circle => Dipole
Returns the dipole of the two points where the line crosses the circle — imaginary when the line misses it.

infix fun Line.meet(dipole: Dipole): RoundPoint

Line meet Dipole => RoundPoint
Returns the point where the line crosses the dipole's carrier.

infix fun Line.meet(other: Line): FlatPoint

Line meet Line => FlatPoint
Returns the point where the two lines cross — at infinity along the shared direction when they are parallel.

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.