mirror of
https://github.com/storytold/cadcraft.git
synced 2026-10-24 10:56:51 -06:00
* fix(snap): keep an arc's sweep for TAN, PER and deferred snaps An arc was snapped as its full circle: TAN and PER solutions on the circle that fall outside the arc's sweep were offered as if they touched the arc, and a deferred tangent lost the sweep when it was stored. - SnapCurve gains an Arc variant carrying start and end, so a deferred snap keeps the sweep and resolves onto the arc. - TAN and PER filter their solutions with Arc::contains_angle; PER clamps to the arc with Arc::closest instead of the circle's closest point. - Tangents and perpendiculars between two deferred snaps are filtered on both ends. - The viewport projection maps the new variant. - Tests: a tangent in the gap is not offered, the perpendicular clamps to an end, and a deferred tangent keeps its sweep and solves onto the arc. Fixes #1697 * fix(snap): correct direct PER, support Arc in deferred pairs Addresses the review on #1698: - Direct PER on an arc used `arc.closest(bp)`, which clamps a gap solution to an end and misses the valid opposite antipode; both antipodes are now offered, filtered to the arc's sweep. - `deferred_pairs` matched only circles and lines, so any deferred pair with an arc operand fell through to None. An arc is now matched as its carrier circle for the math, with the sweep filter still applied to the solutions. - Tests: the direct PER case now expects the antipode on the arc, and a TAN-TAN pair between an arc and a circle only keeps the tangent on the arc. * test(snap): use a margin over the boundary in the arc PER test Addresses the review on #1698: the cursor is 5 units from the antipode, so the aperture is 5.5 rather than 5.0 to keep the distance comparison off the boundary; the comment now describes the antipode rather than the nearest end. * cargo fmt Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Brandon Thomas <echelon@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>