PCL
Mathematical Functions

## Classes

class  pcl::Fact< T >
Factorial function. More...

class  pcl::Pow10I< T >
Exponential function 10**n, n being a signed integer. More...

class  pcl::Pow2I< T >
Exponential function 2**n, n being a signed integer. More...

## Functions

float pcl::Abs (float x)

template<typename T >
constexpr T pcl::Angle (int d, T m)

template<typename T >
constexpr T pcl::Angle (int d, int m, T s)

template<typename T >
constexpr T pcl::ArcCos (T x)

template<typename T >
constexpr T pcl::ArcCosh (T x)

template<typename T >
constexpr T pcl::ArcHav (T x)

template<typename T >
constexpr T pcl::ArcSin (T x)

template<typename T >
constexpr T pcl::ArcSinh (T x)

template<typename T >
constexpr T pcl::ArcTan (T x)

template<typename T >
constexpr T pcl::ArcTan (T y, T x)

template<typename T >
pcl::ArcTan2Pi (T y, T x)

template<typename T >
constexpr T pcl::ArcTanh (T x)

template<typename T >

template<typename T >
constexpr T pcl::Ceil (T x)

void PCL_FUNC pcl::ComplexTimeToJD (int &jdi, double &jdf, int year, int month, int day, double dayf=0)

double pcl::ComplexTimeToJD (int year, int month, int day, double dayf=0)

template<typename T >
constexpr T pcl::Cos (T x)

template<typename T >
constexpr T pcl::Cosh (T x)

template<typename T >
constexpr T pcl::Cotan (T x)

template<typename S1 , typename S2 , typename S3 , typename D >
void pcl::DecimalToSexagesimal (int &sign, S1 &s1, S2 &s2, S3 &s3, const D &d)

template<typename T >
constexpr T pcl::Deg (T x)

template<typename T >
constexpr T pcl::Exp (T x)

template<typename T >
constexpr T pcl::Floor (T x)

template<typename T >
constexpr T pcl::Frac (T x)

template<typename T >
void pcl::Frexp (T x, T &m, int &p)

template<typename T >
constexpr T pcl::Hav (T x)

void PCL_FUNC pcl::JDToComplexTime (int &year, int &month, int &day, double &dayf, int jdi, double jdf)

void pcl::JDToComplexTime (int &year, int &month, int &day, double &dayf, double jd)

template<typename T >
double pcl::L1Norm (const T *i, const T *j)

template<typename T >
double pcl::L2Norm (const T *i, const T *j)

template<typename T >
constexpr T pcl::Ldexp (T m, int p)

template<typename T >
constexpr T pcl::Ln (T x)

constexpr long double pcl::Ln2 ()

template<typename T >
constexpr T pcl::Log (T x)

constexpr long double pcl::Log2 ()

template<typename T >
constexpr T pcl::Log2 (T x)

constexpr long double pcl::Log2e ()

constexpr long double pcl::Log2T ()

template<typename T >
constexpr T pcl::LogN (T n, T x)

template<typename T >

template<typename T >

template<typename T >
constexpr T pcl::Mod (T x, T y)

template<typename T >
constexpr T pcl::Mod2Pi (T x)

template<typename T >
double pcl::Norm (const T *i, const T *j, double p)

template<typename T >
double pcl::Norm (const T *i, const T *j)

template<typename T >
constexpr T pcl::Norm2Pi (T x)

constexpr long double pcl::Pi ()

template<typename T , typename C >
pcl::Poly (T x, C c, int n)

template<typename T >
pcl::Poly (T x, std::initializer_list< T > c)

template<typename T >
constexpr T pcl::Pow (T x, T y)

template<typename T >
pcl::Pow10 (T x)

template<typename T >
constexpr T pcl::Pow2 (T x)

template<typename T >
pcl::PowI (T x, int n)

template<typename T >

template<typename T >

template<typename T >

template<typename T , typename T1 , typename T2 >
void pcl::Rotate (T &x, T &y, T1 sa, T1 ca, T2 xc, T2 yc)

template<typename T1 , typename T2 >
void pcl::Rotate (int &x, int &y, T1 sa, T1 ca, T2 xc, T2 yc)

template<typename T1 , typename T2 >
void pcl::Rotate (long &x, long &y, T1 sa, T1 ca, T2 xc, T2 yc)

template<typename T1 , typename T2 >
void pcl::Rotate (int64 &x, int64 &y, T1 sa, T1 ca, T2 xc, T2 yc)

template<typename T , typename T1 , typename T2 >
void pcl::Rotate (T &x, T &y, T1 a, T2 xc, T2 yc)

