Ignition Math

API Reference

4.0.0
Helpers.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 #ifndef IGNITION_MATH_FUNCTIONS_HH_
18 #define IGNITION_MATH_FUNCTIONS_HH_
19 
20 #include <cmath>
21 #include <algorithm>
22 #include <limits>
23 #include <string>
24 #include <iostream>
25 #include <vector>
26 #include <tuple>
27 #include <cstdint>
28 
29 #include <ignition/math/config.hh>
30 #include "ignition/math/Export.hh"
31 
34 #define IGN_DBL_MAX ignition::math::DPRCT_MAX_D
35 
38 #define IGN_DBL_MIN ignition::math::DPRCT_MIN_D
39 
42 #define IGN_DBL_LOW ignition::math::DPRCT_LOW_D
43 
46 #define IGN_DBL_INF ignition::math::DPRCT_INF_D
47 
50 #define IGN_FLT_MAX ignition::math::DPRCT_MAX_F
51 
54 #define IGN_FLT_MIN ignition::math::DPRCT_MIN_F
55 
58 #define IGN_FLT_LOW ignition::math::DPRCT_LOW_F
59 
62 #define IGN_FLT_INF ignition::math::DPRCT_INF_F
63 
66 #define IGN_UINT16_MAX ignition::math::DPRCT_MAX_UI16
67 
70 #define IGN_UINT16_MIN ignition::math::DPRCT_MIN_UI16
71 
75 #define IGN_UINT16_LOW ignition::math::DPRCT_LOW_UI16
76 
79 #define IGN_UINT16_INF ignition::math::DPRCT_INF_UI16
80 
83 #define IGN_INT16_MAX ignition::math::DPRCT_MAX_I16
84 
87 #define IGN_INT16_MIN ignition::math::DPRCT_MIN_I16
88 
92 #define IGN_INT16_LOW ignition::math::DPRCT_LOW_I16
93 
96 #define IGN_INT16_INF ignition::math::DPRCT_INF_I16
97 
100 #define IGN_UINT32_MAX ignition::math::DPRCT_MAX_UI32
101 
104 #define IGN_UINT32_MIN ignition::math::DPRCT_MIN_UI32
105 
109 #define IGN_UINT32_LOW ignition::math::DPRCT_LOW_UI32
110 
113 #define IGN_UINT32_INF ignition::math::DPRCT_INF_UI32
114 
117 #define IGN_INT32_MAX ignition::math::DPRCT_MAX_I32
118 
121 #define IGN_INT32_MIN ignition::math::DPRCT_MIN_I32
122 
126 #define IGN_INT32_LOW ignition::math::DPRCT_LOW_I32
127 
130 #define IGN_INT32_INF ignition::math::DPRCT_INF_I32
131 
134 #define IGN_UINT64_MAX ignition::math::DPRCT_MAX_UI64
135 
138 #define IGN_UINT64_MIN ignition::math::DPRCT_MIN_UI64
139 
143 #define IGN_UINT64_LOW ignition::math::DPRCT_LOW_UI64
144 
147 #define IGN_UINT64_INF ignition::math::DPRCT_INF_UI64
148 
151 #define IGN_INT64_MAX ignition::math::DPRCT_MAX_I64
152 
155 #define IGN_INT64_MIN ignition::math::DPRCT_MIN_I64
156 
160 #define IGN_INT64_LOW ignition::math::DPRCT_LOW_I64
161 
164 #define IGN_INT64_INF ignition::math::DPRCT_INF_I64
165 
168 #ifdef M_PI
169 #define IGN_PI M_PI
170 #define IGN_PI_2 M_PI_2
171 #define IGN_PI_4 M_PI_4
172 #define IGN_SQRT2 M_SQRT2
173 #else
174 #define IGN_PI 3.14159265358979323846
175 #define IGN_PI_2 1.57079632679489661923
176 #define IGN_PI_4 0.78539816339744830962
177 #define IGN_SQRT2 1.41421356237309504880
178 #endif
179 
183 #if defined __FLT_EVAL_METHOD__ && __FLT_EVAL_METHOD__ == 2
184 #define IGN_FP_VOLATILE volatile
185 #else
186 #define IGN_FP_VOLATILE
187 #endif
188 
191 #define IGN_SPHERE_VOLUME(_radius) (4.0*IGN_PI*std::pow(_radius, 3)/3.0)
192 
196 #define IGN_CYLINDER_VOLUME(_r, _l) (_l * IGN_PI * std::pow(_r, 2))
197 
202 #define IGN_BOX_VOLUME(_x, _y, _z) (_x *_y * _z)
203 
206 #define IGN_BOX_VOLUME_V(_v) (_v.X() *_v.Y() * _v.Z())
207 
208 namespace ignition
209 {
211  namespace math
212  {
213  // Inline bracket to help doxygen filtering.
214  inline namespace IGNITION_MATH_VERSION_NAMESPACE {
215  //
217  static const size_t IGN_ZERO_SIZE_T = 0u;
218 
220  static const size_t IGN_ONE_SIZE_T = 1u;
221 
223  static const size_t IGN_TWO_SIZE_T = 2u;
224 
226  static const size_t IGN_THREE_SIZE_T = 3u;
227 
229  static const size_t IGN_FOUR_SIZE_T = 4u;
230 
232  static const size_t IGN_FIVE_SIZE_T = 5u;
233 
235  static const size_t IGN_SIX_SIZE_T = 6u;
236 
238  static const size_t IGN_SEVEN_SIZE_T = 7u;
239 
241  static const size_t IGN_EIGHT_SIZE_T = 8u;
242 
244  static const size_t IGN_NINE_SIZE_T = 9u;
245 
247  static const double MAX_D = std::numeric_limits<double>::max();
248 
250  static const double MIN_D = std::numeric_limits<double>::min();
251 
254 
257 
260 
262  static const float MAX_F = std::numeric_limits<float>::max();
263 
265  static const float MIN_F = std::numeric_limits<float>::min();
266 
269 
272 
275 
277  static const uint16_t MAX_UI16 = std::numeric_limits<uint16_t>::max();
278 
280  static const uint16_t MIN_UI16 = std::numeric_limits<uint16_t>::min();
281 
285 
288 
290  static const int16_t MAX_I16 = std::numeric_limits<int16_t>::max();
291 
293  static const int16_t MIN_I16 = std::numeric_limits<int16_t>::min();
294 
298 
301 
303  static const uint32_t MAX_UI32 = std::numeric_limits<uint32_t>::max();
304 
306  static const uint32_t MIN_UI32 = std::numeric_limits<uint32_t>::min();
307 
311 
314 
316  static const int32_t MAX_I32 = std::numeric_limits<int32_t>::max();
317 
319  static const int32_t MIN_I32 = std::numeric_limits<int32_t>::min();
320 
324 
327 
329  static const uint64_t MAX_UI64 = std::numeric_limits<uint64_t>::max();
330 
332  static const uint64_t MIN_UI64 = std::numeric_limits<uint64_t>::min();
333 
337 
340 
342  static const int64_t MAX_I64 = std::numeric_limits<int64_t>::max();
343 
345  static const int64_t MIN_I64 = std::numeric_limits<int64_t>::min();
346 
350 
353 
356 
357  // variables created to deprecate macros in this file
358  static const double IGN_DEPRECATED(3) DPRCT_MAX_D = MAX_D;
359  static const double IGN_DEPRECATED(3) DPRCT_MIN_D = MIN_D;
360  static const double IGN_DEPRECATED(3) DPRCT_LOW_D = LOW_D;
361  static const double IGN_DEPRECATED(3) DPRCT_INF_D = INF_D;
362  static const float IGN_DEPRECATED(3) DPRCT_MAX_F = MAX_F;
363  static const float IGN_DEPRECATED(3) DPRCT_MIN_F = MIN_F;
364  static const float IGN_DEPRECATED(3) DPRCT_LOW_F = LOW_F;
365  static const float IGN_DEPRECATED(3) DPRCT_INF_F = INF_F;
366  static const uint16_t IGN_DEPRECATED(3) DPRCT_MAX_UI16 = MAX_UI16;
367  static const uint16_t IGN_DEPRECATED(3) DPRCT_MIN_UI16 = MIN_UI16;
368  static const uint16_t IGN_DEPRECATED(3) DPRCT_LOW_UI16 = LOW_UI16;
369  static const uint16_t IGN_DEPRECATED(3) DPRCT_INF_UI16 = INF_UI16;
370  static const int16_t IGN_DEPRECATED(3) DPRCT_MAX_I16 = MAX_I16;
371  static const int16_t IGN_DEPRECATED(3) DPRCT_MIN_I16 = MIN_I16;
372  static const int16_t IGN_DEPRECATED(3) DPRCT_LOW_I16 = LOW_I16;
373  static const int16_t IGN_DEPRECATED(3) DPRCT_INF_I16 = INF_I16;
374  static const uint32_t IGN_DEPRECATED(3) DPRCT_MAX_UI32 = MAX_UI32;
375  static const uint32_t IGN_DEPRECATED(3) DPRCT_MIN_UI32 = MIN_UI32;
376  static const uint32_t IGN_DEPRECATED(3) DPRCT_LOW_UI32 = LOW_UI32;
377  static const uint32_t IGN_DEPRECATED(3) DPRCT_INF_UI32 = INF_UI32;
378  static const int32_t IGN_DEPRECATED(3) DPRCT_MAX_I32 = MAX_I32;
379  static const int32_t IGN_DEPRECATED(3) DPRCT_MIN_I32 = MIN_I32;
380  static const int32_t IGN_DEPRECATED(3) DPRCT_LOW_I32 = LOW_I32;
381  static const int32_t IGN_DEPRECATED(3) DPRCT_INF_I32 = INF_I32;
382  static const uint64_t IGN_DEPRECATED(3) DPRCT_MAX_UI64 = MAX_UI64;
383  static const uint64_t IGN_DEPRECATED(3) DPRCT_MIN_UI64 = MIN_UI64;
384  static const uint64_t IGN_DEPRECATED(3) DPRCT_LOW_UI64 = LOW_UI64;
385  static const uint64_t IGN_DEPRECATED(3) DPRCT_INF_UI64 = INF_UI64;
386  static const int64_t IGN_DEPRECATED(3) DPRCT_MAX_I64 = MAX_I64;
387  static const int64_t IGN_DEPRECATED(3) DPRCT_MIN_I64 = MIN_I64;
388  static const int64_t IGN_DEPRECATED(3) DPRCT_LOW_I64 = LOW_I64;
389  static const int64_t IGN_DEPRECATED(3) DPRCT_INF_I64 = INF_I64;
390 
395  template<typename T>
396  inline T clamp(T _v, T _min, T _max)
397  {
398  return std::max(std::min(_v, _max), _min);
399  }
400 
404  inline bool isnan(float _v)
405  {
406  return (std::isnan)(_v);
407  }
408 
412  inline bool isnan(double _v)
413  {
414  return (std::isnan)(_v);
415  }
416 
420  inline float fixnan(float _v)
421  {
422  return isnan(_v) || std::isinf(_v) ? 0.0f : _v;
423  }
424 
428  inline double fixnan(double _v)
429  {
430  return isnan(_v) || std::isinf(_v) ? 0.0 : _v;
431  }
432 
436  inline bool isEven(const int _v)
437  {
438  return !(_v % 2);
439  }
440 
444  inline bool isEven(const unsigned int _v)
445  {
446  return !(_v % 2);
447  }
448 
452  inline bool isOdd(const int _v)
453  {
454  return (_v % 2) != 0;
455  }
456 
460  inline bool isOdd(const unsigned int _v)
461  {
462  return (_v % 2) != 0;
463  }
464 
471  template<typename T>
472  inline int sgn(T _value)
473  {
474  return (T(0) < _value) - (_value < T(0));
475  }
476 
483  template<typename T>
484  inline int signum(T _value)
485  {
486  return sgn(_value);
487  }
488 
492  template<typename T>
493  inline T mean(const std::vector<T> &_values)
494  {
495  T sum = 0;
496  for (unsigned int i = 0; i < _values.size(); ++i)
497  sum += _values[i];
498  return sum / _values.size();
499  }
500 
504  template<typename T>
505  inline T variance(const std::vector<T> &_values)
506  {
507  T avg = mean<T>(_values);
508 
509  T sum = 0;
510  for (unsigned int i = 0; i < _values.size(); ++i)
511  sum += (_values[i] - avg) * (_values[i] - avg);
512  return sum / _values.size();
513  }
514 
518  template<typename T>
519  inline T max(const std::vector<T> &_values)
520  {
522  for (unsigned int i = 0; i < _values.size(); ++i)
523  if (_values[i] > max)
524  max = _values[i];
525  return max;
526  }
527 
531  template<typename T>
532  inline T min(const std::vector<T> &_values)
533  {
535  for (unsigned int i = 0; i < _values.size(); ++i)
536  if (_values[i] < min)
537  min = _values[i];
538  return min;
539  }
540 
545  template<typename T>
546  inline bool equal(const T &_a, const T &_b,
547  const T &_epsilon = T(1e-6))
548  {
549  IGN_FP_VOLATILE T diff = std::abs(_a - _b);
550  return diff <= _epsilon;
551  }
552 
557  template<typename T>
558  inline bool lessOrNearEqual(const T &_a, const T &_b,
559  const T &_epsilon = 1e-6)
560  {
561  return _a < _b + _epsilon;
562  }
563 
568  template<typename T>
569  inline bool greaterOrNearEqual(const T &_a, const T &_b,
570  const T &_epsilon = 1e-6)
571  {
572  return _a > _b - _epsilon;
573  }
574 
579  template<typename T>
580  inline T precision(const T &_a, const unsigned int &_precision)
581  {
582  auto p = std::pow(10, _precision);
583  return static_cast<T>(std::round(_a * p) / p);
584  }
585 
589  template<typename T>
590  inline void sort2(T &_a, T &_b)
591  {
592  using std::swap;
593  if (_b < _a)
594  swap(_a, _b);
595  }
596 
601  template<typename T>
602  inline void sort3(T &_a, T &_b, T &_c)
603  {
604  // _a <= _b
605  sort2(_a, _b);
606  // _a <= _c, _b <= _c
607  sort2(_b, _c);
608  // _a <= _b <= _c
609  sort2(_a, _b);
610  }
611 
615  inline bool isPowerOfTwo(unsigned int _x)
616  {
617  return ((_x != 0) && ((_x & (~_x + 1)) == _x));
618  }
619 
625  inline unsigned int roundUpPowerOfTwo(unsigned int _x)
626  {
627  if (_x == 0)
628  return 1;
629 
630  if (isPowerOfTwo(_x))
631  return _x;
632 
633  while (_x & (_x - 1))
634  _x = _x & (_x - 1);
635 
636  _x = _x << 1;
637 
638  return _x;
639  }
640 
644  inline int parseInt(const std::string &_input)
645  {
646  // Return NAN_I if it is empty
647  if (_input.empty())
648  {
649  return NAN_I;
650  }
651  // Return 0 if it is all spaces
652  else if (_input.find_first_not_of(' ') == std::string::npos)
653  {
654  return 0;
655  }
656 
657  // Otherwise try standard library
658  try
659  {
660  return std::stoi(_input);
661  }
662  // if that fails, return NAN_I
663  catch(...)
664  {
665  return NAN_I;
666  }
667  }
668 
673  inline double parseFloat(const std::string &_input)
674  {
675  // Return NAN_D if it is empty
676  if (_input.empty())
677  {
678  return NAN_D;
679  }
680  // Return 0 if it is all spaces
681  else if (_input.find_first_not_of(' ') == std::string::npos)
682  {
683  return 0;
684  }
685 
686  // Otherwise try standard library
687  try
688  {
689  return std::stod(_input);
690  }
691  // if that fails, return NAN_D
692  catch(...)
693  {
694  return NAN_D;
695  }
696  }
697 
698 
699  // Degrade precision on Windows, which cannot handle 'long double'
700  // values properly. See the implementation of Unpair.
701  // 32 bit ARM processors also define 'long double' to be the same
702  // size as 'double', and must also be degraded
703 #if defined _MSC_VER || defined __arm__
704  using PairInput = uint16_t;
705  using PairOutput = uint32_t;
706 #else
707  using PairInput = uint32_t;
708  using PairOutput = uint64_t;
709 #endif
710 
720  PairOutput IGNITION_MATH_VISIBLE Pair(
721  const PairInput _a, const PairInput _b);
722 
734  std::tuple<PairInput, PairInput> IGNITION_MATH_VISIBLE Unpair(
735  const PairOutput _key);
736  }
737  }
738 }
739 
740 #endif
static const size_t IGN_NINE_SIZE_T
size_t type with a value of 9
Definition: Helpers.hh:244
std::tuple< PairInput, PairInput > Unpair(const PairOutput _key)
The reverse of the Pair function. Accepts a key, produced from the Pair function, and returns a tuple...
T empty(T... args)
static const size_t IGN_SIX_SIZE_T
size_t type with a value of 6
Definition: Helpers.hh:235
static const int NAN_I
Returns the representation of a quiet not a number (NAN)
Definition: Helpers.hh:355
static const int32_t LOW_I32
32bit unsigned integer lowest value. This is equivalent to IGN_INT32_MIN, and is defined here for com...
Definition: Helpers.hh:323
static const float INF_F
float positive infinite value
Definition: Helpers.hh:271
static const double LOW_D
Double low value, equivalent to -MAX_D.
Definition: Helpers.hh:253
T find_first_not_of(T... args)
static const uint64_t MIN_UI64
64bit unsigned integer minimum value
Definition: Helpers.hh:332
static const uint32_t MIN_UI32
32bit unsigned integer minimum value
Definition: Helpers.hh:306
T precision(const T &_a, const unsigned int &_precision)
get value at a specified precision
Definition: Helpers.hh:580
static const static double const static double const static double const static double const static float const static float const static float const static float const static uint16_t const static uint16_t const static uint16_t const static uint16_t const static int16_t const static int16_t const static int16_t const static int16_t const static uint32_t const static uint32_t const static uint32_t const static uint32_t const static int32_t const static int32_t const static int32_t const static int32_t const static uint64_t const static uint64_t const static uint64_t const static uint64_t const static int64_t const static int64_t const static int64_t const int64_t T clamp(T _v, T _min, T _max)
Simple clamping function.
Definition: Helpers.hh:396
static const size_t IGN_EIGHT_SIZE_T
size_t type with a value of 8
Definition: Helpers.hh:241
T mean(const std::vector< T > &_values)
get mean of vector of values
Definition: Helpers.hh:493
static const int32_t INF_I32
32-bit unsigned integer positive infinite value
Definition: Helpers.hh:326
T swap(T... args)
static const float NAN_F
Returns the representation of a quiet not a number (NAN)
Definition: Helpers.hh:274
static const int16_t MAX_I16
16bit unsigned integer maximum value
Definition: Helpers.hh:290
static const uint16_t MAX_UI16
16bit unsigned integer maximum value
Definition: Helpers.hh:277
bool isnan(float _v)
check if a float is NaN
Definition: Helpers.hh:404
T stod(T... args)
static const uint64_t MAX_UI64
64bit unsigned integer maximum value
Definition: Helpers.hh:329
static const uint64_t LOW_UI64
64bit unsigned integer lowest value. This is equivalent to IGN_UINT64_MIN, and is defined here for co...
Definition: Helpers.hh:336
unsigned int roundUpPowerOfTwo(unsigned int _x)
Get the smallest power of two that is greater or equal to a given value.
Definition: Helpers.hh:625
static const uint32_t MAX_UI32
32bit unsigned integer maximum value
Definition: Helpers.hh:303
T max(const std::vector< T > &_values)
get the maximum value of vector of values
Definition: Helpers.hh:519
static const int64_t MAX_I64
64bit unsigned integer maximum value
Definition: Helpers.hh:342
bool equal(const T &_a, const T &_b, const T &_epsilon=T(1e-6))
check if two values are equal, within a tolerance
Definition: Helpers.hh:546
static const double MIN_D
Double min value. This value will be similar to 2.22507e-308.
Definition: Helpers.hh:250
static const size_t IGN_ONE_SIZE_T
size_t type with a value of 1
Definition: Helpers.hh:220
bool isOdd(const int _v)
Check if parameter is odd.
Definition: Helpers.hh:452
bool greaterOrNearEqual(const T &_a, const T &_b, const T &_epsilon=1e-6)
inequality test, within a tolerance
Definition: Helpers.hh:569
STL class.
T variance(const std::vector< T > &_values)
get variance of vector of values
Definition: Helpers.hh:505
T min(T... args)
static const size_t IGN_FOUR_SIZE_T
size_t type with a value of 4
Definition: Helpers.hh:229
static const uint32_t INF_UI32
32-bit unsigned integer positive infinite value
Definition: Helpers.hh:313
static const size_t IGN_FIVE_SIZE_T
size_t type with a value of 5
Definition: Helpers.hh:232
static const uint64_t INF_UI64
64-bit unsigned integer positive infinite value
Definition: Helpers.hh:339
T lowest(T... args)
static const float LOW_F
Float low value, equivalent to -MAX_F.
Definition: Helpers.hh:268
uint64_t PairOutput
Definition: Helpers.hh:708
#define IGN_FP_VOLATILE
Define IGN_FP_VOLATILE for FP equality comparisons Use volatile parameters when checking floating poi...
Definition: Helpers.hh:186
bool isPowerOfTwo(unsigned int _x)
Is this a power of 2?
Definition: Helpers.hh:615
static const uint16_t INF_UI16
16-bit unsigned integer positive infinite value
Definition: Helpers.hh:287
uint32_t PairInput
Definition: Helpers.hh:707
static const size_t IGN_ZERO_SIZE_T
size_t type with a value of 0
Definition: Helpers.hh:217
static const uint16_t MIN_UI16
16bit unsigned integer minimum value
Definition: Helpers.hh:280
static const uint16_t LOW_UI16
16bit unsigned integer lowest value. This is equivalent to IGN_UINT16_MIN, and is defined here for co...
Definition: Helpers.hh:284
static const int16_t MIN_I16
16bit unsigned integer minimum value
Definition: Helpers.hh:293
T infinity(T... args)
static const int32_t MIN_I32
32bit unsigned integer minimum value
Definition: Helpers.hh:319
T max(T... args)
static const int64_t MIN_I64
64bit unsigned integer minimum value
Definition: Helpers.hh:345
PairOutput Pair(const PairInput _a, const PairInput _b)
A pairing function that maps two values to a unique third value. This is an implement of Szudzik&#39;s fu...
static const float MAX_F
Float maximum value. This value will be similar to 3.40282e+38.
Definition: Helpers.hh:262
int sgn(T _value)
The signum function.
Definition: Helpers.hh:472
T size(T... args)
int signum(T _value)
The signum function.
Definition: Helpers.hh:484
STL class.
bool isEven(const int _v)
Check if parameter is even.
Definition: Helpers.hh:436
T pow(T... args)
static const double NAN_D
Returns the representation of a quiet not a number (NAN)
Definition: Helpers.hh:259
static const int16_t LOW_I16
16bit unsigned integer lowest value. This is equivalent to IGN_INT16_MIN, and is defined here for com...
Definition: Helpers.hh:297
static const int64_t LOW_I64
64bit unsigned integer lowest value. This is equivalent to IGN_INT64_MIN, and is defined here for com...
Definition: Helpers.hh:349
static const double MAX_D
Double maximum value. This value will be similar to 1.79769e+308.
Definition: Helpers.hh:247
static const size_t IGN_TWO_SIZE_T
size_t type with a value of 2
Definition: Helpers.hh:223
static const int64_t INF_I64
64-bit unsigned integer positive infinite value
Definition: Helpers.hh:352
static const float MIN_F
Float minimum value. This value will be similar to 1.17549e-38.
Definition: Helpers.hh:265
T isnan(T... args)
double parseFloat(const std::string &_input)
parse string into float
Definition: Helpers.hh:673
static const int16_t INF_I16
16-bit unsigned integer positive infinite value
Definition: Helpers.hh:300
T quiet_NaN(T... args)
static const double INF_D
Double positive infinite value.
Definition: Helpers.hh:256
void sort2(T &_a, T &_b)
Sort two numbers, such that _a <= _b.
Definition: Helpers.hh:590
static const uint32_t LOW_UI32
32bit unsigned integer lowest value. This is equivalent to IGN_UINT32_MIN, and is defined here for co...
Definition: Helpers.hh:310
static const size_t IGN_THREE_SIZE_T
size_t type with a value of 3
Definition: Helpers.hh:226
static const size_t IGN_SEVEN_SIZE_T
size_t type with a value of 7
Definition: Helpers.hh:238
T isinf(T... args)
Definition: Angle.hh:39
float fixnan(float _v)
Fix a nan value.
Definition: Helpers.hh:420
T stoi(T... args)
T round(T... args)
int parseInt(const std::string &_input)
parse string into an integer
Definition: Helpers.hh:644
bool lessOrNearEqual(const T &_a, const T &_b, const T &_epsilon=1e-6)
inequality test, within a tolerance
Definition: Helpers.hh:558
T min(const std::vector< T > &_values)
get the minimum value of vector of values
Definition: Helpers.hh:532
void sort3(T &_a, T &_b, T &_c)
Sort three numbers, such that _a <= _b <= _c.
Definition: Helpers.hh:602
static const int32_t MAX_I32
32bit unsigned integer maximum value
Definition: Helpers.hh:316