feat(graph): constraint graph builder from SolveContext #24
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Implement
constraint_graph.py— the bridge between the KCSolve API types and the graph library. Translates aSolveContext(parts + constraints) into a weighted igraph graph using the body-bar-hinge model.Context
The body-bar-hinge model maps 1:1 to how CAD assemblies actually work: each assembly part is a rigid body (6 DOF in 3D), each joint is a set of bars/hinges connecting two bodies. Crucially, Tay's theorem (1984) provides a complete combinatorial rigidity characterization for body-bar-hinge frameworks in all dimensions — sidestepping the 3D Laman gap that defeats bar-joint models.
Depends on: #23 (scaffolding)
Design
Graph construction
SolveContext.partsdof_weight: 6 for free bodies, 0 for grounded partspart_id: string ID fromPart.idSolveContext.constraintsconstraint_weight: DOF removed by this joint typeconstraint_id: string ID fromConstraint.idjoint_kind: theBaseJointKindenum valuepart_i→part_jDOF weight table (all 24 BaseJointKind values)
API
Tasks
ConstraintGraphclass insolver/decomposition/constraint_graph.pyBaseJointKindvaluestests/decomposition/test_graph.py:Acceptance criteria
ConstraintGraph.from_context(ctx)produces correct igraph graph for all test fixtures