template<typename T >
pcl::RotL (T x, uint32 n)

template<typename T >
pcl::RotR (T x, uint32 n)

double pcl::Round (double x)

float pcl::Round (float x)

long double pcl::Round (long double x)

template<typename T >
pcl::Round (T x, int n)

template<typename T >
int pcl::RoundI (T x)

template<typename T >
int pcl::RoundInt (T x)

int64 pcl::RoundInt64 (double x)

int64 pcl::RoundInt64Arithmetic (double x)

template<typename T >
int pcl::RoundIntArithmetic (T x)

template<typename T >
int pcl::RoundIntBanker (T x)

template<typename T >

template<typename S1 , typename S2 , typename S3 >
double pcl::SexagesimalToDecimal (int sign, const S1 &s1, const S2 &s2=S2(0), const S3 &s3=S3(0))

template<typename T >
constexpr int pcl::Sign (T x)

template<typename T >
constexpr char pcl::SignChar (T x)

template<typename T >
constexpr T pcl::Sin (T x)

template<typename T >
void pcl::SinCos (T x, T &sx, T &cx)

template<typename T >
constexpr T pcl::Sinh (T x)

template<typename T >
void pcl::Split (T x, T &i, T &f)

template<typename T >
constexpr T pcl::Sqrt (T x)

template<typename T >
constexpr T pcl::Tan (T x)

template<typename T >
constexpr T pcl::Tanh (T x)

template<typename T >
pcl::Trunc (T x)

template<typename T >
int pcl::TruncI (T x)

template<typename T >
int64 pcl::TruncI64 (T x)

template<typename T >
int pcl::TruncInt (T x)

template<typename T >
int64 pcl::TruncInt64 (T x)

constexpr long double pcl::TwoPi ()

template<typename T >

## ◆ Abs()

 float pcl::Abs ( float x )
inline

Absolute value of x.

Definition at line 281 of file Math.h.

References pcl::Abs().

## ◆ Angle() [1/2]

template<typename T >
 constexpr T pcl::Angle ( int d, T m )
inline

Merges a complex angle given by degrees and arcminutes into single degrees.

Definition at line 442 of file Math.h.

## ◆ Angle() [2/2]

template<typename T >
 constexpr T pcl::Angle ( int d, int m, T s )
inline

Merges a complex angle given by degrees, arcminutes and arcseconds into single degrees.

Definition at line 452 of file Math.h.

## ◆ ArcCos()

template<typename T >
 constexpr T pcl::ArcCos ( T x )
inline

Inverse cosine function (arccosine).

Definition at line 463 of file Math.h.

Referenced by pcl::ProjectionBase::DistanceFast().

## ◆ ArcCosh()

template<typename T >
 constexpr T pcl::ArcCosh ( T x )
inline

Inverse hyperbolic cosine function.

`ArcCosh( x ) = 2*Ln( Sqrt( (x + 1)/2 ) + Sqrt( (x - 1)/2 ) )`

Definition at line 1687 of file Math.h.

## ◆ ArcHav()

template<typename T >
 constexpr T pcl::ArcHav ( T x )
inline

Inverse haversine (archaversine?) function.

`ArcHav( x ) = 2*ArcSin( Sqrt( x ) )`

The haversine is nice to work with tiny angles.

Definition at line 1717 of file Math.h.

## ◆ ArcSin()

template<typename T >
 constexpr T pcl::ArcSin ( T x )
inline

Inverse sine function (arcsine).

Definition at line 475 of file Math.h.

Referenced by pcl::ZenithalEqualAreaProjection::Name().

## ◆ ArcSinh()

template<typename T >
 constexpr T pcl::ArcSinh ( T x )
inline

Inverse hyperbolic sine function.

`ArcSinh( x ) = Ln( x + Sqrt( 1 + x**2 ) )`

Definition at line 1673 of file Math.h.

## ◆ ArcTan() [1/2]

template<typename T >
 constexpr T pcl::ArcTan ( T x )
inline

Inverse tangent function (arctangent).

Definition at line 487 of file Math.h.

Referenced by pcl::StereographicProjection::Name(), and pcl::ZenithalProjectionBase::Unproject().

## ◆ ArcTan() [2/2]

template<typename T >
 constexpr T pcl::ArcTan ( T y, T x )
inline

Arctangent of y/x, result in the proper quadrant.

Definition at line 498 of file Math.h.

## ◆ ArcTan2Pi()

template<typename T >
 T pcl::ArcTan2Pi ( T y, T x )
inline

Arctangent of y/x, proper quadrant, result in the interval [0,2pi).

