Algorithm Search⌘K

Techniquecore

Degrees of freedom analysis

Also called DOF analysis, Kramer degree of freedom analysis.

Kramer's method that counts the freedoms of bodies and those that each constraint removes, and solves the system by a plan of steps that each fix some freedoms.

Degrees of freedom analysis decides how a constraint system can be solved by counting freedoms, before it computes any coordinate. Each entity has some degrees of freedom (DOF), each constraint removes some, and a rigid part keeps exactly the DOF of a rigid motion. The counts on the constraint graph find the parts that are rigid by themselves, the parts that are over-constrained and the parts that are still free, and a solver then handles each part in turn. Kramer (1992) made this a solver for assemblies and mechanisms: each body keeps a record of its translational and rotational freedoms, and each constraint is satisfied by an action, a translation or a rotation computed in closed form, that removes some of them. Hoffmann, Lomonosov and Sitharam found the over-constrained and rigid subsystems of any weighted graph with network flows. The counts are fast and exact as counts, but they see only the graph: a system with dependent constraints can pass every count and still be wrong.

In plain words

A part lying free on a table can slide in two directions and turn, so it has three freedoms. A rule such as "this corner touches that edge" takes away one freedom. If you add up the freedoms of all the parts and take away what the rules remove, you can tell, before you compute anything, whether the drawing can still move, is just fixed, or has too many rules.

The count must hold for every group of parts, not only for the whole drawing. One small group can have too many rules while another group is still loose, and the total looks right. The method checks the groups one at a time with a flow of "rule weight" into the parts. And the count can be fooled: two rules that say the same thing in different words remove fewer freedoms than they seem to.

When it applies

  • Each entity has a known number of DOF w(v)w(v), and each constraint a known weight w(e)w(e), the number of independent equations it adds. The tables are on the page on geometric constraints.
  • A rigid part keeps KK DOF: K=3K = 3 in the plane, K=6K = 6 in space, or less when the part is fixed to the ground.
  • The question is structural: which subsets are well-constrained, over-constrained or free for generic values. For points and distances in the plane the answer is exact by Laman's theorem; otherwise it is a necessary condition, as the page on well-constrained systems explains.
  • For Kramer's action form, the system is made of rigid bodies with markers (a point and two axes on each body), joined by constraints between markers, as in kinematic pairs.

The template

The density of a set SS of entities is ρ(S)=w(E(S))−w(S)\rho(S) = w(E(S)) - w(S), where E(S)E(S) is the set of constraints with all their entities in SS. A set is dense when ρ(S)>−K\rho(S) > -K. The template finds a dense set by flows, adding the constraints one at a time.

  1. DOF-ANALYSIS(V, E, w, K)
  2. 1N ← network with a node per entity v (arc v → t, capacity w(v)) and a node per constraint
  3. 2for each constraint e, in ⟨ORDER⟩ do
  4. 3add arcs s → e (capacity w(e) + K) and e → each entity of e (capacity ∞)
  5. 4push flow from s through e until the flow from s to e is w(e) + K, or no path is left
  6. 5if the flow from s to e is less than w(e) + K then
  7. 6S ← the entities reachable from e in the residual network
  8. 7⟨ON-DENSE(S)⟩ ▷ S is dense and holds e
  9. 8lower the capacity of s → e to w(e), and return the extra flow of K
  10. 9return the flow, and the dense sets found

The holes are these.

  • ORDER. Any order finds a dense set when one exists, since a dense set becomes dense when its last constraint is added. The order changes which dense set is found first.
  • K. The slack for rigid motions: 3 in the plane. Use K+1K + 1 to find sets with ρ(S)≥−K\rho(S) \ge -K, the well-constrained ones, which are the rigid clusters.
  • ON-DENSE(S). Report SS as over-constrained and drop ee; or, in a decomposition, treat SS as one rigid cluster, contract it, and go on. The second choice is the step of a DR-plan.

