Package-level declarations

The algebra tier: infix operators over the shapes, returning geometry or Double raw at full precision (the segment-bounded meets return null on a miss) — scalar multiplication (*), the inner-product family (dot), join (join, the wedge ∧), meet (meet, the antiwedge ∨), and the two interior products: contraction (contract, the bulk contraction a ∨ b^★) and expansion (expand, the weight expansion a ∧ b^☆).

Scalar multiplication

The homogeneous * scales a flat point's components raw: a finite point comes back at the same position — the factor cancels on re-unitization — while a direction genuinely scales in magnitude.

PairingResult
FlatPoint * Doublethe scaled flat point, as the receiver's class — the same position when finite, a scaled direction at infinity

The dot family

Every dot function returns a raw Double and serves the same call-site purpose: incidence and signed distance/power probing. One rule covers all seven pairings: a flat point enters through its round representative, then same-grade operands take the strict inner product under the conformal metric 𝐆, and a point against a grade-3 object takes the scalar antiwedge pairing. Those are the only pairings the algebra gives a canonical scalar — exactly the family's coverage. The metric is the null pairing e3·e4 = −1, giving the sign convention A dot A = −radius² for every round or flat element.

PairingValue for finite operands
RoundPoint dot RoundPoint
FlatPoint dot FlatPoint
−½·d² for points d apart
FlatPoint dot Line
RoundPoint dot Line
0 when the point lies on the line; the signed Euclidean distance otherwise
FlatPoint dot Circle
RoundPoint dot Circle
½·(r² − d²) against a classic circle: positive inside, zero on, negative outside
Circle dot Circle½·(d² − r₁² − r₂²) for two classic circles — zero exactly on orthogonal circles

The circle identities take r² signed, so they extend to imaginary circles — an imaginary classic circle probes negative everywhere. An inside-out circle negates every component, so any dot against one negates. At-infinity operands degenerate the bilinear form to a directional pairing with no distance reading.

The join family

join is the wedge ∧: grades add, and two operands join into the higher-grade primitive through both. The cross-type pairings come in both operand orders, and the two spellings build the identical result.

PairingResult
FlatPoint join FlatPointthe Line through both points
FlatPoint join RoundPoint
RoundPoint join FlatPoint
the Line through both points
RoundPoint join RoundPointthe Dipole holding both points, first operand as start
Dipole join RoundPoint
RoundPoint join Dipole
the Circle through the dipole's endpoints and the point
Segment join RoundPoint
RoundPoint join Segment
the Circle through the segment's endpoints and the point

Degenerate inputs: coincident flat points collapse to the all-zero Line; coincident round points — or two at-infinity points with parallel directions — throw DegenerateDipoleException; a third point on the dipole's carrier throws DegenerateCircleException carrying the Line through the collinear points.

The meet family

meet is the antiwedge ∨: grades reduce, and two operands meet in the lower-grade primitive where they intersect.

PairingResult
Line meet Linethe FlatPoint where the lines cross; at infinity when parallel
Line meet Circle
Circle meet Line
the Dipole of the two crossing points — imaginary on a miss
Circle meet Circlethe Dipole of the two crossing points — imaginary when the circles don't touch
Line meet Dipolethe RoundPoint where the line crosses the dipole's carrier
Line meet Segment
Segment meet Line
the crossing RoundPoint, or null when it misses the segment
Segment meet Segmentthe crossing RoundPoint, or null when it misses either segment

Degenerate inputs: parallel lines meet at infinity; tangency yields a zero-radius Dipole centered at the tangent point (first-class, never an error); concentric circles meet in an at-infinity Dipole; coincident circles — or an all-zero line against a circle — collapse and throw DegenerateDipoleException.

The contract family

contract is the bulk contraction a ∨ b^★: grades reduce, and the result is contained in the higher-grade receiver and orthogonal to the argument contracted away.

PairingResult
Line contract RoundPointthe Dipole on the line centered at the point's perpendicular foot — imaginary off the line
Circle contract RoundPointthe Dipole where the circle crosses its radical axis with the point — imaginary on a miss
Line contract FlatPointthe line's running direction: an at-infinity RoundPoint
Circle contract FlatPointthe circle's tangent bearing at the point: an at-infinity RoundPoint
Line contract Dipolethe RoundPoint where the line crosses the endpoints' perpendicular bisector
Circle contract Dipolethe pairing RoundPoint on the endpoints' perpendicular bisector
Dipole contract RoundPointthe swap-circle's center as a RoundPoint, squared radius negated
FlatPoint contract RoundPointthe flat point's position, sized by minus the squared distance to the point