Definition at line 509 of file Math.h.

## ◆ ArcTanh()

template<typename T >
 constexpr T pcl::ArcTanh ( T x )
inline

Inverse hyperbolic tangent function.

`ArcTanh( x ) = (Ln( 1 + x ) - Ln( 1 - x ))/2`

Definition at line 1701 of file Math.h.

template<typename T >
 constexpr T pcl::AsRad ( T x )
inline

Definition at line 1781 of file Math.h.

Referenced by pcl::Position::EpsA().

## ◆ Ceil()

template<typename T >
 constexpr T pcl::Ceil ( T x )
inline

The ceil function: lowest integer >= x.

Definition at line 523 of file Math.h.

## ◆ ComplexTimeToJD() [1/2]

 void PCL_FUNC pcl::ComplexTimeToJD ( int & jdi, double & jdf, int year, int month, int day, double dayf = `0` )

Computes the Julian date (JD) corresponding to a time point expressed as a date and a day fraction, providing the result by its separate integer and fractional parts.

Parameters
 jdi On output, the integer part of the resulting JD. jdf On output, the fractional part of the resulting JD. year The year of the date. Positive and negative years are supported. Years are counted arithmetically: the year zero is the year before the year +1, that is, what historians call the year 1 B.C. month The month of the date. Usually in the [1,12] range but can be any integer number. day The day of the date. Usually in the [1,31] range but can be any integer number. dayf The day fraction. The default value is zero, which computes the JD at zero hours. Usually in the [0,1) range but can be any real number.

This routine, as well as JDToComplexTime(), implement modified versions of the original algorithms due to Jean Meeus. Our modifications allow for negative Julian dates, which extends the range of allowed dates to the past considerably. We developed these modifications in the context of large-scale solar system ephemeris calculations.

The computed value is the JD corresponding to the specified date and day fraction, which is equal to the sum of the jdi and jdf variables.

References

Meeus, Jean (1991), Astronomical Algorithms, Willmann-Bell, Inc., chapter 7.

Referenced by pcl::ComplexTimeToJD(), and pcl::TimePoint::TimePoint().

## ◆ ComplexTimeToJD() [2/2]

 double pcl::ComplexTimeToJD ( int year, int month, int day, double dayf = `0` )
inline

Computes the Julian date (JD) corresponding to a time point expressed as a date and a day fraction.

Parameters
 year The year of the date. Positive and negative years are supported. Years are counted arithmetically: the year zero is the year before the year +1, that is, what historians call the year 1 B.C. month The month of the date. Usually in the [1,12] range but can be any integer number. day The day of the date. Usually in the [1,31] range but can be any integer number. dayf The day fraction. The default value is zero, which computes the JD at zero hours. Usually in the [0,1) range but can be any real number.

This routine, as well as JDToComplexTime(), implement modified versions of the original algorithms due to Jean Meeus. Our modifications allow for negative Julian dates, which extends the range of allowed dates to the past considerably. We developed these modifications in the context of large-scale solar system ephemeris calculations.

The returned value is the JD corresponding to the specified date and day fraction.

Because of the numerical precision of the double type (IEEE 64-bit floating point), this routine can return JD values accurate only to within one millisecond.

References

Meeus, Jean (1991), Astronomical Algorithms, Willmann-Bell, Inc., chapter 7.

Definition at line 2076 of file Math.h.

References pcl::ComplexTimeToJD().

## ◆ Cos()

template<typename T >
 constexpr T pcl::Cos ( T x )
inline

Cosine function.

Definition at line 534 of file Math.h.

## ◆ Cosh()

template<typename T >
 constexpr T pcl::Cosh ( T x )
inline

Hyperbolic Cosine function.

Definition at line 545 of file Math.h.

## ◆ Cotan()

template<typename T >
 constexpr T pcl::Cotan ( T x )
inline

Cotangent of x, equal to Cos(x)/Sin(x) or 1/Tan(x).

Definition at line 556 of file Math.h.

## ◆ DecimalToSexagesimal()

template<typename S1 , typename S2 , typename S3 , typename D >
 void pcl::DecimalToSexagesimal ( int & sign, S1 & s1, S2 & s2, S3 & s3, const D & d )
inline

Conversion of a decimal scalar d to the equivalent sexagesimal decimal components sign, s1, s2 and s3, such that:

d = sign * (s1 + (s2 + s3/60)/60)

with the following constraints:

sign = -1 iff d < 0
sign = +1 iff d ≥ 0
0 ≤ s1
0 ≤ s2 < 60
0 ≤ s3 < 60