Why the flow finds dense sets. The flow sends the weight of each constraint to its entities, and an entity can absorb at most its DOF. By the max-flow min-cut theorem, all weight on a set FF of constraints can be absorbed if and only if w(F′)≤w(N(F′))w(F') \le w(N(F')) for every F′⊆FF' \subseteq F, where N(F′)N(F') is the set of entities of F′F'; this is Hall's condition with weights. With the extra KK on the new constraint ee, the flow fails exactly when some set FF of constraints with e∈Fe \in F has w(F)+K>w(N(F))w(F) + K > w(N(F)), that is, when S=N(F)S = N(F) has ρ(S)>−K\rho(S) > -K. The entities reached from ee in the residual network after the failure are such a set. Each test pushes w(e)+Kw(e) + K units, each by one search of the network, so the whole run costs O(m(wmax⁡+K)(n+m))O(m (w_{\max} + K)(n + m)) for nn entities and mm constraints. For bars in the plane (w(v)=2w(v) = 2, w(e)=1w(e) = 1, K=3K = 3) this is the pebble game.

Example. Take points P,QP, Q and lines L,ML, M in the plane, all with w=2w = 2, and six constraints of weight 1, added in this order: PP on LL, QQ on LL, ∣PQ∣=5\lvert PQ \rvert = 5, LL parallel to MM, distance from PP to MM is 2, distance from QQ to MM is 2.

constraint added demand from ss max flow dense set found
PP on LL 4 4 none
QQ on LL 5 5 none
∣PQ∣\lvert PQ \rvert 6 6 none
L∥ML \parallel M 7 7 none
d(P,M)d(P, M) 8 8 none
d(Q,M)d(Q, M) 9 8 {P,Q,L,M}\{P, Q, L, M\}, ρ=6−8=−2\rho = 6 - 8 = -2

The last constraint makes the whole set dense. The geometry agrees: PP and QQ lie on LL, and LL is parallel to MM, so QQ has the same distance to MM as PP. The last constraint is redundant when its value is 2 and in conflict for any other value.

Classic examples

  • Kramer's solver. Kramer's solver handles linkages and assemblies by DOF analysis. Each body starts with 3 translational and 3 rotational DOF. For each pair of constraint type and current DOF state, a plan fragment gives an action, such as "translate the body so that the two markers meet" or "rotate it about this axis so that the two axes are parallel", and the new DOF state. The solver picks constraints that some action can satisfy, applies the action, and records the step in a plan. Each action is a closed-form computation, so the plan runs again fast when the dimensions change.
  • The Maxwell and Grübler counts. The Maxwell counting rule for frameworks and the Grübler formula for mechanisms, M=3(n−1)−2j1−j2M = 3(n - 1) - 2j_1 - j_2 in the plane with nn links, j1j_1 joints of one freedom and j2j_2 joints of two, are the count on the whole system. A slider-crank (ground, crank, coupler and slider, with 3 revolute joints and 1 prismatic joint) has M=3⋅3−2⋅4=1M = 3 \cdot 3 - 2 \cdot 4 = 1.
  • Dense sets by flows. The flow template above, in the form of Hoffmann, Lomonosov and Sitharam, finds the rigid and the over-constrained subsystems of a general weighted graph. It is the first step of the DR-plan.
  • The pebble game. For bars and joints in the plane the same test becomes the pebble game, which also gives the rigid components.
  • Assemblies. In assembly constraint solving, each part has 6 DOF, and the count decides which groups of parts are fixed relative to each other.

Variations

  • Count only. Compare w(V)−w(E)w(V) - w(E) with KK for the whole system. This is the quick test of a sketcher's status bar ("3 DOF left"). It misses an over-constrained part that a free part elsewhere hides.
  • Flows for every subset. The template, which checks every subset in polynomial time.
  • Action analysis. Kramer's form keeps a DOF state per body, not one number, so it knows which freedoms are left: a body that may only turn about one axis has 1 rotational DOF, and a constraint that asks for a translation is then in conflict. This catches some dependencies that pure counts miss.
  • Numerical rank. The rank of the Jacobian at the draft is the exact number of independent equations at that point. It sees every dependency, also those of special values, but it needs coordinates and a tolerance, so it is not a structural test.

