19 #ifndef SURGSIM_MATH_VALID_INL_H 20 #define SURGSIM_MATH_VALID_INL_H 22 #include <boost/math/special_functions/fpclassify.hpp> 33 template <
typename T,
class V>
37 typedef typename T::Scalar Scalar;
43 inline bool getResult()
const 48 inline void init(
const Scalar& value, Eigen::Index i, Eigen::Index j)
50 if (! V::evaluate(value))
56 inline void operator()(
const Scalar& value, Eigen::Index i, Eigen::Index j)
58 if (! V::evaluate(value))
74 static bool evaluate(
const Scalar& value)
77 return (boost::math::isfinite)(value);
87 static bool evaluate(
const Scalar& value)
90 return ((boost::math::fpclassify)(value) != FP_SUBNORMAL);
100 return (boost::math::isfinite)(value);
106 return (boost::math::isfinite)(value);
109 template <
typename T>
110 inline bool isValid(
const Eigen::DenseBase<T>& value)
113 value.visit(visitor);
114 return visitor.getResult();
117 template <
typename T>
118 inline bool isValid(
const Eigen::QuaternionBase<T>& value)
120 return isValid(value.coeffs());
123 template <
typename T>
124 inline bool isValid(
const Eigen::AngleAxis<T>& value)
129 template <
typename T>
130 inline bool isValid(
const Eigen::Rotation2D<T>& value)
135 template <
typename T,
int D,
int M,
int O>
136 inline bool isValid(
const Eigen::Transform<T, D, M, O>& value)
138 return isValid(value.matrix());
144 return ((boost::math::fpclassify)(value) == FP_SUBNORMAL);
150 return ((boost::math::fpclassify)(value) == FP_SUBNORMAL);
153 template <
typename T>
157 value.visit(visitor);
160 return ! visitor.getResult();
163 template <
typename T>
169 template <
typename T>
175 template <
typename T>
181 template <
typename T,
int D,
int M,
int O>
182 inline bool isSubnormal(
const Eigen::Transform<T, D, M, O>& value)
190 if ((boost::math::fpclassify)(*value) != FP_SUBNORMAL)
204 if ((boost::math::fpclassify)(*value) != FP_SUBNORMAL)
215 template <
typename T>
228 const Index numColumns = value->cols();
229 const Index numRows = value->rows();
231 for (Index j = 0; j < numColumns; ++j)
233 for (Index i = 0; i < numRows; ++i)
236 if ((boost::math::fpclassify)(value->coeffRef(i, j)) == FP_SUBNORMAL)
238 value->coeffRef(i, j) = 0;
245 template <
typename T>
251 template <
typename T>
256 return angleChanged || axisChanged;
259 template <
typename T>
265 template <
typename T,
int D,
int M,
int O>
274 #endif // SURGSIM_MATH_VALID_INL_H Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
bool setSubnormalToZero(float *value)
If the float value is subnormal, set it to zero.
Definition: Valid-inl.h:187
bool isSubnormal(float value)
Check if a float value is subnormal.
Definition: Valid-inl.h:141
Definition: Valid-inl.h:34
Definition: Valid-inl.h:82
bool isValid(float value)
Check if a float value is valid.
Definition: Valid-inl.h:97
Definition: Valid-inl.h:69