Definition at line 2169 of file Math.h.

## ◆ Deg()

template<typename T >
 constexpr T pcl::Deg ( T x )
inline

Definition at line 567 of file Math.h.

## ◆ Exp()

template<typename T >
 constexpr T pcl::Exp ( T x )
inline

The exponential function e**x.

Definition at line 578 of file Math.h.

## ◆ Floor()

template<typename T >
 constexpr T pcl::Floor ( T x )
inline

The floor function: highest integer <= x.

Definition at line 589 of file Math.h.

## ◆ Frac()

template<typename T >
 constexpr T pcl::Frac ( T x )
inline

Fractional part of x. The returned value is within (-1,+1), and has the same sign as x.

Definition at line 601 of file Math.h.

## ◆ Frexp()

template<typename T >
 void pcl::Frexp ( T x, T & m, int & p )
inline

Calculates base-2 mantissa and exponent. The arguments m and p receive the values of the base-2 mantissa and exponent, respectively, such that: 0.5 <= m < 1.0, x = m * 2**p

Definition at line 614 of file Math.h.

## ◆ Hav()

template<typename T >
 constexpr T pcl::Hav ( T x )
inline

Haversine function.

`Hav( x ) = (1 - Cos( x ))/2`

The haversine is nice to work with tiny angles.

Definition at line 630 of file Math.h.

## ◆ JDToComplexTime() [1/2]

 void PCL_FUNC pcl::JDToComplexTime ( int & year, int & month, int & day, double & dayf, int jdi, double jdf )

Computes the date and day fraction corresponding to a time point expressed as a Julian date (JD), specified by its separate integer and fractional parts.

Parameters
 [out] year On output, this variable receives the year of the resulting date. [out] month On output, this variable receives the month of the resulting date in the range [1,12]. [out] day On output, this variable receives the day of the resulting date in the range [1,31]. Different month day counts and leap years are taken into account, so the returned day corresponds to an existing calendar date. [out] dayf On output, this variable receives the day fraction for the specified time point, in the [0,1) range. jdi The integer part of the input Julian date. jdf The fractional part of the input Julian date.

The input time point must be equal to the sum of jdi and jdf.

## ◆ JDToComplexTime() [2/2]

 void pcl::JDToComplexTime ( int & year, int & month, int & day, double & dayf, double jd )
inline

Computes the date and day fraction corresponding to a time point expressed as a Julian date (JD).

Parameters
 [out] year On output, this variable receives the year of the resulting date. [out] month On output, this variable receives the month of the resulting date in the range [1,12]. [out] day On output, this variable receives the day of the resulting date in the range [1,31]. Different month day counts and leap years are taken into account, so the returned day corresponds to an existing calendar date. [out] dayf On output, this variable receives the day fraction for the specified time point, in the [0,1) range. jd The input time point as a Julian date.

Because of the numerical precision of the double type (IEEE 64-bit floating point), this routine can handle JD values accurate only to within one millisecond.

Definition at line 2145 of file Math.h.

References pcl::Frac(), pcl::JDToComplexTime(), and pcl::TruncInt().

## ◆ L1Norm()

template<typename T >
 double pcl::L1Norm ( const T * i, const T * j )
inline

Computes the L1 norm (or Manhattan norm) of the elements in the sequence [i,j). The L1 norm is the sum of the absolute values of the elements.

Definition at line 1960 of file Math.h.

Referenced by pcl::GenericVector< sample *>::L1Norm().

## ◆ L2Norm()

template<typename T >
 double pcl::L2Norm ( const T * i, const T * j )
inline

Computes the L2 norm (or Euclidean norm) of the elements in the sequence [i,j). The L2 norm is the square root of the sum of squared elements.

Definition at line 1974 of file Math.h.

Referenced by pcl::GenericVector< sample *>::L2Norm(), and pcl::GenericVector< sample *>::Norm().

## ◆ Ldexp()

template<typename T >
 constexpr T pcl::Ldexp ( T m, int p )
inline

Calculates m * 2**p.

Definition at line 641 of file Math.h.

## ◆ Ln()

template<typename T >
 constexpr T pcl::Ln ( T x )
inline

Natural (base e) logarithm of x.

Definition at line 652 of file Math.h.

## ◆ Ln2()

 constexpr long double pcl::Ln2 ( )
inline

Natural (base e) logarithm of two.

Definition at line 718 of file Math.h.

## ◆ Log()

template<typename T >
 constexpr T pcl::Log ( T x )
inline

Base 10 Logarithm of x.

Definition at line 729 of file Math.h.