Pitfalls

  • Dependent constraints. A pin in a hole with a shoulder face: a body is coaxial with a fixed axis (weight 4, it fixes the two translations across the axis and the two tilts) and its face lies on a fixed plane perpendicular to the axis (weight 3, it fixes the translation along the axis and the two tilts). The count gives 6−4−3=−16 - 4 - 3 = -1, over-constrained. But the two tilts appear in both constraints, the rank of the equations is 5, and 1 DOF is left: the rotation about the axis. The count is wrong in both directions here: it reports a conflict that does not exist and misses a freedom that does. Kramer's action form, or the rank, gets this right.
  • Special geometry. A parallelogram linkage with a third bar parallel to two sides has M=3⋅4−2⋅6=0M = 3 \cdot 4 - 2 \cdot 6 = 0 by Grübler's formula, yet it moves with 1 DOF, because the third bar is parallel to the other two. The count is right for generic lengths and wrong for these.
  • Checking only the whole system. The total count can be right while one part is over-constrained and another is free. Add to the example above a point RR with the one constraint ∣PR∣=1\lvert PR \rvert = 1. The total is 7−10=−37 - 10 = -3, the count of a well-constrained system, but {P,Q,L,M}\{P, Q, L, M\} is dense and RR can still turn about PP. Test every subset, as the flow does.
  • The wrong slack for small sets. The orbit of one point in the plane has dimension 2, not 3. Two points with a coincidence constraint (weight 2) have ρ=2−4=−2>−3\rho = 2 - 4 = -2 > -3, so the template with K=3K = 3 reports them as dense, but the pair is fine and keeps 2 DOF. The same happens to a circle with a fixed radius, ρ=1−3=−2\rho = 1 - 3 = -2. Merge coincident points into one entity and treat a constraint on one entity by lowering its weight, as on the constraint graph page, before the flow runs.

Exercises

  1. Show that, for w(v)=2w(v) = 2, w(e)=1w(e) = 1 and K=3K = 3, the flow template accepts the constraints one by one exactly as long as the edges form a Laman-sparse graph.
  2. Show that if the flow of line L4 fails, the set of entities reachable from ee in the residual network is dense.
  3. Count the DOF of a planar sketch with a circle tangent to two fixed perpendicular lines and with a fixed radius, and check the answer by placing the circle.
  4. A body in space is constrained by three point-on-plane mates against three fixed planes that are pairwise perpendicular. Find the count, the rank and the DOF left.

References

  1. Glenn A. Kramer, Solving Geometric Constraint Systems, A Case Study in Kinematics, MIT Press, 1992, degrees of freedom analysis, with the translational and rotational freedoms of each body, the actions that satisfy a constraint and remove freedoms, and the plan fragments that compute each action in closed form (general locator)
  2. Christoph M. Hoffmann, Andrew Lomonosov and Meera Sitharam, Finding solvable subsets of constraint graphs, Principles and Practice of Constraint Programming (CP97), LNCS 1330, 1997, the network flow test for dense subgraphs of a weighted constraint graph (general locator)
  3. Christoph M. Hoffmann, Andrew Lomonosov and Meera Sitharam, Decomposition plans for geometric constraint systems, Part I, Performance measures for CAD, Journal of Symbolic Computation 31(4), 367 to 408, 2001, the density of a subgraph, the structural notions of well-constrained and over-constrained, and their limits (general locator)
  4. Meera Sitharam, Audrey St. John and Jessica Sidman (editors), Handbook of Geometric Constraint Systems Principles, Chapman and Hall/CRC, 2018, the chapters on the combinatorics of rigidity and on decomposition (general locator)

Where this leads

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW3 standard
  • five exercises