libcrn  3.9.5
A document image processing library
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Namespaces | Macros | Enumerations | Functions
CRNMath.h File Reference
#include <CRN.h>
#include <cmath>
#include <complex>
#include <algorithm>
#include <CRNMath/CRNTrigonometry.h>
+ Include dependency graph for CRNMath.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 crn
 

Macros

#define M_PI   3.14159265358979323846
 

Enumerations

enum  crn::Direction {
  crn::Direction::INVALID = 0, crn::Direction::LEFT = 1, crn::Direction::RIGHT = 2, crn::Direction::TOP = 4,
  crn::Direction::BOTTOM = 8
}
 An enumeration of directions. More...
 
enum  crn::Orientation { crn::Orientation::INVALID = 0, crn::Orientation::HORIZONTAL, crn::Orientation::VERTICAL }
 An enumeration of orientations. More...
 
enum  crn::DistanceType { crn::DistanceType::INVALID = 0, crn::DistanceType::D4, crn::DistanceType::D8, crn::DistanceType::EUCLIDEAN }
 An enumeration of distances. More...
 

Functions

template<typename T >
const T & crn::Max (const T &a, const T &b)
 Returns the max of two values. More...
 
template<typename T >
const T & crn::Min (const T &a, const T &b)
 Returns the min of two values. More...
 
template<typename T >
const T & crn::Max (const T &a, const T &b, const T &c)
 Returns the max of three values. More...
 
template<typename T >
const T & crn::Min (const T &a, const T &b, const T &c)
 Returns the min of three values. More...
 
template<typename T >
constexpr TypeInfo< T >::SumType crn::Twice (const T &v) noexcept(noexcept(v+v))
 Returns the double of a value. More...
 
template<typename T >
constexpr TypeInfo< T >::SumType crn::Thrice (const T &v) noexcept(noexcept(v+v))
 Returns three times a value. More...
 
template<typename T >
constexpr int crn::SignOf (const T &x) noexcept(noexcept(x< 0))
 Returns the sign (-1 or 1) of a value. More...
 
template<typename T >
constexpr SumType< T > crn::Sqr (const T &v) noexcept(noexcept(v *v))
 Returns the square of a value. More...
 
template<typename T >
constexpr T crn::Abs (const T &v) noexcept(noexcept(v< 0)&&noexcept(-v))
 Returns the absolute value of a value. More...
 
template<typename T >
crn::Abs (const std::complex< T > &v) noexcept(noexcept(std::abs(std::complex< T >(0))))
 Returns the absolute value of a value. More...
 
template<typename T >
crn::AbsMax (const T &a, const T &b) noexcept(noexcept(Abs(a)))
 Returns the value that has the maximal absolute value. More...
 
template<typename T >
crn::AbsMin (const T &a, const T &b) noexcept(noexcept(Abs(a)))
 Returns the value that has the minimal absolute value. More...
 
template<typename T >
crn::AbsMaxSameSign (const T &a, const T &b) noexcept(noexcept(Abs(a))&&noexcept(SignOf(a)))
 Returns the value that has the maximal absolute value if the values have the same sign. More...
 
template<typename T >
crn::AbsMinSameSign (const T &a, const T &b) noexcept(noexcept(Abs(a))&&noexcept(SignOf(a)))
 Returns the value that has the minimal absolute value if the values have the same sign. More...
 
template<typename T >
const T & crn::Cap (const T &v, const T &min, const T &max)
 Bounds a value to an interval. More...
 
double crn::Gauss (double x, double sigma)
 Computes Gauss function at x for a given standard deviation (centered in 0) More...
 
double crn::MeanGauss (double x, double sigma)
 Computes Gauss function at x for a given standard deviation (centered in 0) – to use with matrices. More...
 
double crn::Pythagoras (double a, double b) noexcept
 Computes sqrt(a²+b²) without destructive underflow or overflow. More...
 
double crn::Pythagoras (int a, int b) noexcept
 Computes sqrt(a²+b²) without destructive underflow or overflow. More...
 
double crn::Pythagoras (double a, double b, double c) noexcept
 Computes sqrt(a²+b²+c²) More...
 
template<class ITER >
double crn::Pythagoras (ITER it_begin, ITER it_end)
 Computes euclidean norm. More...
 
template<class ITER >
void crn::Scale (ITER it_begin, ITER it_end, const double s)
 Scale a collection of numbers. More...
 
template<typename Unit >
Direction crn::ToDirection (const Angle< Unit > &ang) noexcept
 
Orientation crn::ToOrientation (Direction d) noexcept
 
template<typename T , typename std::enable_if< std::is_arithmetic< T >::value, int >::type = 0>
double crn::Distance (T o1, T o2)
 Distance between two numbers. More...
 

Macro Definition Documentation

#define M_PI   3.14159265358979323846

Definition at line 38 of file CRNMath.h.