From 6269d702fb97b629c446e1c4f36556baa7e54286 Mon Sep 17 00:00:00 2001 From: Jonathan Westhues Date: Wed, 9 Jul 2008 23:42:35 -0800 Subject: [PATCH] Report the number of degrees of freedom for each group. [git-p4: depot-paths = "//depot/solvespace/": change = 1834] --- graphicswin.cpp | 1 + sketch.h | 1 + system.cpp | 5 +++++ textscreens.cpp | 2 +- 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/graphicswin.cpp b/graphicswin.cpp index 67fa956..9b39a1c 100644 --- a/graphicswin.cpp +++ b/graphicswin.cpp @@ -476,6 +476,7 @@ void GraphicsWindow::MenuEdit(int id) { case MNU_REGEN_ALL: SS.ReloadAllImported(); SS.GenerateAll(0, INT_MAX); + SS.later.showTW = true; break; default: oops(); diff --git a/sketch.h b/sketch.h index 5c1ebb9..30a01b2 100644 --- a/sketch.h +++ b/sketch.h @@ -104,6 +104,7 @@ public: static const int SINGULAR_JACOBIAN = 11; struct { int how; + int dof; SList remove; } solved; diff --git a/system.cpp b/system.cpp index b5bf1a0..46d0da6 100644 --- a/system.cpp +++ b/system.cpp @@ -440,9 +440,14 @@ void System::Solve(Group *g) { if(rank != mat.m) { FindWhichToRemoveToFixJacobian(g); g->solved.how = Group::SINGULAR_JACOBIAN; + g->solved.dof = 0; TextWindow::ReportHowGroupSolved(g->h); return; } + // This is not the full Jacobian, but any substitutions or single-eq + // solves removed one equation and one unknown, therefore no effect + // on the number of DOF. + g->solved.dof = mat.n - mat.m; // And do the leftovers as one big system if(!NewtonSolve(0)) { diff --git a/textscreens.cpp b/textscreens.cpp index 413ad66..788a890 100644 --- a/textscreens.cpp +++ b/textscreens.cpp @@ -439,7 +439,7 @@ void TextWindow::ShowGroupInfo(void) { if(a == 0) Printf(false, "%Ba (none)"); a = 0; - Printf(true, "%Ftconstraints in group"); + Printf(true, "%Ftconstraints in group (%d DOF)", g->solved.dof); for(i = 0; i < SS.constraint.n; i++) { Constraint *c = &(SS.constraint.elem[i]);