forked from 1b-agent/opencadstudio-upstream
refactor(snap): take an entity's snap points from its curve
Each entity built its own, and what they offered had drifted apart from what the geometry actually has: - An arc offered no quadrants at all. It now offers the ones its sweep covers, and no more. - A spline offered its control points as endpoints. For a control-point spline those are not on the curve, so the cursor landed in empty space beside the geometry. It now offers its two real ends and its midpoint, with the fit points — which are on the curve — still on offer. - An elliptical arc had no midpoint and no ends. A new SnapHint::Endpoint carries an end that cannot go in key_vertices. Consecutive entries there are taken to be joined by a straight segment and their midpoint offered, which is right for a line or a polyline and wrong for anything curved: an arc's two ends would also produce a snap out on the chord. Splines lose their key_vertices for the same reason — the chord between two fit points of a curvy spline does not run along it. A polyline's midpoints and arc-segment centres stay out of snap_pts deliberately. The engine already derives a chain's midpoints from its vertices, and a wire carrying a centre is treated as round elsewhere, which a polyline with one bulge in it is not. Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
1 parent
57661c5754
commit
b36e85e46e
6 files changed
+66
-51
No files matched your search
@@ -1026,6 +1026,7 @@ impl Snapper {
|
||||
SnapHint::Quadrant => SnapType::Quadrant,
|
||||
SnapHint::Insertion => SnapType::Insertion,
|
||||
SnapHint::Midpoint => SnapType::Midpoint,
|
||||
SnapHint::Endpoint => SnapType::Endpoint,
|
||||
};
|
||||
if self.is_on(snap_type) {
|
||||
try_pt(world, snap_type);
|
||||
|
||||
Reference in new issue
Block a user