commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anxionnat Julien <Julien.Anxion...@cnes.fr>
Subject RE: [math] Adding some methods in Precision class (oacm.util)
Date Thu, 20 Sep 2012 09:13:41 GMT
> De : Tanguy Yannick [mailto:Yannick.Tanguy@cnes.fr]
> About the default value (1e-14), I know the tolerance is case-
> dependant, but some times, we don't precisely know the order of
> magnitude (ex : jacobians matrices) and it's quite practical to have a
> default value.

Hi,
A point of the discussion with Gilles in the MATH-863 (new Quaternion class) is about this
magic 1E-14. ;)

Consider the following methods:

    public Quaternion normalize() {
        final double norm = getNorm();
        if (norm >= Precision.SAFE_MIN) {
            return new Quaternion(q0 / norm, q1 / norm, q2 / norm, q3 / norm);
        } else {
            throw new ZeroException();
        }
    }

    public boolean isUnitQuaternion() {
        final double norm = getNorm();
        if (Precision.equals(norm, 1.0, Precision.EPSILON)) {
            return true;
        } else {
            return false;
        }
    }


=> There are many cases where

    myQuaternion.normalize().isUnitQuaternion()
returns "false".

The Precision.EPSILON is too small. That's why we use this "historical" arbitrary tolerance
of 1E-14.


Do you think that adding a tolerance parameter in this method isUnitQuaternion() (and in its
neighboors) is a good idea ?


Julien

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message