ickby wrote:Graph and numeric (iterative) is what freecads c++ based assembly solver uses. The reason for that is that an assembly problem forms a non-metric parameter space which is rather bad for numeric solvers. A pure numeric approach will never be very robust. That is what I learned during extending the 2d sketcher to 3d a few years ago. Actually it was pretty.much the same as Hamish's solver now, just with analytical gradients instead of numeric ones. Since then I work on the new graph based version, which goes forward pretty well, but only slowly because assembly module in itself is not likely to hit master any time soon.
Ickby is right on the money, a pure numeric solver for 3d constraint system is rather unstable.
At least in my case for the assembly2 wb, setting up the constraint problem solely as a system of non-linear equations, and then attempting to solving it via Newton method, did not work very well...
I ended up overhauling the assembly2 constraint solver system to what a graph and numeric solver does.
side note: is there perhaps a wikipedia page outlining these methods?.
The new assembly 2 constraint solver begins with an unconstrained or free system.
The degrees-of-freedom of this free system allow for all possible movements and rotations of the objects in the assembly.
Then for each constraint equation
- adjust those degrees-of-freedom to solve an constraint equation ( f(x) = 0 )
- determine new degrees-of-freedom (i.e. movements and rotations which can be made without violating the constraint equation added)
This works well for the standard assembly constraints (with no complex interactions), where the reduction of the degrees-of-system have analytical solutions.
However, for complex mechanics (cam, bar linkage systems, ...) the reductions of degrees-of-freedom needs to done numerically (not implemented [yet] in the assembly 2 work bench) and suppose will be rather slow.
If this difficulty in reducing degree-of-freedoms is a property of 3D constraints problem in general, or just to my approach, i do not know.
Those of you curious enough to have read this far, I sure would like to see a demo, have a look at the screen recording at