## ◆ Log2() [1/2]

 constexpr long double pcl::Log2 ( )
inline

Base 10 Logarithm of two.

Definition at line 740 of file Math.h.

## ◆ Log2() [2/2]

template<typename T >
 constexpr T pcl::Log2 ( T x )
inline

Base 2 Logarithm of x.

Definition at line 753 of file Math.h.

## ◆ Log2e()

 constexpr long double pcl::Log2e ( )
inline

Base 2 Logarithm of e.

Definition at line 766 of file Math.h.

## ◆ Log2T()

 constexpr long double pcl::Log2T ( )
inline

Base 2 Logarithm of ten.

Definition at line 779 of file Math.h.

## ◆ LogN()

template<typename T >
 constexpr T pcl::LogN ( T n, T x )
inline

Base n logarithm of x.

Definition at line 792 of file Math.h.

template<typename T >
 constexpr T pcl::MasRad ( T x )
inline

Conversion from milliarcseconds (mas) to radians.

Definition at line 1792 of file Math.h.

template<typename T >
 constexpr T pcl::MinRad ( T x )
inline

Definition at line 1761 of file Math.h.

## ◆ Mod()

template<typename T >
 constexpr T pcl::Mod ( T x, T y )
inline

Remainder of x/y.

Definition at line 803 of file Math.h.

Referenced by pcl::ZenithalEqualAreaProjection::Name().

## ◆ Mod2Pi()

template<typename T >
 constexpr T pcl::Mod2Pi ( T x )
inline

An angle in radians reduced to the (-2pi,+2pi) range, that is, the remainder of x/(2*pi).

Definition at line 1815 of file Math.h.

## ◆ Norm() [1/2]

template<typename T >
 double pcl::Norm ( const T * i, const T * j, double p )
inline

Computes the norm of the elements in the sequence [i,j). For any real p > 0, the norm N is given by:

N = sum( abs( x )^p )^(1/p)

for all x in [i,j).

L1Norm(), L2Norm()

Definition at line 1945 of file Math.h.

Referenced by pcl::GenericVector< sample *>::Norm().

## ◆ Norm() [2/2]

template<typename T >
 double pcl::Norm ( const T * i, const T * j )
inline

Computes the L2 norm (or Euclidean norm) of the elements in the sequence [i,j). This function is a synonym for L2Norm().

Definition at line 1988 of file Math.h.

## ◆ Norm2Pi()

template<typename T >
 constexpr T pcl::Norm2Pi ( T x )
inline

An angle in radians normalized to the [0,2pi) range.

Definition at line 1826 of file Math.h.

## ◆ Pi()

 constexpr long double pcl::Pi ( )
inline

The pi constant: 3.141592...

Definition at line 422 of file Math.h.

## ◆ Poly() [1/2]

template<typename T , typename C >
 T pcl::Poly ( T x, C c, int n )
inline

Horner's algorithm to evaluate the polynomial function with the specified array c of n + 1 coefficients:

`y = c + c*x + c*x**2 + ... + c[n]*x**n`

The array c of coefficients must provide contiguous storage for at least n + 1 values of type T. The degree n must be >= 0; otherwise this function invokes undefined behavior.

Definition at line 822 of file Math.h.

Referenced by pcl::Position::EpsA().

## ◆ Poly() [2/2]

template<typename T >
 T pcl::Poly ( T x, std::initializer_list< T > c )
inline

Horner's algorithm to evaluate the polynomial function:

`y = c + c*x + c*x**2 + ... + c[n]*x**n`

The specified coefficients initializer_list c must not be empty; otherwise this function invokes undefined behavior.

Definition at line 844 of file Math.h.

## ◆ Pow()

template<typename T >
 constexpr T pcl::Pow ( T x, T y )
inline

General power function: x raised to y.

When you know some of the arguments in advance, faster alternatives are:

• Use Pow10I<T>()( y ) when x == 10 and y is an integer
• Use PowI( x, y ) when x != 10 and y is an integer
• Use Pow10( y ) when x == 10 and y is not an integer

Otherwise, you can also use: Pow2( y*Log2( x ) )

Definition at line 1149 of file Math.h.

## ◆ Pow10()

template<typename T >
 T pcl::Pow10 ( T x )
inline

The exponential function 10**x.

Definition at line 1210 of file Math.h.

## ◆ Pow2()

template<typename T >
 constexpr T pcl::Pow2 ( T x )
inline

The exponential function 2**x.

Definition at line 1607 of file Math.h.

Referenced by pcl::PSFData::FWHM(), and pcl::MoffatFilter::FWHMx().

