[ODE] Box/Trimesh contact filtering and oblong geoms
Tyler Streeter
tylerstreeter at gmail.com
Wed Apr 27 16:18:13 MST 2005
Rather than use an absolute epsilon, would it be better to use the
combined absolute and relative tolerance method mention in Christer
Ericson's talk? Here's how I implemented it:
/// Returns true if the two values are equal within some tolerance,
/// using a combination of absolute and relative (epsilon is scaled
/// by the magnitudes of the values) tolerance, depending on whether
/// both values are both less than 1.
/// See Christer Ericson's GDC 2005 presentation:
/// http://realtimecollisiondetection.net/pubs/GDC05_Ericson_Numerical_Robustness_for_Geometric_Calculations.ppt
inline bool areEqual(real x, real y)
{
real maxVal = 1;
if (abs(x) > maxVal)
{
maxVal = abs(x);
}
if (abs(y) > maxVal)
{
maxVal = abs(y);
}
if (abs(x - y) <= EPSILON * maxVal)
{
return true;
}
else
{
return false;
}
}
More information about the ODE
mailing list