Commit a2c6b3c7 authored by Joseph Mirabel's avatar Joseph Mirabel
Browse files

Fix usage of std::numeric_limit::max on windows

See https://stackoverflow.com/q/11544073
parent 0b6e6634
......@@ -252,7 +252,7 @@ public:
public:
CollisionResult()
: distance_lower_bound (std::numeric_limits<FCL_REAL>::max())
: distance_lower_bound ((std::numeric_limits<FCL_REAL>::max)())
{
}
......@@ -393,7 +393,7 @@ public:
static const int NONE = -1;
DistanceResult(FCL_REAL min_distance_ =
std::numeric_limits<FCL_REAL>::max()):
(std::numeric_limits<FCL_REAL>::max)()):
min_distance(min_distance_), o1(NULL), o2(NULL), b1(NONE), b2(NONE)
{
Vec3f nan (Vec3f::Constant(std::numeric_limits<FCL_REAL>::quiet_NaN()));
......@@ -451,7 +451,7 @@ public:
/// @brief clear the result
void clear()
{
min_distance = std::numeric_limits<FCL_REAL>::max();
min_distance = (std::numeric_limits<FCL_REAL>::max)();
o1 = NULL;
o2 = NULL;
b1 = NONE;
......
......@@ -156,7 +156,7 @@ public:
/// @note except for OBB, this method returns the distance.
virtual FCL_REAL BVDistanceLowerBound(int /*b1*/, int /*b2*/) const
{
return std::numeric_limits<FCL_REAL>::max();
return (std::numeric_limits<FCL_REAL>::max)();
}
/// @brief Leaf test between node b1 and b2, if they are both leafs
......
......@@ -100,7 +100,7 @@ namespace fcl
if(contact_points) *contact_points = tf1.transform(w0 - epa.normal*(epa.depth *0.5));
return true;
}
distance_lower_bound = -std::numeric_limits<FCL_REAL>::max();
distance_lower_bound = -(std::numeric_limits<FCL_REAL>::max)();
// EPA failed but we know there is a collision so we should
return true;
}
......@@ -172,7 +172,7 @@ namespace fcl
p1 = p2 = tf1.transform(w0 - epa.normal*(epa.depth *0.5));
assert (distance <= 1e-6);
} else {
distance = -std::numeric_limits<FCL_REAL>::max();
distance = -(std::numeric_limits<FCL_REAL>::max)();
gjk.getClosestPoints (shape, w0, w1);
p1 = p2 = tf1.transform (w0);
}
......@@ -274,14 +274,14 @@ namespace fcl
Vec3f w0, w1;
epa.getClosestPoints (shape, w0, w1);
assert (epa.depth >= -eps);
distance = std::min (0., -epa.depth);
distance = (std::min) (0., -epa.depth);
// TODO should be
// normal = tf1.getRotation() * epa.normal;
normal = tf2.getRotation() * epa.normal;
p1 = p2 = tf1.transform(w0 - epa.normal*(epa.depth *0.5));
return false;
}
distance = -std::numeric_limits<FCL_REAL>::max();
distance = -(std::numeric_limits<FCL_REAL>::max)();
gjk.getClosestPoints (shape, p1, p2);
p1 = p2 = tf1.transform (p1);
}
......
......@@ -219,7 +219,7 @@ void Convex<PolygonT>::fillNeighbors()
unsigned int* p_nneighbors = nneighbors_;
for (int i = 0; i < num_points; ++i) {
Neighbors& n = neighbors[i];
if (nneighbors[i].size() >= std::numeric_limits<unsigned char>::max())
if (nneighbors[i].size() >= (std::numeric_limits<unsigned char>::max)())
throw std::logic_error ("Too many neighbors.");
n.count_ = (unsigned char)nneighbors[i].size();
n.n_ = p_nneighbors;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment