M3c: 2D bridging curve — cubic-Bezier G1 connector between sketch endpoints

Adds SketchEngine::make_bridge (4-pole cubic Bezier, G1-tangent to Line/Arc
endpoints, straight-line fallback for other types) emitted as the existing
BSpline SketchEntity — no new geometry type, no serialized-field change, golden
recipe fixture untouched. CadDocument::add_bridge appends it (non-parametric,
index-validated, throws on bad refs). MCP `bridge` method mirrors action_project.
4 new [CadDocument][bridge] tests; full kernel suite green (76 cases, 1280 asserts).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BVzKmX6Y1aEteit1HTXG4Q
This commit is contained in:
Tommaso Bianchi
2026-07-25 01:59:47 +02:00
co-authored by Claude Opus 4.8
parent 62d39fba27
commit 65caa2ea6e
6 changed files with 240 additions and 0 deletions
+15
View File
@@ -800,6 +800,21 @@ int CadDocument::add_project_edges(int source_body, const std::vector<int>& edge
return int(features.size()) - 1;
}
int CadDocument::add_bridge(int sketch_ref, int ent_a, int end_a, int ent_b, int end_b,
const std::string& name)
{
(void)name;
if (sketch_ref < 0 || sketch_ref >= int(features.size())
|| features[sketch_ref].type != CadFeatureType::Sketch)
throw std::runtime_error("bridge: sketch_ref must refer to a Sketch feature");
auto& ents = features[sketch_ref].entities;
if (ent_a < 0 || ent_a >= int(ents.size()) || ent_b < 0 || ent_b >= int(ents.size()))
throw std::runtime_error("bridge: entity index out of range in sketch");
SketchEntity br = SketchEngine::make_bridge(ents[ent_a], end_a, ents[ent_b], end_b);
ents.push_back(br);
return int(ents.size()) - 1;
}
int CadDocument::add_plane(int base, double offset, double angle_tilt, int axis,
const std::string& name)
{