Skip to main content

Module construct2d

Module construct2d 

Source
Expand description

The classical 2D constructions: circles tangent to three entities, tangent lines, and bisector curves: the straightedge-and-compass repertoire, solved algebraically.

One linearization carries the whole tangency family. A circle with centre c and radius r is tangent to a target once a side is chosen, and with that side fixed every constraint is linear in (c, r, Q) where Q = |c|² − r²:

  • a target circle (cᵢ, rᵢ) on side sᵢ: Q − 2cᵢ·c − 2sᵢrᵢr = rᵢ² − |cᵢ|²;
  • a point is a zero-radius circle;
  • a line with unit normal n and offset d on side t: n·c − t·r = d, with no Q at all.

Three constraints give three linear equations in at most four unknowns; the solution family is a line, and re-imposing Q = |c|² − r² is a quadratic along it. Enumerating the sides, solving, and verifying every candidate against the literal tangency distances (the linearization can manufacture roots the geometry rejects) yields exactly the classical solution sets, Apollonius’s eight included.

Structs§

TangentCircle
One tangent circle, with its standing toward each target in order.

Enums§

Bisector2
The locus of points equidistant from two targets.
Placement
How a tangent circle stands to one of its targets.
Target2
An entity a construction can be tangent to, or equidistant from.

Functions§

bisector
The bisector of two targets: the equidistant locus, as the conic it is.
circles_of_radius_tangent_to_two
Circles of a fixed radius tangent to two targets: the same machinery with the radius row supplied.
circles_tangent_to_three
Circles tangent to all three targets: the Apollonius family and its degenerate relatives, every candidate verified against the literal tangency distances before it is returned.
lines_tangent_to_two_circles
The up-to-four lines tangent to two circles: the external pair where the circles lie on the same side, the internal pair where they straddle.