All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
geo::vect::extra Namespace Reference

Convenience utilities not directly related to vectors. More...

Functions

template<typename T >
constexpr T roundValue0 (T value, T tol)
 Returns value, rounded to 0 if closer than tol. More...
 
template<typename T >
constexpr T roundValue01 (T value, T tol)
 Returns value, rounded to 0, -1 or +1 if closer than tol. More...
 

Detailed Description

Convenience utilities not directly related to vectors.

Function Documentation

template<typename T >
constexpr T geo::vect::extra::roundValue0 ( value,
tol 
)

Returns value, rounded to 0 if closer than tol.

Definition at line 410 of file geo_vectors_utils.h.

410  {
411  return (std::abs(value) < tol)? T{}: value;
412  } // roundValue0()
auto const tol
Definition: SurfXYZTest.cc:16
T abs(T value)
temporary value
template<typename T >
constexpr T geo::vect::extra::roundValue01 ( value,
tol 
)

Returns value, rounded to 0, -1 or +1 if closer than tol.

Definition at line 416 of file geo_vectors_utils.h.

416  {
417  if (std::abs(value) < tol) return 0.;
418  if (std::abs(std::abs(value) - 1.) < tol) return (value > 0.)? 1.: -1.;
419  return value;
420  } // roundValue01()
auto const tol
Definition: SurfXYZTest.cc:16
T abs(T value)
temporary value