Degenerate inputs: a point at infinity collapses Line contract RoundPoint and throws DegenerateDipoleException; every RoundPoint-valued contraction is total — degenerate cases come back at infinity, kept raw.

The expand family

expand is the weight expansion a ∧ b^☆: grades raise, and the result contains the lower-grade receiver and is orthogonal to the argument expanded onto.

PairingResult
RoundPoint expand Linethe Dipole holding the point and its mirror image across the line
RoundPoint expand Circlethe Dipole holding the point and its inversion through the circle
RoundPoint expand Dipolethe Circle through the point swapping the endpoints under inversion
RoundPoint expand FlatPointthe Circle through the round point centered at the flat point
Dipole expand Linethe Circle through the endpoints, centered on the line
Dipole expand Circlethe Circle through the endpoints, crossing the circle at right angles
FlatPoint expand Linethe Line through the point perpendicular to the line
FlatPoint expand Circlethe Line through the point and the circle's center

Degenerate inputs: collapsed blades throw DegenerateDipoleException or DegenerateCircleException carrying the collapsed payload — a point at a circle's center (its inversion escapes to infinity), a point on the endpoints' perpendicular bisector (the swap-circle straightens into that mirror line), a carrier perpendicular to the target line (the circle straightens into the carrier). The Line-valued expansions never throw: they collapse to the all-zero line instead.

Functions

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

Circle contract Dipole => RoundPoint
Returns the round point pairing the circle against the dipole, on the endpoints' perpendicular bisector.

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

Circle contract FlatPoint => RoundPoint
Returns the circle's tangent direction at the point's bearing, as a point at infinity.

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

Circle contract RoundPoint => Dipole
Returns the dipole where the circle crosses the radical axis between it and the point.

Dipole contract RoundPoint => RoundPoint
Returns the center of the circle that swaps the dipole's endpoints through the point, carrying that circle's squared radius negated.

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

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
infix fun Circle.dot(other: Circle): Double

Circle dot Circle => Double
Returns the raw inner product of two circles — zero exactly when they cross at right angles.

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.

infix fun RoundPoint.dot(circle: Circle): Double

RoundPoint 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 RoundPoint.dot(line: Line): Double

RoundPoint 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.

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

RoundPoint dot RoundPoint => Double
Returns the raw inner product of two round points — zero when two finite positions coincide, −½·d² when they sit d apart.

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

Dipole expand Circle => Circle
Returns the circle through the dipole's endpoints that crosses the circle at right angles.

infix fun Dipole.expand(line: Line): Circle

Dipole expand Line => Circle
Returns the circle through the dipole's endpoints that crosses the line at right angles.

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.

infix fun RoundPoint.expand(circle: Circle): Dipole

RoundPoint expand Circle => Dipole
Returns the dipole holding the point and its inversion through the circle.

infix fun RoundPoint.expand(dipole: Dipole): Circle

RoundPoint expand Dipole => Circle
Returns the circle through the point whose inversion swaps the dipole's endpoints.

infix fun RoundPoint.expand(flatPoint: FlatPoint): Circle

RoundPoint expand FlatPoint => Circle
Returns the circle through the round point centered at the flat point.

infix fun RoundPoint.expand(line: Line): Dipole

RoundPoint expand Line => Dipole
Returns the dipole holding the point and its mirror image across the line.

Link copied to clipboard
infix fun Segment.join(point: RoundPoint): Circle

Segment join RoundPoint => Circle
Returns the circle through the segment's endpoints and point.

infix fun Dipole.join(point: RoundPoint): Circle

Dipole join RoundPoint => Circle
Returns the circle through the dipole's endpoints and point.

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.

infix fun RoundPoint.join(segment: Segment): Circle

RoundPoint join Segment => Circle
Returns the circle through the segment's endpoints and this point.

infix fun RoundPoint.join(dipole: Dipole): Circle

RoundPoint join Dipole => Circle
Returns the circle through the point and the dipole's endpoints.

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

RoundPoint join FlatPoint => Line
Returns the line through both points.

infix fun RoundPoint.join(other: RoundPoint): Dipole

RoundPoint join RoundPoint => Dipole
Returns the dipole holding both points — this point as Dipole.start, other as Dipole.end.

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

Segment meet Segment => RoundPoint?
Returns the point where the two segments cross, or null when they don't.

infix fun Segment.meet(line: Line): RoundPoint?

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

infix fun Circle.meet(other: Circle): Dipole

Circle meet Circle => Dipole
Returns the dipole of the two points where the circles cross — imaginary when they don't touch.

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

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

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
operator fun <T : FlatPoint> T.times(scalar: Double): T

FlatPoint * Double => FlatPoint
Returns this flat point with all three components multiplied by scalar.