Hi.

> >>> De : Tanguy Yannick [mailto:yannick.tan...@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
> >>
> >I think a tolerance parameter which defaults to 1E-14 in my view be the best 
> >option. I have nothing against this magic number; I just don't think that it 
> >should sit in the general class Precision. I think this is also what makes 
> >Gilles unhappy (TBC). How about a static final double 
> >Quaternion.DEFAULT_TOL, instead of Precision.DEFAULT_TOL?
> >Sébastien
> 
> Ok, I understand your point of view, it make sense to put specific 
> epsilon/tolerance value in the corresponding classes (and to justify the 
> value!!). We'll propose this default value in the Quaternion class (see 
> feature 863) and will use the same mechanism in our other classes.

My point-of-view is a bit more intolerant. ;-) See my previous post (and the
forthcoming commit of the "Quaternion" class.
Then we can continue this discussion if you don't agree.


Regards,
Gilles

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

Reply via email to