feat(patterns): closed-form solvers for common mate patterns #27
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 the
patterns/module — analytical solvers for common constraint combinations that have closed-form geometric solutions, avoiding Newton-Raphson entirely for trivial subproblems.Context
Most real assemblies are dominated by a small set of recurring mate patterns (shaft-in-hole, planar contact, fixed lock). These patterns have exact analytical solutions computable in microseconds. By recognizing and solving them during decomposition, the numerical solver only handles genuinely complex subproblems. D-Cubed (Siemens) uses this same strategy — algebraic solutions where possible, variational methods only for simultaneous systems.
Depends on: #26 (decomposer — provides biconnected components to match against)
Design
Pattern matching interface
Initial patterns
1.
fixed_joint.py— Lock constraintFixedbetween 2 parts2.
shaft_in_hole.py— Coincident + ConcentricCoincident+ oneConcentric(or singleCylindrical)3.
planar_contact.py— Planar + Parallel (or single Planar)Planarconstraint (face-on-face), optionally withParallel4.
point_lock.py— Coincident (point-on-point)Coincidentconstraint between 2 partsTransform math utilities
All patterns need quaternion/transform operations:
transform_compose(a, b)— apply transform b in frame atransform_inverse(t)— inverse transformquat_multiply(q1, q2)— quaternion multiplication (w,x,y,z convention)quat_conjugate(q)— quaternion conjugateaxis_alignment_quat(from_axis, to_axis)— rotation aligning one axis to anotherThese should live in a shared
math_utils.pywithin the decomposition package.Tasks
PatternABC andPatternMatcherclassfixed_joint.pypatternshaft_in_hole.pypatternplanar_contact.pypatternpoint_lock.pypatternmath_utils.pywith transform/quaternion operationstests/decomposition/test_patterns.py:Acceptance criteria