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 >
constexpr T pcl::AsRad (T x)
 
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 >
constexpr T pcl::MasRad (T x)
 
template<typename T >
constexpr T pcl::MinRad (T x)
 
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 >
constexpr T pcl::Rad (T x)
 
template<typename T >
constexpr T pcl::RadMin (T x)
 
template<typename T >
constexpr T pcl::RadSec (T x)
 
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 >
constexpr T pcl::SecRad (T x)
 
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 >
constexpr T pcl::UasRad (T x)
 

Detailed Description

Function Documentation

◆ 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,
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,
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 ( 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 ( 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 ( 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 ( 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 ( 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 ( 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 ( y,
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 ( y,
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 ( x)
inline

Inverse hyperbolic tangent function.

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

Definition at line 1701 of file Math.h.

◆ AsRad()

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

Conversion from arcseconds to radians (a synonym for SecRad()).

Definition at line 1781 of file Math.h.

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

◆ Ceil()

template<typename T >
constexpr T pcl::Ceil ( 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
jdiOn output, the integer part of the resulting JD.
jdfOn output, the fractional part of the resulting JD.
yearThe 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.
monthThe month of the date. Usually in the [1,12] range but can be any integer number.
dayThe day of the date. Usually in the [1,31] range but can be any integer number.
dayfThe 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
yearThe 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.
monthThe month of the date. Usually in the [1,12] range but can be any integer number.
dayThe day of the date. Usually in the [1,31] range but can be any integer number.
dayfThe 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 ( x)
inline

Cosine function.

Definition at line 534 of file Math.h.

◆ Cosh()

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

Hyperbolic Cosine function.

Definition at line 545 of file Math.h.

◆ Cotan()

template<typename T >
constexpr T pcl::Cotan ( 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()

◆ Exp()

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

The exponential function e**x.

Definition at line 578 of file Math.h.

◆ Floor()

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

The floor function: highest integer <= x.

Definition at line 589 of file Math.h.

◆ Frac()

template<typename T >
constexpr T pcl::Frac ( 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.

Referenced by pcl::TimePoint::GetComplexTime(), pcl::JDToComplexTime(), pcl::TimePoint::TimePoint(), and pcl::TimePoint::TryFromString().

◆ Frexp()

template<typename T >
void pcl::Frexp ( 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 ( 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]yearOn output, this variable receives the year of the resulting date.
[out]monthOn output, this variable receives the month of the resulting date in the range [1,12].
[out]dayOn 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]dayfOn output, this variable receives the day fraction for the specified time point, in the [0,1) range.
jdiThe integer part of the input Julian date.
jdfThe fractional part of the input Julian date.

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

For more information about the implemented algorithms and references, see the documentation for ComplexTimeToJD().

Referenced by pcl::TimePoint::Day(), pcl::TimePoint::DayFraction(), pcl::TimePoint::GetComplexTime(), pcl::JDToComplexTime(), pcl::TimePoint::Month(), and pcl::TimePoint::Year().

◆ 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]yearOn output, this variable receives the year of the resulting date.
[out]monthOn output, this variable receives the month of the resulting date in the range [1,12].
[out]dayOn 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]dayfOn output, this variable receives the day fraction for the specified time point, in the [0,1) range.
jdThe 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.

For more information about the implemented algorithms and references, see the documentation for ComplexTimeToJD().

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 ( m,
int  p 
)
inline

Calculates m * 2**p.

Definition at line 641 of file Math.h.

◆ Ln()

template<typename T >
constexpr T pcl::Ln ( 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 ( 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 ( 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 ( n,
x 
)
inline

Base n logarithm of x.

Definition at line 792 of file Math.h.

◆ MasRad()

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

Conversion from milliarcseconds (mas) to radians.

Definition at line 1792 of file Math.h.

◆ MinRad()

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

Conversion from arcminutes to radians.

Definition at line 1761 of file Math.h.

◆ Mod()

template<typename T >
constexpr T pcl::Mod ( x,
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 ( 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).

See also
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 ( 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 ( x,
c,
int  n 
)
inline

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

y = c[0] + c[1]*x + c[2]*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 ( x,
std::initializer_list< T >  c 
)
inline

Horner's algorithm to evaluate the polynomial function:

y = c[0] + c[1]*x + c[2]*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 ( x,
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 ( x)
inline

The exponential function 10**x.

Definition at line 1210 of file Math.h.

◆ Pow2()

template<typename T >
constexpr T pcl::Pow2 ( 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 ( x,
int  n 
)
inline

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

Definition at line 1645 of file Math.h.

◆ Rad()

◆ RadMin()

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

Conversion from radians to arcminutes.

Definition at line 1739 of file Math.h.

◆ RadSec()

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

Conversion from radians to arcseconds.

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,yPoint coordinates. On output, these variables will receive the corresponding rotated coordinates.
sa,caSine and cosine of the rotation angle.
xc,ycCoordinates of the center of rotation.

Definition at line 1846 of file Math.h.

Referenced by pcl::GenericPoint< T >::Rotate(), pcl::Rotate(), pcl::Array< GenericVector< T > >::Rotate(), and pcl::GenericRectangle< T >::Rotate().

◆ 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,yPoint coordinates. On output, these variables will receive the corresponding rotated coordinates.
aRotation angle in radians.
xc,ycCoordinates 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 ( 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 ( 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 ( 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 ( 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 ( 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.
See also
RoundIntArithmetic(), RoundIntBanker()

Definition at line 1397 of file Math.h.

Referenced by pcl::Histogram::HistogramLevel(), pcl::Sizer::LogicalPixelsToPhysical(), pcl::Control::LogicalPixelsToPhysical(), pcl::Sizer::PhysicalPixelsToLogical(), pcl::Control::PhysicalPixelsToLogical(), pcl::Histogram::Resample(), pcl::Rotate(), pcl::GenericPoint< T >::RoundedToInt(), pcl::GenericRectangle< T >::RoundedToInt(), pcl::Control::ScaledCursorHotSpot(), pcl::UInt20PixelTraits::ToSample(), pcl::UInt24PixelTraits::ToSample(), pcl::UIResourceScalingIndex(), pcl::UIScaled(), and pcl::UIUnscaled().

◆ 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

See the RoundInt() function for more information on rounding rules.

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.
See also
RoundInt(), RoundIntBanker()

Definition at line 1573 of file Math.h.

References pcl::TruncInt64().

◆ RoundIntArithmetic()

template<typename T >
int pcl::RoundIntArithmetic ( 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

See the RoundInt() function for more information on rounding rules.

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.
See also
RoundInt(), RoundIntBanker()

Definition at line 1478 of file Math.h.

◆ RoundIntBanker()

template<typename T >
int pcl::RoundIntBanker ( 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.

◆ SecRad()

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

Conversion from arcseconds to radians.

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 ( 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 ( 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 ( x)
inline

Sine function

Definition at line 888 of file Math.h.

◆ SinCos()

template<typename T >
void pcl::SinCos ( 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.

Referenced by pcl::ProjectionBase::Distance(), pcl::ProjectionBase::DistanceFast(), pcl::Position::EquatorialToEcliptic(), pcl::GenericVector< sample *>::FromSpherical(), pcl::GnomonicProjection::GnomonicProjection(), pcl::ZenithalProjectionBase::Project(), pcl::GenericRectangle< T >::Rotate(), pcl::GenericMatrix< coefficient >::RotateX(), pcl::GenericMatrix< coefficient >::RotateY(), and pcl::GenericMatrix< coefficient >::RotateZ().

◆ Sinh()

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

Hyperbolic Sine function.

Definition at line 899 of file Math.h.

◆ Split()

template<typename T >
void pcl::Split ( 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 ( x)
inline

Square root function.

Definition at line 970 of file Math.h.

◆ Tan()

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

Tangent function.

Definition at line 981 of file Math.h.

◆ Tanh()

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

Hyperbolic Tangent function.

Definition at line 992 of file Math.h.

◆ Trunc()

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

◆ TruncI()

template<typename T >
int pcl::TruncI ( 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 ( 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 ( 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.

Referenced by pcl::JPLEphemeris::ComputeState(), pcl::JPLEphemeris::DENumber(), pcl::TimePoint::GetComplexTime(), pcl::JDToComplexTime(), pcl::JPLEphemeris::LENumber(), pcl::TimePoint::TimePoint(), pcl::GenericPoint< T >::TruncatedToInt(), pcl::GenericRectangle< T >::TruncatedToInt(), and pcl::TimePoint::TryFromString().

◆ TruncInt64()

template<typename T >
int64 pcl::TruncInt64 ( 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().

◆ UasRad()

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

Conversion from microarcseconds (uas) to radians.

Definition at line 1803 of file Math.h.