## ◆ PowI()

template<typename T >
 T pcl::PowI ( T x, int n )
inline

The exponential function x**n, where n is a signed integer.

Definition at line 1645 of file Math.h.

template<typename T >
 constexpr T pcl::Rad ( T x )
inline

Definition at line 1728 of file Math.h.

template<typename T >
 constexpr T pcl::RadMin ( T x )
inline

Definition at line 1739 of file Math.h.

template<typename T >
 constexpr T pcl::RadSec ( T x )
inline

Definition at line 1750 of file Math.h.

## ◆ Rotate() [1/5]

template<typename T , typename T1 , typename T2 >
 void pcl::Rotate ( T & x, T & y, T1 sa, T1 ca, T2 xc, T2 yc )
inline

Rotates a point on the plane.

Parameters
 [out] x,y Point coordinates. On output, these variables will receive the corresponding rotated coordinates. sa,ca Sine and cosine of the rotation angle. xc,yc Coordinates of the center of rotation.

Definition at line 1846 of file Math.h.

## ◆ Rotate() [2/5]

template<typename T1 , typename T2 >
 void pcl::Rotate ( int & x, int & y, T1 sa, T1 ca, T2 xc, T2 yc )
inline

Rotates a point on the plane.

This is a template instantiation of Rotate( T&, T&, T1, T1, T2, T2 ) for the `int` type.

Rotated coordinates are rounded to the nearest integers.

Definition at line 1865 of file Math.h.

References pcl::RoundInt().

## ◆ Rotate() [3/5]

template<typename T1 , typename T2 >
 void pcl::Rotate ( long & x, long & y, T1 sa, T1 ca, T2 xc, T2 yc )
inline

Rotates a point on the plane.

This is a template instantiation of Rotate( T&, T&, T1, T1, T2, T2 ) for the `long` type.

Rotated coordinates are rounded to the nearest integers.

Definition at line 1884 of file Math.h.

References pcl::RoundInt().

## ◆ Rotate() [4/5]

template<typename T1 , typename T2 >
 void pcl::Rotate ( int64 & x, int64 & y, T1 sa, T1 ca, T2 xc, T2 yc )
inline

Rotates a point on the plane.

This is a template instantiation of Rotate( T&, T&, T1, T1, T2, T2 ) for the `int64` type.

Rotated coordinates are rounded to the nearest integers.

Definition at line 1903 of file Math.h.

References pcl::RoundInt64().

## ◆ Rotate() [5/5]

template<typename T , typename T1 , typename T2 >
 void pcl::Rotate ( T & x, T & y, T1 a, T2 xc, T2 yc )
inline

Rotates a point on the plane.

Parameters
 [out] x,y Point coordinates. On output, these variables will receive the corresponding rotated coordinates. a Rotation angle in radians. xc,yc Coordinates of the center of rotation.

Instantiations for integer types round rotated coordinated to the nearest integers.

Definition at line 1927 of file Math.h.

## ◆ RotL()

template<typename T >
 T pcl::RotL ( T x, uint32 n )
inline

Bitwise rotate left function: Rotates x to the left by n bits.

The template argument T must be an unsigned arithmetic type (uint8, uint16, uint32 or uint64). The bit count n must be smaller than the number of bits required to store an instance of T; for example, if T is uint32, n must be in the range [0,31].

Definition at line 1228 of file Math.h.

Referenced by pcl::BigToLittleEndian(), pcl::XoShiRo256ss::UI64(), and pcl::XoRoShiRo1024ss::UI64().

## ◆ RotR()

template<typename T >
 T pcl::RotR ( T x, uint32 n )
inline

Bitwise rotate right function: Rotates x to the right by n bits.

The template argument T must be an unsigned arithmetic type (uint8, uint16, uint32 or uint64). The bit count n must be smaller than the number of bits required to store an instance of T; for example, if T is uint32, n must be in the range [0,31].

Definition at line 1249 of file Math.h.

Referenced by pcl::BigToLittleEndian().

## ◆ Round() [1/4]

 double pcl::Round ( double x )
inline

Round function: x rounded to the nearest integer (double precision version).

Note
This is a performance-critical routine. It has been implemented using high-performance, low-level techniques that may include inline assembly code and/or compiler intrinsic functions.

Definition at line 1271 of file Math.h.

## ◆ Round() [2/4]

 float pcl::Round ( float x )
inline

Round function: x rounded to the nearest integer (single precision version).

Note
This is a performance-critical routine. It has been implemented using high-performance, low-level techniques that may include inline assembly code and/or compiler intrinsic functions.

