Remove forceDofCheck parameter from SolveRank(). NFC.

It makes no sense to solve by substitution (therefore weakening rank
check) in SolveRank(), since that's the whole point of SolveRank().

In addition, because SolveRank() is currently always called right
after AddConstraint(), forceDofCheck would always be true anyway.

In addition, it makes no sense to have TestRankForGroup() dependent
on the result of the previous solve. (For SolveGroup(), solving by
substitution after we know that rank test succeeds makes dragging
points much faster.)
pull/434/head
whitequark 2019-05-24 13:24:10 +00:00
parent 88879d352e
commit 394c1f62d8
3 changed files with 6 additions and 9 deletions

View File

@ -554,8 +554,9 @@ void SolveSpaceUI::SolveGroup(hGroup hg, bool andFindFree) {
SolveResult SolveSpaceUI::TestRankForGroup(hGroup hg) { SolveResult SolveSpaceUI::TestRankForGroup(hGroup hg) {
WriteEqSystemForGroup(hg); WriteEqSystemForGroup(hg);
Group *g = SK.GetGroup(hg); Group *g = SK.GetGroup(hg);
SolveResult result = sys.SolveRank(g, NULL, NULL, false, false, SolveResult result = sys.SolveRank(g, NULL, NULL,
/*forceDofCheck=*/!g->dofCheckOk); /*andFindBad=*/false,
/*andFindFree=*/false);
FreeAllTemporary(); FreeAllTemporary();
return result; return result;
} }

View File

@ -312,7 +312,7 @@ public:
bool andFindBad, bool andFindFree, bool forceDofCheck = false); bool andFindBad, bool andFindFree, bool forceDofCheck = false);
SolveResult SolveRank(Group *g, int *dof, List<hConstraint> *bad, SolveResult SolveRank(Group *g, int *dof, List<hConstraint> *bad,
bool andFindBad, bool andFindFree, bool forceDofCheck = false); bool andFindBad, bool andFindFree);
void Clear(); void Clear();
}; };

View File

@ -518,7 +518,7 @@ didnt_converge:
} }
SolveResult System::SolveRank(Group *g, int *dof, List<hConstraint> *bad, SolveResult System::SolveRank(Group *g, int *dof, List<hConstraint> *bad,
bool andFindBad, bool andFindFree, bool forceDofCheck) bool andFindBad, bool andFindFree)
{ {
WriteEquationsExceptFor(Constraint::NO_CONSTRAINT, g); WriteEquationsExceptFor(Constraint::NO_CONSTRAINT, g);
@ -526,10 +526,6 @@ SolveResult System::SolveRank(Group *g, int *dof, List<hConstraint> *bad,
param.ClearTags(); param.ClearTags();
eq.ClearTags(); eq.ClearTags();
if(!forceDofCheck) {
SolveBySubstitution();
}
// Now write the Jacobian, and do a rank test; that // Now write the Jacobian, and do a rank test; that
// tells us if the system is inconsistently constrained. // tells us if the system is inconsistently constrained.
if(!WriteJacobian(0)) { if(!WriteJacobian(0)) {
@ -539,7 +535,7 @@ SolveResult System::SolveRank(Group *g, int *dof, List<hConstraint> *bad,
bool rankOk = TestRank(); bool rankOk = TestRank();
if(!rankOk) { if(!rankOk) {
if(!g->allowRedundant) { if(!g->allowRedundant) {
if(andFindBad) FindWhichToRemoveToFixJacobian(g, bad, forceDofCheck); if(andFindBad) FindWhichToRemoveToFixJacobian(g, bad, /*forceDofCheck=*/true);
} }
} else { } else {
// This is not the full Jacobian, but any substitutions or single-eq // This is not the full Jacobian, but any substitutions or single-eq