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.
| Pairing | Result |
|---|---|
FlatPoint * Double | the 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.
| Pairing | Value for finite operands |
|---|---|
RoundPoint dot RoundPointFlatPoint dot FlatPoint | −½·d² for points d apart |
FlatPoint dot LineRoundPoint dot Line | 0 when the point lies on the line; the signed Euclidean distance otherwise |
FlatPoint dot CircleRoundPoint 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.
| Pairing | Result |
|---|---|
FlatPoint join FlatPoint | the Line through both points |
FlatPoint join RoundPointRoundPoint join FlatPoint | the Line through both points |
RoundPoint join RoundPoint | the Dipole holding both points, first operand as start |
Dipole join RoundPointRoundPoint join Dipole | the Circle through the dipole's endpoints and the point |
Segment join RoundPointRoundPoint 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.
| Pairing | Result |
|---|---|
Line meet Line | the FlatPoint where the lines cross; at infinity when parallel |
Line meet CircleCircle meet Line | the Dipole of the two crossing points — imaginary on a miss |
Circle meet Circle | the Dipole of the two crossing points — imaginary when the circles don't touch |
Line meet Dipole | the RoundPoint where the line crosses the dipole's carrier |
Line meet SegmentSegment meet Line | the crossing RoundPoint, or null when it misses the segment |
Segment meet Segment | the 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.
| Pairing | Result |
|---|---|
Line contract RoundPoint | the Dipole on the line centered at the point's perpendicular foot — imaginary off the line |
Circle contract RoundPoint | the Dipole where the circle crosses its radical axis with the point — imaginary on a miss |
Line contract FlatPoint | the line's running direction: an at-infinity RoundPoint |
Circle contract FlatPoint | the circle's tangent bearing at the point: an at-infinity RoundPoint |
Line contract Dipole | the RoundPoint where the line crosses the endpoints' perpendicular bisector |
Circle contract Dipole | the pairing RoundPoint on the endpoints' perpendicular bisector |
Dipole contract RoundPoint | the swap-circle's center as a RoundPoint, squared radius negated |
FlatPoint contract RoundPoint | the 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.
| Pairing | Result |
|---|---|
RoundPoint expand Line | the Dipole holding the point and its mirror image across the line |
RoundPoint expand Circle | the Dipole holding the point and its inversion through the circle |
RoundPoint expand Dipole | the Circle through the point swapping the endpoints under inversion |
RoundPoint expand FlatPoint | the Circle through the round point centered at the flat point |
Dipole expand Line | the Circle through the endpoints, centered on the line |
Dipole expand Circle | the Circle through the endpoints, crossing the circle at right angles |
FlatPoint expand Line | the Line through the point perpendicular to the line |
FlatPoint expand Circle | the 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
Circle contract Dipole => RoundPoint
Returns the round point pairing the circle against the dipole, on the endpoints' perpendicular bisector.
Circle contract FlatPoint => RoundPoint
Returns the circle's tangent direction at the point's bearing, as a point at infinity.
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.
Line contract Dipole => RoundPoint
Returns the point where the line crosses the dipole's perpendicular bisector.
Line contract FlatPoint => RoundPoint
Returns the line's running direction as a point at infinity, weighted by the flat point.
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.
Circle dot Circle => Double
Returns the raw inner product of two circles — zero exactly when they cross at right angles.
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.
FlatPoint dot FlatPoint => Double
Returns the raw inner product of two flat points — zero when they coincide, −½·d² for finite points d apart.
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.
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.
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.
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.
Dipole expand Circle => Circle
Returns the circle through the dipole's endpoints that crosses the circle at right angles.
Dipole expand Line => Circle
Returns the circle through the dipole's endpoints that crosses the line at right angles.
FlatPoint expand Circle => Line
Returns the line through the point and the circle's center.
FlatPoint expand Line => Line
Returns the line through the point perpendicular to the given line.
RoundPoint expand Circle => Dipole
Returns the dipole holding the point and its inversion through the circle.
RoundPoint expand Dipole => Circle
Returns the circle through the point whose inversion swaps the dipole's endpoints.
RoundPoint expand FlatPoint => Circle
Returns the circle through the round point centered at the flat point.
RoundPoint expand Line => Dipole
Returns the dipole holding the point and its mirror image across the line.
Segment join RoundPoint => Circle
Returns the circle through the segment's endpoints and point.
Dipole join RoundPoint => Circle
Returns the circle through the dipole's endpoints and point.
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.
FlatPoint join RoundPoint => Line
Returns the line through the flat point and the round point.
RoundPoint join Segment => Circle
Returns the circle through the segment's endpoints and this point.
RoundPoint join Dipole => Circle
Returns the circle through the point and the dipole's endpoints.
RoundPoint join FlatPoint => Line
Returns the line through both points.
RoundPoint join RoundPoint => Dipole
Returns the dipole holding both points — this point as Dipole.start, other as Dipole.end.
Segment meet Segment => RoundPoint?
Returns the point where the two segments cross, or null when they don't.
Segment meet Line => RoundPoint?
Returns the point where the line crosses the segment, or null when it misses.
Circle meet Circle => Dipole
Returns the dipole of the two points where the circles cross — imaginary when they don't touch.
Circle meet Line => Dipole
Returns the dipole of the two points where the circle crosses the line — imaginary when they miss.
Line meet Segment => RoundPoint?
Returns the point where the line crosses the segment, or null when it misses.
Line meet Circle => Dipole
Returns the dipole of the two points where the line crosses the circle — imaginary when the line misses it.
Line meet Dipole => RoundPoint
Returns the point where the line crosses the dipole's carrier.
Line meet Line => FlatPoint
Returns the point where the two lines cross — at infinity along the shared direction when they are parallel.