Write params if system is solved as REDUNDANT_OKAY.
A system solved as REDUNDANT_OKAY is still solved correctly,
even if the UI would consider this an error, in case that
g->allowRedundant==false. So there's no reason to discard this
solution; we might find it useful if a system loses a degree of
freedom while dragging, or to avoid regeneration after redundant
constraints are allowed.
This commit also reverts commit 3ff236c
, as that is not necessary
anymore.
This commit is contained in:
parent
8a96ca894c
commit
bc43365eff
|
@ -463,36 +463,34 @@ int System::Solve(Group *g, int *dof, List<hConstraint> *bad,
|
||||||
if(!rankOk) {
|
if(!rankOk) {
|
||||||
if(!g->allowRedundant) {
|
if(!g->allowRedundant) {
|
||||||
if(andFindBad) FindWhichToRemoveToFixJacobian(g, bad);
|
if(andFindBad) FindWhichToRemoveToFixJacobian(g, bad);
|
||||||
return System::REDUNDANT_OKAY;
|
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
|
// 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.
|
||||||
|
if(dof) *dof = mat.n - mat.m;
|
||||||
|
|
||||||
// This is not the full Jacobian, but any substitutions or single-eq
|
// If requested, find all the free (unbound) variables. This might be
|
||||||
// solves removed one equation and one unknown, therefore no effect
|
// more than the number of degrees of freedom. Don't always do this,
|
||||||
// on the number of DOF.
|
// because the display would get annoying and it's slow.
|
||||||
if(dof) *dof = mat.n - mat.m;
|
for(i = 0; i < param.n; i++) {
|
||||||
|
Param *p = &(param.elem[i]);
|
||||||
|
p->free = false;
|
||||||
|
|
||||||
// If requested, find all the free (unbound) variables. This might be
|
if(andFindFree) {
|
||||||
// more than the number of degrees of freedom. Don't always do this,
|
if(p->tag == 0) {
|
||||||
// because the display would get annoying and it's slow.
|
p->tag = VAR_DOF_TEST;
|
||||||
for(i = 0; i < param.n; i++) {
|
WriteJacobian(0);
|
||||||
Param *p = &(param.elem[i]);
|
EvalJacobian();
|
||||||
p->free = false;
|
int rank = CalculateRank();
|
||||||
|
if(rank == mat.m) {
|
||||||
if(andFindFree) {
|
p->free = true;
|
||||||
if(p->tag == 0) {
|
}
|
||||||
p->tag = VAR_DOF_TEST;
|
p->tag = 0;
|
||||||
WriteJacobian(0);
|
|
||||||
EvalJacobian();
|
|
||||||
int rank = CalculateRank();
|
|
||||||
if(rank == mat.m) {
|
|
||||||
p->free = true;
|
|
||||||
}
|
}
|
||||||
p->tag = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// System solved correctly, so write the new values back in to the
|
// System solved correctly, so write the new values back in to the
|
||||||
// main parameter table.
|
// main parameter table.
|
||||||
for(i = 0; i < param.n; i++) {
|
for(i = 0; i < param.n; i++) {
|
||||||
|
|
|
@ -469,7 +469,6 @@ void TextWindow::ScreenAllowRedundant(int link, uint32_t v) {
|
||||||
|
|
||||||
Group *g = SK.GetGroup(SS.TW.shown.group);
|
Group *g = SK.GetGroup(SS.TW.shown.group);
|
||||||
g->allowRedundant = true;
|
g->allowRedundant = true;
|
||||||
SS.MarkGroupDirty(g->h);
|
|
||||||
SS.GenerateAll();
|
SS.GenerateAll();
|
||||||
|
|
||||||
SS.TW.shown.screen = SCREEN_GROUP_INFO;
|
SS.TW.shown.screen = SCREEN_GROUP_INFO;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user