Definition at line 1304 of file Math.h.

## ◆ Round() [3/4]

 long double pcl::Round ( long double x )
inline

Round function: x rounded to the nearest integer (long double version).

Note
This is a performance-critical routine. It has been implemented using high-performance, low-level techniques that may include inline assembly code and/or compiler intrinsic functions.

Definition at line 1337 of file Math.h.

## ◆ Round() [4/4]

template<typename T >
 T pcl::Round ( T x, int n )
inline

General rounding function: x rounded to n fractional digits.

Definition at line 1595 of file Math.h.

## ◆ RoundI()

template<typename T >
 int pcl::RoundI ( T x )
inline

RoundI function: Rounds x to the nearest integer and converts the result to a 32-bit signed integer.

Deprecated:
Use RoundInt() in newly produced code.

Definition at line 1438 of file Math.h.

## ◆ RoundInt()

template<typename T >
 int pcl::RoundInt ( T x )
inline

RoundInt function: Rounds x to the nearest integer and converts the result to a 32-bit signed integer.

This function follows the Banker's rounding rule: a perfect half is always rounded to the nearest even digit. Some examples:

RoundInt( 0.5 ) -> 0 RoundInt( 1.5 ) -> 2 RoundInt( 2.5 ) -> 2 RoundInt( 3.5 ) -> 4

By contrast, arithmetic rounding rounds a perfect half to the nearest digit, either odd or even. For example:

RoundIntArithmetic( 0.5 ) -> 1 RoundIntArithmetic( 1.5 ) -> 2 RoundIntArithmetic( 2.5 ) -> 3 RoundIntArithmetic( 3.5 ) -> 4

Banker's rounding (also known as Gaussian rounding) is statistically more accurate than the usual arithmetic rounding, but it causes aliasing problems in some specific algorithms that depend critically on uniform rounding, such as nearest neighbor upsampling.

Note
This is a performance-critical routine. It has been implemented using high-performance, low-level techniques that may include inline assembly code and/or compiler intrinsic functions.
RoundIntArithmetic(), RoundIntBanker()

Definition at line 1397 of file Math.h.

## ◆ RoundInt64()

 int64 pcl::RoundInt64 ( double x )
inline

RoundInt64 function: Rounds x to the nearest integer and converts the result to a 64-bit signed integer.

Since the default IEEE 754 rounding mode follows Banker's rounding rule, this is what you should expect when calling this function. See the documentation for RoundInt() for more information on rounding modes.

Note
This is a performance-critical routine. It has been implemented using high-performance, low-level techniques that may include inline assembly code and/or compiler intrinsic functions.

Definition at line 1512 of file Math.h.

References pcl::Round().

Referenced by pcl::Rotate(), and pcl::RoundI64().

## ◆ RoundInt64Arithmetic()

 int64 pcl::RoundInt64Arithmetic ( double x )
inline

Rounds x to the nearest integer using the arithmetic rounding rule, and converts the result to a 64-bit signed integer.

Arithmetic rounding rounds a perfect half to the nearest digit, either odd or even. For example:

RoundIntArithmetic( 0.5 ) -> 1 RoundIntArithmetic( 1.5 ) -> 2 RoundIntArithmetic( 2.5 ) -> 3 RoundIntArithmetic( 3.5 ) -> 4

Note
This is a performance-critical routine. It has been implemented using high-performance, low-level techniques that may include inline assembly code and/or compiler intrinsic functions.
RoundInt(), RoundIntBanker()

Definition at line 1573 of file Math.h.

References pcl::TruncInt64().

## ◆ RoundIntArithmetic()

template<typename T >
 int pcl::RoundIntArithmetic ( T x )
inline

Rounds x to the nearest integer using the arithmetic rounding rule, and converts the result to a 32-bit signed integer.

Arithmetic rounding rounds a perfect half to the nearest digit, either odd or even. For example:

RoundIntArithmetic( 0.5 ) -> 1 RoundIntArithmetic( 1.5 ) -> 2 RoundIntArithmetic( 2.5 ) -> 3 RoundIntArithmetic( 3.5 ) -> 4

Note
This is a performance-critical routine. It has been implemented using high-performance, low-level techniques that may include inline assembly code and/or compiler intrinsic functions.
RoundInt(), RoundIntBanker()

Definition at line 1478 of file Math.h.

## ◆ RoundIntBanker()

template<typename T >
 int pcl::RoundIntBanker ( T x )
inline

Rounds x to the nearest integer using the Banker's rounding rule, and converts the result to a 32-bit signed integer.

This function is a convenience synonym for RoundInt().

