diff options
author | Eduardo M. Fleury <eduardo.fleury@openbossa.org> | 2009-10-27 21:04:17 (GMT) |
---|---|---|
committer | Eduardo M. Fleury <eduardo.fleury@openbossa.org> | 2009-11-27 19:19:07 (GMT) |
commit | 2aa9303031d9d9f4b123034f4a7fd84f1d1270ba (patch) | |
tree | b219cd935bfdb22a0f2766c61e220b8b3c6cb8bd /src/gui/graphicsview/qsimplex_p.h | |
parent | a801b57a403548cccd081d8a0ae1f174d2201f9a (diff) | |
download | Qt-2aa9303031d9d9f4b123034f4a7fd84f1d1270ba.zip Qt-2aa9303031d9d9f4b123034f4a7fd84f1d1270ba.tar.gz Qt-2aa9303031d9d9f4b123034f4a7fd84f1d1270ba.tar.bz2 |
QGAL: Limit absolute size of anchors and add offset to calculation
This commit is groundwork for the support of negative-sized anchors
by the simplex solver.
The idea is to add to all variables an offset large enough to ensure
they are never negative. The implementation limits all variable
sizes in the range [-limit, limit] and feed them into the simplex
with an offset of "limit". Subtracting this offset later to find out
the real values.
"limit" is defined as QWIDGETSIZE_MAX for platforms where qreal is
double and as QWIDGETSIZE_MAX / 32 when it is float. This is to
avoid numerical errors in the simplex solver.
This commit also modifies the ASSERT clause inside QSimplex so it
becomes less prone to false positives due to numerical errors.
Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
Diffstat (limited to 'src/gui/graphicsview/qsimplex_p.h')
-rw-r--r-- | src/gui/graphicsview/qsimplex_p.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/graphicsview/qsimplex_p.h b/src/gui/graphicsview/qsimplex_p.h index a5816d1..2004471 100644 --- a/src/gui/graphicsview/qsimplex_p.h +++ b/src/gui/graphicsview/qsimplex_p.h @@ -107,7 +107,7 @@ struct QSimplexConstraint Q_ASSERT(constant > 0 || qFuzzyCompare(1, 1 + constant)); - if ((leftHandSide == constant) || qAbs(leftHandSide - constant) < 0.00000001) + if ((leftHandSide == constant) || qAbs(leftHandSide - constant) < 0.0000001) return true; switch (ratio) { |