ViSP  2.10.0
vpMath Class Reference

#include <vpMath.h>

## Static Public Member Functions

static double sqr (double x)

static double fact (unsigned int x)

static long double comb (unsigned int n, unsigned int p)

static int round (const double x)

static int sign (double x)

static bool nul (double x, double s=0.001)

static bool equal (double x, double y, double s=0.001)

static bool greater (double x, double y, double s=0.001)

template<class Type >
static Type maximum (const Type &a, const Type &b)

template<class Type >
static Type minimum (const Type &a, const Type &b)

template<class Type >
static Type abs (const Type &x)

static double sinc (double x)

static double sinc (double sinx, double x)

static double mcosc (double cosx, double x)

static double msinc (double sinx, double x)

static double sigmoid (double x, double x0=0., double x1=1., double n=12.)

template<class Type >
static void swap (Type &a, Type &b)

## Detailed Description

Provides simple mathematics computation tools that are not available in the C mathematics library (math.h)

Definition at line 83 of file vpMath.h.

## Member Function Documentation

template<class Type >
 static Type vpMath::abs ( const Type & x )
inlinestatic

Find the absolute value of a number (or other).

Parameters
 x : The number.
Returns
The absolute value of x

Definition at line 158 of file vpMath.h.

 long double vpMath::comb ( unsigned int n, unsigned int p )
inlinestatic

Computes the number of combination of p elements inside n elements.

Parameters
 n : total number of elements. p : requested number of elements.
Returns

Definition at line 213 of file vpMath.h.

References fact().

 static double vpMath::deg ( double rad )
inlinestatic
 bool vpMath::equal ( double x, double y, double s = 0.001 )
inlinestatic

Compares to .

Parameters
 x : x value. y : y value. s : Tolerance threshold.
Returns
true if .

Definition at line 275 of file vpMath.h.

References nul().

 double vpMath::fact ( unsigned int x )
inlinestatic

Computes and returns x!

Parameters
 x : parameter of factorial function.

Definition at line 199 of file vpMath.h.

Referenced by comb().

 bool vpMath::greater ( double x, double y, double s = 0.001 )
inlinestatic

Compares to .

Parameters
 x : x value. y : y value. s : Tolerance threshold.
Returns
true if .

Definition at line 287 of file vpMath.h.

template<class Type >
 static Type vpMath::maximum ( const Type & a, const Type & b )
inlinestatic

Find the maximum between two numbers (or other).

Parameters
 a : First number. b : Second number.
Returns
The maximum of the two numbers.

Definition at line 137 of file vpMath.h.

 double vpMath::mcosc ( double cosx, double x )
inlinestatic

Compute

Parameters
 cosx : Value of cos(x). x : Value of x.
Returns

Definition at line 331 of file vpMath.h.

template<class Type >
 static Type vpMath::minimum ( const Type & a, const Type & b )
inlinestatic

Find the minimum between two numbers (or other).

Parameters
 a : First number. b : Second number.
Returns
The minimum of the two numbers.

Definition at line 148 of file vpMath.h.

 double vpMath::msinc ( double sinx, double x )
inlinestatic

Compute with .

Parameters
 sinx : value of sin(x). x : Value of x.
Returns

Definition at line 347 of file vpMath.h.

Referenced by vpExponentialMap::direct(), and vpExponentialMap::inverse().

 bool vpMath::nul ( double x, double s = 0.001 )
inlinestatic

Compares to .

Parameters
 x : Value to test. s : Tolerance threshold
Returns
true if .

Definition at line 263 of file vpMath.h.

Referenced by equal().

 int vpMath::round ( const double x )
inlinestatic

Round x to the nearest integer.

Parameters
 x : Value to round.
Returns
Nearest integer of x.

Definition at line 228 of file vpMath.h.

References sign().

 double vpMath::sigmoid ( double x, double x0 = 0., double x1 = 1., double n = 12. )
inlinestatic

Sigmoid function between [x0,x1] with and

Parameters
 x : Value of x. x0 : Lower bound (default 0). x1 : Upper bound (default 1). n : Degree of the exponential (default 12).
Returns

Definition at line 363 of file vpMath.h.

 int vpMath::sign ( double x )
inlinestatic

Return the sign of x.

Returns
-1 if x is negative, +1 if positive.

Definition at line 248 of file vpMath.h.

Referenced by vpMbEdgeTracker::computeVVS(), round(), and vpMeNurbs::seekExtremities().

 double vpMath::sinc ( double x )
inlinestatic

Compute sinus cardinal .

Parameters
 x : Value of x.
Returns
Sinus cardinal.

Definition at line 301 of file vpMath.h.

 double vpMath::sinc ( double sinx, double x )
inlinestatic

Compute sinus cardinal .

Parameters
 sinx : Value of sin(x). x : Value of x.
Returns
Sinus cardinal.

Definition at line 316 of file vpMath.h.

template<class Type >
 static void vpMath::swap ( Type & a, Type & b )
inlinestatic

Exchange two numbers.

Parameters
 a First number to exchange. b Second number to exchange

Definition at line 179 of file vpMath.h.