Definition at line 1451 of file Math.h.

template<typename T >
 constexpr T pcl::SecRad ( T x )
inline

Definition at line 1772 of file Math.h.

## ◆ SexagesimalToDecimal()

template<typename S1 , typename S2 , typename S3 >
 double pcl::SexagesimalToDecimal ( int sign, const S1 & s1, const S2 & s2 = `S2( 0 )`, const S3 & s3 = `S3( 0 )` )
inline

Conversion of the sexagesimal decimal components sign, s1, s2 and s3 to their equivalent decimal scalar. The returned value is equal to:

((sign < 0) ? -1 : +1)*(Abs( s1 ) + (s2 + s3/60)/60);

Definition at line 2189 of file Math.h.

References pcl::Abs().

## ◆ Sign()

template<typename T >
 constexpr int pcl::Sign ( T x )
inline

Sign function:

• -1 if x < 0
• 0 if x == 0
• +1 if x > 0

Definition at line 861 of file Math.h.

## ◆ SignChar()

template<typename T >
 constexpr char pcl::SignChar ( T x )
inline

Sign character:

• '-' if x < 0
• ' ' if x == 0
• '+' if x > 0

Definition at line 877 of file Math.h.

## ◆ Sin()

template<typename T >
 constexpr T pcl::Sin ( T x )
inline

Sine function

Definition at line 888 of file Math.h.

## ◆ SinCos()

template<typename T >
 void pcl::SinCos ( T x, T & sx, T & cx )
inline

Sine and cosine of x.

The arguments sx and cx will receive, respectively, the values of the sine and cosine of x.

If supported by the underlying standard math library, this function is roughly twice as fast as calling Sin() and Cos() separately. For code that spend a significant amount of time calculating sines and cosines, this optimization is critical.

Definition at line 938 of file Math.h.

## ◆ Sinh()

template<typename T >
 constexpr T pcl::Sinh ( T x )
inline

Hyperbolic Sine function.

Definition at line 899 of file Math.h.

## ◆ Split()

template<typename T >
 void pcl::Split ( T x, T & i, T & f )
inline

Integer and fractional parts of x.

The arguments i and f receive, respectively, the integer (truncated) part and the fractional part of x. It holds that x = i + f, i.e. both i and f have the same sign as x.

Definition at line 959 of file Math.h.

## ◆ Sqrt()

template<typename T >
 constexpr T pcl::Sqrt ( T x )
inline

Square root function.

Definition at line 970 of file Math.h.

## ◆ Tan()

template<typename T >
 constexpr T pcl::Tan ( T x )
inline

Tangent function.

Definition at line 981 of file Math.h.

## ◆ Tanh()

template<typename T >
 constexpr T pcl::Tanh ( T x )
inline

Hyperbolic Tangent function.

Definition at line 992 of file Math.h.

## ◆ Trunc()

template<typename T >
 T pcl::Trunc ( T x )
inline

Truncated integer part of x.

Definition at line 1003 of file Math.h.

## ◆ TruncI()

template<typename T >
 int pcl::TruncI ( T x )
inline

TruncI function: Truncated integer part of x as a 32-bit signed integer. to a 32-bit signed integer.

Deprecated:
Use TruncInt() in newly produced code.

Definition at line 1057 of file Math.h.

## ◆ TruncI64()

template<typename T >
 int64 pcl::TruncI64 ( T x )
inline

TruncI64 function: Truncated integer part of x as a 64-bit signed integer.

Deprecated:
Use TruncInt64() in newly produced code.

Definition at line 1129 of file Math.h.

## ◆ TruncInt()

template<typename T >
 int pcl::TruncInt ( T x )
inline

TruncInt function: Truncated integer part of x as a 32-bit signed integer.

Note
This is a performance-critical routine. It has been implemented using high-performance, low-level techniques that may include inline assembly code and/or compiler intrinsic functions.

Definition at line 1035 of file Math.h.

## ◆ TruncInt64()

template<typename T >
 int64 pcl::TruncInt64 ( T x )
inline

TruncInt64 function: Truncated integer part of x as a 64-bit signed integer.

Note
This is a performance-critical routine. It has been implemented using high-performance, low-level techniques that may include inline assembly code and/or compiler intrinsic functions.

Definition at line 1107 of file Math.h.

Referenced by pcl::RoundInt64Arithmetic().

## ◆ TwoPi()

 constexpr long double pcl::TwoPi ( )
inline

Twice the pi constant: 0.6283185...

Definition at line 431 of file Math.h.

Referenced by pcl::GenericVector< sample *>::ToSpherical2Pi().