Functions
geo::vect::extra Namespace Reference

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

Functions

template<typename T >
roundValue01 (T value, T tol)
 Returns value, rounded to 0, -1 or +1 if closer than tol. More...
 
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)
template<typename T >
T geo::vect::extra::roundValue01 ( value,
tol 
)

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

Definition at line 403 of file geo_vectors_utils.h.

403  {
404  if (std::abs(value) < tol) return 0.;
405  if (std::abs(std::abs(value) - 1.) < tol) return (value > 0.)? 1.: -1.;
406  return value;
407  } // roundValue01()
auto const tol
Definition: SurfXYZTest.cc:16
T abs(T 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)