From: Krzysztof K. <twe...@gm...> - 2012-03-09 22:58:29
|
W dniu 5 marca 2012 00:34 użytkownik Nathan Hurst <nj...@nj...> napisał: > On Sun, Mar 04, 2012 at 07:01:50PM +0100, Johan Engelen wrote: >> Hi all, >> I've just run into trouble with SBasis::isZero and isConstant. >> See e.g. linear.h, lines 75 and 76. Shouldn't the comparisons be >> "are_near" comparisons? >> For example: >> inline bool isConstant(double eps=EPSILON) const { return >> are_near(a[0], a[1], eps); } > > I guess they should, though I wonder if we should have > isNearlyConstant? This is not a good pattern. There are already many functions, such as hasZeroArea in Rect, that take an epsilon parameter despite having an "exact" name. I think using isSomething(0) is an acceptable notation for an exact check. Regards, Krzysztof |