Tangency is one of the most frequently used geometric relationships in CNC machining programs. Fillet arcs, tangent transitions between lines and circles, smooth blending curves — all depend on the tangency condition being satisfied exactly.
Understanding the mathematics of tangency helps you understand why XyzPilot requires explicit direction selectors, and why the results are always exact.
The Definition
A line is tangent to a circle at a point P if and only if:
- P lies on the circle circumference
- The line passes through P
- The line is perpendicular to the radius at P
Condition 3 is the key. The tangent line and the radius are perpendicular at the point of tangency. This is a fundamental property of circles — it follows directly from the definition of a circle as the set of all points equidistant from the centre.
The Tangency Condition
For a line ax + by + c = 0 and a circle with centre (cx, cy) and radius r, the tangency condition is:
dist(centre, line) = r
Where dist(centre, line) = |a·cx + b·cy + c| / √(a² + b²)
If the distance from the circle centre to the line equals the radius exactly, the line is tangent to the circle. If the distance is less than the radius, the line intersects the circle at two points. If the distance is greater, the line does not touch the circle.
Finding the Tangent Point
The tangent point is the perpendicular projection of the circle centre onto the tangent line:
- Draw a line from the circle centre perpendicular to the tangent line
- The point where this perpendicular meets the tangent line is the tangent point
- The distance from the centre to the tangent point equals the radius exactly
In XyzPilot, Point/Tanto,L,C computes this tangent point analytically — no iteration, no approximation.
Circle-to-Circle Tangency
Two circles are tangent to each other when they touch at exactly one point. There are two cases:
| Type | Condition | Description |
|---|---|---|
| External tangency | dist(centres) = r₁ + r₂ | Circles touch on the outside — neither is inside the other |
| Internal tangency | dist(centres) = |r₁ − r₂| | One circle is inside the other — they touch at one point on the inner boundary |
The tangent point lies on the line connecting the two centres, at distance r₁ from the first centre (or r₂ from the second).
Why Two Solutions Exist
From an external point, two tangent lines can be drawn to a circle. From a line, two circles of a given radius can be tangent to it — one on each side. This is why XyzPilot requires a direction selector for tangency operations.
The selector is not a limitation. It is the correct mathematical response to a problem that has two valid solutions. The selector forces you to make an explicit, informed choice — and records that choice permanently.
Tangency in CNC Profiles
In CNC machining programs, tangency is used to create smooth transitions between geometry entities:
- Fillet arcs — an arc tangent to two lines creates a smooth rounded corner
- Tangent line-to-arc transitions — a line tangent to an arc at its endpoint creates a smooth blend
- Arc-to-arc transitions — two arcs tangent to each other create a smooth curve
When the tangency condition is satisfied exactly, the toolpath is smooth. The cutter does not change direction abruptly at the transition point. The surface finish is consistent.
When the tangency condition is only approximately satisfied — as with numerical solvers — there is a small angular discontinuity at the transition. This produces a witness mark on the machined surface.