Visual Servoing Platform version 3.7.0
Loading...
Searching...
No Matches
vpMath Class Reference

#include <vpMath.h>

Public Types

typedef vpHomogeneousMatrix(* LongLattToHomogeneous) (double lonDeg, double latDeg, double radius)

Static Public Member Functions

static double deg (double rad)
static vpColVector deg (const vpRotationVector &r)
static vpColVector deg (const vpColVector &r)
static double rad (double deg)
static vpColVector rad (const vpColVector &r)
static float getAngleBetweenMinPiAndPi (const float &theta)
static double getAngleBetweenMinPiAndPi (const double &theta)
static float modulo (const float &value, const float &modulo)
static double modulo (const double &value, const double &modulo)
static double sqr (double x)
static double fact (unsigned int x)
static long double comb (unsigned int n, unsigned int p)
template<typename T>
static T clamp (const T &v, const T &lower, const T &upper)
static int round (double x)
static int sign (double x)
static bool nul (double x, double threshold=0.001)
static bool nul (float x, float threshold=0.001f)
static bool equal (double x, double y, double threshold=0.001)
static bool equal (float x, float y, float threshold=0.001f)
static bool greater (double x, double y, double threshold=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)
static bool isNaN (double value)
static bool isNaN (float value)
static bool isInf (double value)
static bool isInf (float value)
static bool isFinite (double value)
static bool isFinite (float value)
static bool isNumber (const std::string &str)
static double lineFitting (const std::vector< vpImagePoint > &imPts, double &a, double &b, double &c)
template<typename Tp>
static Tp saturate (unsigned char v)
template<typename Tp>
static Tp saturate (char v)
template<typename Tp>
static Tp saturate (unsigned short v)
template<typename Tp>
static Tp saturate (short v)
template<typename Tp>
static Tp saturate (unsigned v)
template<typename Tp>
static Tp saturate (int v)
template<typename Tp>
static Tp saturate (float v)
template<typename Tp>
static Tp saturate (double v)
static double getMean (const std::vector< double > &v)
static double getMedian (const std::vector< double > &v)
static double getStdev (const std::vector< double > &v, bool useBesselCorrection=false)
static int modulo (int a, int n)
static unsigned int modulo (unsigned int a, unsigned int n)
static vpHomogeneousMatrix ned2ecef (double lonDeg, double latDeg, double radius)
static vpHomogeneousMatrix enu2ecef (double lonDeg, double latDeg, double radius)
static vpHomogeneousMatrix enu2ned (const vpHomogeneousMatrix &enu_M)
template<typename T>
static std::vector< double > linspace (T start_in, T end_in, unsigned int num_in)
static std::vector< std::pair< double, double > > computeRegularPointsOnSphere (unsigned int maxPoints)
static std::vector< vpHomogeneousMatrixgetLocalTangentPlaneTransformations (const std::vector< std::pair< double, double > > &lonlatVec, double radius, LongLattToHomogeneous func)
static vpHomogeneousMatrix lookAt (const vpColVector &from, const vpColVector &to, vpColVector tmp)
template<>
unsigned char saturate (char v)
template<>
unsigned char saturate (unsigned short v)
template<>
unsigned char saturate (int v)
template<>
unsigned char saturate (short v)
template<>
unsigned char saturate (unsigned int v)
template<>
unsigned char saturate (float v)
template<>
unsigned char saturate (double v)
template<>
char saturate (unsigned char v)
template<>
char saturate (unsigned short v)
template<>
char saturate (int v)
template<>
char saturate (short v)
template<>
char saturate (unsigned int v)
template<>
char saturate (float v)
template<>
char saturate (double v)
template<>
unsigned short saturate (char v)
template<>
unsigned short saturate (short v)
template<>
unsigned short saturate (int v)
template<>
unsigned short saturate (unsigned int v)
template<>
unsigned short saturate (float v)
template<>
unsigned short saturate (double v)
template<>
short saturate (unsigned short v)
template<>
short saturate (int v)
template<>
short saturate (unsigned int v)
template<>
short saturate (float v)
template<>
short saturate (double v)
template<>
int saturate (float v)
template<>
int saturate (double v)
template<>
unsigned int saturate (float v)
template<>
unsigned int saturate (double v)

Detailed Description

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

Definition at line 110 of file vpMath.h.

Member Typedef Documentation

◆ LongLattToHomogeneous

typedef vpHomogeneousMatrix(* vpMath::LongLattToHomogeneous) (double lonDeg, double latDeg, double radius)

Definition at line 364 of file vpMath.h.

Member Function Documentation

◆ abs()

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

◆ clamp()

template<typename T>
T vpMath::clamp ( const T & v,
const T & lower,
const T & upper )
inlinestatic

Clamp a value to boundaries.

Parameters
[in]v: The value to clamp.
[in]lower: The lower boundary to clamp v to.
[in]upper: The upper boundary to clamp v to.

Throw a vpException if the value of lower is greater than upper.

Examples
testMath.cpp.

Definition at line 219 of file vpMath.h.

References vpException::badValue.

Referenced by vpObjectCentricRenderer::computeBoundingBox().

◆ comb()

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
Combination number $ n! / ((n-p)! p!) $

Definition at line 398 of file vpMath.h.

References fact().

Referenced by vpMomentAlpha::compute(), vpMomentCentered::compute(), vpFeatureMomentCentered::compute_Lmu_pq(), vpNurbs::computeCurveDersPoint(), vpPixelMeterConversion::convertMoment(), and vpPixelMeterConversion::convertMoment().

◆ computeRegularPointsOnSphere()

std::vector< std::pair< double, double > > vpMath::computeRegularPointsOnSphere ( unsigned int maxPoints)
static

Compute the vector of longitude / latitude (in degree) couples for maxPoints regularly spaced on a sphere, using the following paper:

Following image illustrates the camera poses regularly spaced on a sphere:

Parameters
maxPoints: The number of point coordinates to be sampled on a sphere.
Returns
The vector of longitude / latitude (in degree) pairs for the maxPoints on a sphare.
Examples
catchMathUtils.cpp.

Definition at line 623 of file vpMath.cpp.

References deg(), and round().

◆ deg() [1/3]

vpColVector vpMath::deg ( const vpColVector & r)
static

Convert angles of a column vector from radians to degrees.

Parameters
r: Column vector with angles in radians.
Returns
Corresponding column vector with angles converted in degrees.

Definition at line 766 of file vpMath.cpp.

References deg().

◆ deg() [2/3]

vpColVector vpMath::deg ( const vpRotationVector & r)
static

Convert angles of a rotation vector into degrees.

Parameters
r: Rotation vector with angles in radians.
Returns
Corresponding column vector with angles converted in degrees.

Definition at line 746 of file vpMath.cpp.

References deg(), and vpException::fatalError.

◆ deg() [3/3]

double vpMath::deg ( double rad)
inlinestatic

Convert an angle in radians into degrees.

Parameters
rad: Angle in radians.
Returns
Angle converted in degrees.
Examples
catchCalibHandEye.cpp, catchRBT.cpp, catchRBTDataset.cpp, catchRotation.cpp, mbot-apriltag-2D-half-vs.cpp, mbot-apriltag-ibvs.cpp, mbot-apriltag-pbvs.cpp, moveBiclops.cpp, movePioneer.cpp, perfMatrixMultiplication.cpp, pf-nonlinear-example.cpp, servoAfma6AprilTagPBVS.cpp, servoAfma6Cylinder2DCamVelocity.cpp, servoAfma6Cylinder2DCamVelocitySecondaryTask.cpp, servoAfma6MegaposePBVS.cpp, servoFrankaPBVS.cpp, servoPioneerPanSegment3D.cpp, servoPioneerPoint2DDepth.cpp, servoPioneerPoint2DDepthWithoutVpServo.cpp, servoPololuPtuPoint2DJointVelocity.cpp, servoUniversalRobotsPBVS.cpp, sonarPioneerReader.cpp, testFrankaJointVelocityLimits.cpp, testGenericTracker.cpp, testGenericTrackerDepth.cpp, testMath.cpp, testMocapQualisys.cpp, testMocapVicon.cpp, testMomentAlpha.cpp, testPixhawkDronePositionAbsoluteControl.cpp, testPixhawkDronePositionRelativeControl.cpp, testPixhawkDroneTakeoff.cpp, testPololuPosition.cpp, testPololuVelocity.cpp, testPose.cpp, testRobotAfma6Pose.cpp, testRobotFlirPtu.cpp, testRobotViper850.cpp, testRobotViper850Pose.cpp, testViper650.cpp, testViper850.cpp, trackMeLine.cpp, tutorial-homography-from-points.cpp, tutorial-ibvs-4pts-wireframe-robot-afma6.cpp, tutorial-ibvs-4pts-wireframe-robot-viper.cpp, tutorial-mb-generic-tracker-full.cpp, tutorial-mb-generic-tracker-live.cpp, tutorial-pose-from-points-live.cpp, tutorial-pose-from-points-realsense-T265.cpp, visp-compute-eye-in-hand-calibration.cpp, and visp-compute-eye-to-hand-calibration.cpp.

Definition at line 119 of file vpMath.h.

References rad().

Referenced by vpHandEyeCalibration::calibrate(), vpMbGenericTracker::computeCurrentProjectionError(), vpMbTracker::computeCurrentProjectionError(), vpMeSite::computeMaskIndex(), vpMbEdgeTracker::computeProjectionError(), vpMbGenericTracker::computeProjectionError(), computeRegularPointsOnSphere(), deg(), deg(), vpAfma6::getInverseKinematics(), vpMbDepthDenseTracker::loadConfigFile(), vpMbDepthNormalTracker::loadConfigFile(), vpMbEdgeKltTracker::loadConfigFile(), vpMbEdgeTracker::loadConfigFile(), vpMbKltTracker::loadConfigFile(), vpAfma6::operator<<, vpMomentAlpha::operator<<, vpReflexTakktile2::HandInfo::operator<<, vpViper::operator<<, vpFeatureSegment::print(), vpPoseVector::print(), vpMeEllipse::printParameters(), rad(), vpServoData::save(), vpRobotAfma6::savePosFile(), vpRobotFranka::savePosFile(), vpRobotUniversalRobots::savePosFile(), vpRobotViper650::savePosFile(), vpRobotViper850::savePosFile(), vpSimulatorAfma6::savePosFile(), vpSimulatorViper850::savePosFile(), vpRobotFlirPtu::setJointVelocity(), vpRobotKinova::setJointVelocity(), vpRobotFlirPtu::setPosition(), vpRobotKinova::setPosition(), vpRobotViper650::setPosition(), vpRobotViper850::setPosition(), vpRobotPioneer::setVelocity(), vpMbGenericTracker::to_json, vpSimulatorAfma6::updateArticularPosition(), vpSimulatorViper850::updateArticularPosition(), and vpRobotBiclops::vpRobotBiclopsSpeedControlLoop().

◆ enu2ecef()

vpHomogeneousMatrix vpMath::enu2ecef ( double lonDeg,
double latDeg,
double radius )
static

Compute from a given longitude, latitude and a sphere radius the homogeneous transformation from the ENU frame to the ECEF frame:

\‍[  \begin{bmatrix}
    X_{\text{ecef}} \\
    Y_{\text{ecef}} \\
    Z_{\text{ecef}}
  \end{bmatrix}
  =
  \begin{bmatrix}
    -\sin \lambda & -\sin \varphi \cos \lambda & \cos \varphi \cos \lambda \\
    \cos \lambda & -\sin \varphi \sin \lambda & \cos \varphi \sin \lambda \\
    0 & \cos \varphi & \sin \varphi
  \end{bmatrix}
  +
  \begin{bmatrix}
    \text{r} \cos \varphi \cos \lambda \\
    \text{r} \cos \varphi \sin \lambda \\
    \text{r} \sin \varphi
  \end{bmatrix}
\‍]

See also
Parameters
lonDeg: The longitude in degree or angle $\lambda$ in previous equation.
latDeg: The latitude in degree or angle $\varphi$ in previous equation.
radius: The sphere radius $r$ in meter.
Returns
The homogeneous transformation from ENU to ECEF frame.
See also
ned2ecef(), getLocalTangentPlaneTransformations()
Examples
catchMathUtils.cpp.

Definition at line 583 of file vpMath.cpp.

References rad().

◆ enu2ned()

vpHomogeneousMatrix vpMath::enu2ned ( const vpHomogeneousMatrix & enu_M)
static

Convert from ENU (East-North-Up) to NED (North-East-Down) frame.

Parameters
enu_M: HomogeneousMatrix expressed in ENU frame.
Returns
Converted homogeneous matrix in NED frame.
Examples
catchHomogeneousMatrix.cpp.

Definition at line 797 of file vpMath.cpp.

◆ equal() [1/2]

bool vpMath::equal ( double x,
double y,
double threshold = 0.001 )
inlinestatic

Compares $ | x - y | $ to threshold.

Parameters
x: x value.
y: y value.
threshold: Tolerance threshold.
Returns
true if $ | x - y | <$ threshold.
Examples
catchAprilTag.cpp, catchCalibHandEye.cpp, catchColorConversion.cpp, catchHomogeneousMatrix.cpp, catchIoEXR.cpp, catchIoPFM.cpp, catchMathUtils.cpp, catchMatrixCholesky.cpp, catchParticleFilter.cpp, catchPoseRansac2.cpp, catchQuaternion.cpp, catchRBT.cpp, catchRotation.cpp, perfColVectorOperations.cpp, perfMatrixMultiplication.cpp, testCameraParametersConversion.cpp, testColVector.cpp, testConversion.cpp, testHSVtoHSV.cpp, testHistogram.cpp, testImageFilter.cpp, testImageMeanAndStdev.cpp, testImageNormalizedCorrelation.cpp, testImageTemplateMatching.cpp, testIoTools.cpp, testKeyPoint-7.cpp, testMath.cpp, testMatrix.cpp, testMatrixConditionNumber.cpp, testMatrixConvolution.cpp, testMatrixInitialization.cpp, testMbtXmlGenericParser.cpp, testMomentAlpha.cpp, testRGBaToHSV.cpp, testRowVector.cpp, testTukeyEstimator.cpp, testUniversalRobotsGetData.cpp, testXmlConfigParserKeyPoint.cpp, testXmlParserHomogeneousMatrix.cpp, testXmlParserRectOriented.cpp, tutorial-canny.cpp, tutorial-pf-curve-fitting-all.cpp, and tutorial-pf-curve-fitting-pf.cpp.

Definition at line 470 of file vpMath.h.

References nul().

Referenced by vpRGBa::buildFrom(), vpCircleHoughTransform::computeCenterCandidates(), vpHSV< T, useFullScale >::computeNormalizedHSV(), vpImageCircle::computePixelsInMask(), vpMbDepthDenseTracker::display(), vpMbDepthDenseTracker::display(), vpMbDepthNormalTracker::display(), vpMbDepthNormalTracker::display(), vpMbEdgeKltTracker::display(), vpMbEdgeKltTracker::display(), vpMbEdgeTracker::display(), vpMbEdgeTracker::display(), vpMbKltTracker::display(), vpMbKltTracker::display(), vpMbEdgeTracker::displayFeaturesOnImage(), vpMbEdgeTracker::displayFeaturesOnImage(), vpHomogeneousMatrix::isAnHomogeneousMatrix(), vpCameraParameters::operator==(), vpColVector::operator==(), vpColVector::operator==(), vpHSV< T, useFullScale >::operator==(), vpRowVector::operator==(), vpQbSoftHand::setPosition(), and vpMunkres::stepTwo().

◆ equal() [2/2]

bool vpMath::equal ( float x,
float y,
float threshold = 0.001f )
inlinestatic

Compares $ | x - y | $ to threshold.

Parameters
x: x value.
y: y value.
threshold: Tolerance threshold.
Returns
true if $ | x - y | <$ threshold.

Definition at line 479 of file vpMath.h.

References nul().

◆ fact()

double vpMath::fact ( unsigned int x)
inlinestatic

Computes and returns x!

Parameters
x: parameter of factorial function.

Definition at line 382 of file vpMath.h.

References fact().

Referenced by comb(), and fact().

◆ getAngleBetweenMinPiAndPi() [1/2]

double vpMath::getAngleBetweenMinPiAndPi ( const double & theta)
inlinestatic

Convert angle between $-\pi$ and $\pi$.

Parameters
[in]thetaThe input angle we want to ensure it is in the interval $[-\pi ; \pi]$.
Returns
The corresponding angle in the interval $[-\pi ; \pi]$.

Definition at line 157 of file vpMath.h.

◆ getAngleBetweenMinPiAndPi() [2/2]

float vpMath::getAngleBetweenMinPiAndPi ( const float & theta)
inlinestatic

Convert angle between $-\pi$ and $\pi$.

Parameters
[in]thetaThe input angle we want to ensure it is in the interval $[-\pi ; \pi]$.
Returns
The corresponding angle in the interval $[-\pi ; \pi]$.
Examples
testImageCircle.cpp.

Definition at line 139 of file vpMath.h.

◆ getLocalTangentPlaneTransformations()

std::vector< vpHomogeneousMatrix > vpMath::getLocalTangentPlaneTransformations ( const std::vector< std::pair< double, double > > & lonlatVec,
double radius,
LongLattToHomogeneous toECEF )
static

Compute transformations from the local tangent plane (e.g. NED, ECU, ...) to the ECEF frame.

See also

Following image illustrates the camera poses sampled using longitude / latitude coordinates:

Parameters
lonlatVec: Vector of longitude/latitude coordinates in degree.
radius: Sphere radius in meter.
toECEF: Pointer to the function computing from a longitude / latitude coordinates in degree and a radius the corresponding transformation from the local frame (e.g. NED or ENU) to the ECEF frame.
Returns
The vector of ecef_M_local homogeneous transformations.
See also
enu2ecef(), ned2ecef()
Examples
catchMathUtils.cpp.

Definition at line 674 of file vpMath.cpp.

◆ getMean()

◆ getMedian()

◆ getStdev()

◆ greater()

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

Compares $ x $ to $ y -$ threshold.

Parameters
x: x value.
y: y value.
threshold: Tolerance threshold.
Returns
true if $ x > y -$ threshold.

Definition at line 488 of file vpMath.h.

◆ isFinite() [1/2]

bool vpMath::isFinite ( double value)
static

Returns whether a double is a finite value (neither infinite nor NaN).

Parameters
value: Double number to check.
Returns
true if value is neither infinite nor NaN (as defined by IEEE754 standard) and false otherwise.
Examples
testMath.cpp.

Definition at line 198 of file vpMath.cpp.

References isInf(), and isNaN().

Referenced by vpRBDenseDepthTracker::extractFeatures(), vpImage< vpRGBa >::getMinMaxValue(), vpImage< vpRGBa >::getMinMaxValue(), vpImage< vpRGBa >::getMinMaxValue(), vpArray2D< Type >::isFinite(), vpRBFeatureResult::onIter(), and vpRBTracker::track().

◆ isFinite() [2/2]

bool vpMath::isFinite ( float value)
static

Returns whether a float is a finite value (neither infinite nor NaN).

Parameters
value: Float number to check.
Returns
true if value is neither infinite nor NaN (as defined by IEEE754 standard) and false otherwise.

Definition at line 217 of file vpMath.cpp.

References isInf(), and isNaN().

◆ isInf() [1/2]

bool vpMath::isInf ( double value)
static

Returns whether a double is an infinity value (either positive infinity or negative infinity).

Parameters
value: Double number to check.
Returns
true if value is a plus or minus infinity (as defined by IEEE754 standard) and false otherwise.
Examples
testMath.cpp.

Definition at line 151 of file vpMath.cpp.

Referenced by isFinite(), and isFinite().

◆ isInf() [2/2]

bool vpMath::isInf ( float value)
static

Returns whether a float is an infinity value (either positive infinity or negative infinity).

Parameters
value: Float number to check.
Returns
true if value is a plus or minus infinity (as defined by IEEE754 standard) and false otherwise.

Definition at line 175 of file vpMath.cpp.

◆ isNaN() [1/2]

bool vpMath::isNaN ( double value)
static

Check whether a double number is not a number (NaN) or not.

Parameters
value: Double number to check.
Returns
true if value is Not A Number (as defined by IEEE754 standard) and false otherwise.
Examples
testMath.cpp, and tutorial-apriltag-detector-live-rgbd-structure-core.cpp.

Definition at line 101 of file vpMath.cpp.

Referenced by vpKeyPoint::compute3DForPointsOnCylinders(), vpKeyPoint::compute3DForPointsOnCylinders(), vpMbtDistanceKltCylinder::computeInteractionMatrixAndResidu(), vpComedi::getPhyData(), vpMbtDistanceKltCylinder::init(), isFinite(), isFinite(), vpHomogeneousMatrix::isValid(), vpRBConvergenceADDMetric::operator()(), and vpRBConvergenceReprojectionMetric::operator()().

◆ isNaN() [2/2]

bool vpMath::isNaN ( float value)
static

Check whether a float number is not a number (NaN) or not.

Parameters
value: Float number to check.
Returns
true if value is Not A Number (as defined by IEEE754 standard) and false otherwise.

Definition at line 125 of file vpMath.cpp.

◆ isNumber()

bool vpMath::isNumber ( const std::string & str)
static

Returns whether a string is a number.

Parameters
[in]str: String to check.
Returns
true if string is number and false otherwise.
Examples
testMath.cpp, tutorial-dnn-object-detection-live.cpp, and tutorial-megapose-live-single-object-tracking.cpp.

Definition at line 235 of file vpMath.cpp.

◆ lineFitting()

double vpMath::lineFitting ( const std::vector< vpImagePoint > & imPts,
double & a,
double & b,
double & c )
static

Compute the line equation using least-squares fitting that minimizes the cost function:

\‍[  \mathbf{E} = \sum_{i=1}^{n}\left ( ax_i + by_i - c \right )^2
\‍]

Parameters
imPts: Image points (size >= 3).
a: a coefficient.
b: b coefficient.
c: c coefficient.
Returns
The mean distance error (point-to-line distance) between the points and the fitted line.
Examples
catchLineFitting.cpp, and visp-calibrate-camera.cpp.

Definition at line 411 of file vpMath.cpp.

References vpException::dimensionError, vpMatrix::eigenValues(), vpImagePoint::get_u(), and vpImagePoint::get_v().

◆ linspace()

template<typename T>
std::vector< double > vpMath::linspace ( T start_in,
T end_in,
unsigned int num_in )
inlinestatic

Similar to the NumPy linspace function: "Return evenly spaced numbers over a specified interval." Code from: https://stackoverflow.com/a/27030598

Parameters
start_in: The starting value of the sequence.
end_in: The end value of the sequence.
num_in: Number of samples to generate.
Returns
Returns num_in evenly spaced samples, calculated over the interval [start_in, end_in].
Examples
catchMathUtils.cpp.

Definition at line 336 of file vpMath.h.

◆ lookAt()

vpHomogeneousMatrix vpMath::lookAt ( const vpColVector & from,
const vpColVector & to,
vpColVector tmp )
static

Compute the transformation such that the camera located at from position looks toward to position.

Right-handed coordinate system for OpenGL (figure from https://learnopengl.com/Getting-started/Coordinate-Systems):

See also:

Parameters
from: Current camera position as a 3-dim vector with 3D coordinates (X,Y,Z) in meter..
to: Where the camera must point toward as a 3-dim vector with 3D coordinates (X,Y,Z) in meter.
tmp: Arbitrary up-vector as a 3-dim vector with coordinates along (X,Y,Z) in meter.
Returns
The homogeneous transformation from the camera frame to the OpenGL frame.
Examples
catchMathUtils.cpp, and photometricMappingVisualServoing.cpp.

Definition at line 710 of file vpMath.cpp.

References vpColVector::crossProd(), vpColVector::normalize(), and vpArray2D< Type >::size().

◆ maximum()

template<class Type>
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.
Examples
testImageDifference.cpp.

Definition at line 257 of file vpMath.h.

Referenced by vpMbEdgeTracker::addCircle(), vpMbEdgeTracker::addCylinder(), vpMbTracker::addProjectionErrorCircle(), vpMbTracker::addProjectionErrorCylinder(), vpStatisticalTestHinkley::computeMean(), vpPanda3DBaseRenderer::computeNearAndFarPlanesFromNode(), vpMbTracker::extractCylinders(), vpBSpline::findSpan(), vpRobotWireFrameSimulator::getExternalCameraParameters(), vpWireFrameSimulator::getExternalCameraParameters(), vpWireFrameSimulator::getExternalCameraParameters(), vpSimulatorAfma6::getExternalImage(), vpSimulatorViper850::getExternalImage(), vpWireFrameSimulator::getExternalImage(), vpWireFrameSimulator::getExternalImage(), vpWireFrameSimulator::getExternalImage(), vpWireFrameSimulator::getExternalImage(), vpWireFrameSimulator::getInternalCameraParameters(), vpWireFrameSimulator::getInternalCameraParameters(), vpWireFrameSimulator::getInternalImage(), vpWireFrameSimulator::getInternalImage(), vpRobotWireFrameSimulator::getInternalView(), vpRobotWireFrameSimulator::getInternalView(), vpImageTools::imageDifference(), vpMeNurbs::localReSample(), vpImagePoint::operator!=, vpScanPoint::operator!=, vpImagePoint::operator==, vpScanPoint::operator==, vpColVector::print(), vpForceTwistMatrix::print(), vpMatrix::print(), vpPoseVector::print(), vpRowVector::print(), vpVelocityTwistMatrix::print(), vpRansac< vpTransformation >::ransac(), vpMeNurbs::seekExtremitiesCanny(), and vpRobotBiclops::vpRobotBiclopsSpeedControlLoop().

◆ mcosc()

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

Compute $ (1-cos(x))/x^2 $

Parameters
cosx: Value of cos(x).
x: Value of x.
Returns
The value of $ (1-cos(x))/x^2 $.

Definition at line 254 of file vpMath.cpp.

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

◆ minimum()

◆ modulo() [1/4]

double vpMath::modulo ( const double & value,
const double & modulo )
inlinestatic

Gives the rest of value divided by modulo when the quotient can only be an integer.

Parameters
[in]valueThe value we want to know the rest in the "modulo" operation.
[in]moduloThe divider.
Returns
double The rest as in a modulo operation.

Definition at line 192 of file vpMath.h.

References modulo().

◆ modulo() [2/4]

float vpMath::modulo ( const float & value,
const float & modulo )
inlinestatic

Gives the rest of value divided by modulo when the quotient can only be an integer.

Parameters
[in]valueThe value we want to know the rest in the "modulo" operation.
[in]moduloThe divider.
Returns
float The rest as in a modulo operation.
Examples
pf-nonlinear-complex-example.cpp, ukf-nonlinear-complex-example.cpp, and ukf-nonlinear-example.cpp.

Definition at line 177 of file vpMath.h.

References modulo().

Referenced by vpImageCircle::computeAngularCoverageInRoI(), VISP_NAMESPACE_NAME::vpDirection::counterClockwise(), vpStatisticalTestShewhart::detectDownwardMeanDrift(), vpStatisticalTestShewhart::detectUpwardMeanDrift(), vpStatisticalTestShewhart::getSignals(), modulo(), and modulo().

◆ modulo() [3/4]

int vpMath::modulo ( int a,
int n )
static

Compute the modified modulo:

  • modulo(11, 10) == 1 == 11 % 10
  • modulo(-1, 10) == 9
Parameters
a: The dividend.
n: The divisor.
Returns
The modified modulo of a mod n.

Definition at line 468 of file vpMath.cpp.

◆ modulo() [4/4]

unsigned int vpMath::modulo ( unsigned int a,
unsigned int n )
static

Compute the modified modulo:

  • modulo(11, 10) == 1 == 11 % 10
Parameters
a: The dividend.
n: The divisor.
Returns
The modified modulo of a mod n.

Definition at line 479 of file vpMath.cpp.

◆ msinc()

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

Compute $ (1-sinc(x))/x^2 $ with $ sinc(x) = sin(x) / x $.

Parameters
sinx: value of sin(x).
x: Value of x.
Returns
The value of $ (1-sinc(x))/x^2 $.

Definition at line 272 of file vpMath.cpp.

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

◆ ned2ecef()

vpHomogeneousMatrix vpMath::ned2ecef ( double lonDeg,
double latDeg,
double radius )
static

Compute from a given longitude, latitude and a sphere radius the homogeneous transformation from the NED frame to the ECEF frame:

\‍[\begin{bmatrix}
  X_{\text{ecef}} \\
  Y_{\text{ecef}} \\
  Z_{\text{ecef}}
\end{bmatrix}
=
\begin{bmatrix}
  -\sin \varphi \cos \lambda & -\sin \lambda & -\cos \varphi \cos \lambda \\
  -\sin \varphi \sin \lambda & \cos \lambda & -\cos \varphi \sin \lambda \\
  \cos \varphi & 0 & -\sin \varphi
\end{bmatrix}
+
\begin{bmatrix}
  \text{r} \cos \varphi \cos \lambda \\
  \text{r} \cos \varphi \sin \lambda \\
  \text{r} \sin \varphi
\end{bmatrix}
\‍]

See also:

Parameters
lonDeg: The longitude in degree or angle $\lambda$ in previous equation.
latDeg: The latitude in degree or angle $\varphi$ in previous equation.
radius: The sphere radius $r$ in meter.
Returns
The homogeneous transformation from NED to ECEF frame.
See also
enu2ecef(), getLocalTangentPlaneTransformations()
Examples
catchMathUtils.cpp.

Definition at line 519 of file vpMath.cpp.

References rad().

◆ nul() [1/2]

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

◆ nul() [2/2]

bool vpMath::nul ( float x,
float threshold = 0.001f )
inlinestatic

Compares $ | x | $ to threshold.

Parameters
x: Value to test.
threshold: Tolerance threshold
Returns
true if $ | x | <$ threshold.

Definition at line 461 of file vpMath.h.

◆ rad() [1/2]

vpColVector vpMath::rad ( const vpColVector & r)
static

Convert angles of a column vector from degrees to radians.

Parameters
r: Column vector with angles in degrees.
Returns
Corresponding column vector with angles converted in radians.

Definition at line 782 of file vpMath.cpp.

References rad().

◆ rad() [2/2]

double vpMath::rad ( double deg)
inlinestatic

Convert an angle in degrees into radian.

Parameters
deg: Angle in degrees.
Returns
Angle converted in radians.
Examples
catchCalibHandEye.cpp, catchGenericTrackerDeterminist.cpp, catchImageWarp.cpp, catchPanda.cpp, catchPoseRansac2.cpp, catchPoseVector.cpp, catchQuaternion.cpp, catchRBT.cpp, catchRotation.cpp, exponentialMap.cpp, homographyHLM2DObject.cpp, homographyHLM3DObject.cpp, homographyHartleyDLT2DObject.cpp, homographyRansac2DObject.cpp, manServo4PointsDisplay.cpp, manServoMomentsSimple.cpp, manSimu4Dots.cpp, manSimu4Points.cpp, mbtEdgeKltTracking.cpp, mbtGenericTracking.cpp, mbtGenericTracking2.cpp, mbtGenericTrackingDepth.cpp, mbtGenericTrackingDepthOnly.cpp, mbtKltTracking.cpp, moveBiclops.cpp, movePtu46.cpp, perfGenericTracker.cpp, perfImageWarp.cpp, pf-nonlinear-complex-example.cpp, pf-nonlinear-example.cpp, photometricMappingVisualServoing.cpp, photometricVisualServoing.cpp, photometricVisualServoingWithoutVpServo.cpp, servoAfma62DhalfCamVelocity.cpp, servoAfma6AprilTagIBVS.cpp, servoAfma6AprilTagPBVS.cpp, servoAfma6Cylinder2DCamVelocity.cpp, servoAfma6Cylinder2DCamVelocitySecondaryTask.cpp, servoAfma6FourPoints2DCamVelocityLs_cur.cpp, servoAfma6FourPoints2DCamVelocityLs_cur_integrator.cpp, servoAfma6FourPoints2DCamVelocityLs_des.cpp, servoAfma6Line2DCamVelocity.cpp, servoAfma6SquareLines2DCamVelocity.cpp, servoAfma6TwoLines2DCamVelocity.cpp, servoBebop2.cpp, servoKinovaJacoJoint.cpp, servoMomentImage.cpp, servoMomentPoints.cpp, servoMomentPolygon.cpp, servoPixhawkDroneIBVS.cpp, servoSimu3D_cMcd_CamVelocity.cpp, servoSimu3D_cMcd_CamVelocityWithoutVpServo.cpp, servoSimu3D_cdMc_CamVelocity.cpp, servoSimu3D_cdMc_CamVelocityWithoutVpServo.cpp, servoSimu4Points.cpp, servoSimuAfma6FourPoints2DCamVelocity.cpp, servoSimuCircle2DCamVelocityDisplay.cpp, servoSimuCylinder.cpp, servoSimuCylinder2DCamVelocityDisplay.cpp, servoSimuCylinder2DCamVelocityDisplaySecondaryTask.cpp, servoSimuFourPoints2DCamVelocityDisplay.cpp, servoSimuFourPoints2DPolarCamVelocityDisplay.cpp, servoSimuLine2DCamVelocityDisplay.cpp, servoSimuPoint2DhalfCamVelocity1.cpp, servoSimuPoint2DhalfCamVelocity2.cpp, servoSimuPoint2DhalfCamVelocity3.cpp, servoSimuSphere.cpp, servoSimuSphere2DCamVelocityDisplaySecondaryTask.cpp, servoSimuSquareLine2DCamVelocityDisplay.cpp, servoSimuThetaUCamVelocity.cpp, servoSimuViper850FourPoints2DCamVelocity.cpp, servoUniversalRobotsIBVS.cpp, servoUniversalRobotsPBVS.cpp, servoViper850FourPoints2DArtVelocityLs_cur.cpp, servoViper850FourPoints2DCamVelocityLs_cur.cpp, servoViper850FourPointsKinect.cpp, simulateCircle2DCamVelocity.cpp, simulateFourPoints2DCartesianCamVelocity.cpp, simulateFourPoints2DPolarCamVelocity.cpp, sonarPioneerReader.cpp, testCameraParametersConversion.cpp, testDisplacement.cpp, testFeatureMoment.cpp, testFeatureSegment.cpp, testFindMatch.cpp, testFrankaJointVelocity-2.cpp, testFrankaJointVelocity-3.cpp, testFrankaJointVelocity.cpp, testFrankaJointVelocityLimits.cpp, testGenericTracker.cpp, testGenericTrackerDepth.cpp, testKalmanAcceleration.cpp, testKalmanVelocity.cpp, testKeyPoint-2.cpp, testKeyPoint-4.cpp, testMath.cpp, testMatrix.cpp, testPixhawkDronePositionAbsoluteControl.cpp, testPixhawkDronePositionRelativeControl.cpp, testPixhawkRoverVelocityControl.cpp, testPololuPosition.cpp, testPololuVelocity.cpp, testPose.cpp, testPoseFeatures.cpp, testRobotBebop2.cpp, testRobotFlirPtu.cpp, testRobotViper650-frames.cpp, testRobotViper850-frames.cpp, testUniversalRobotsJointPosition.cpp, testUniversalRobotsJointVelocity.cpp, testViper650.cpp, testViper850.cpp, testVirtuoseWithGlove.cpp, testXmlParserHomogeneousMatrix.cpp, testXmlParserRectOriented.cpp, tutorial-detection-object-mbt-deprecated.cpp, tutorial-detection-object-mbt.cpp, tutorial-detection-object-mbt2-deprecated.cpp, tutorial-detection-object-mbt2.cpp, tutorial-draw-frame.cpp, tutorial-homography-from-points.cpp, tutorial-ibvs-4pts-display.cpp, tutorial-ibvs-4pts-image-tracking.cpp, tutorial-ibvs-4pts-ogre-tracking.cpp, tutorial-ibvs-4pts-ogre.cpp, tutorial-ibvs-4pts-plotter-continuous-gain-adaptive.cpp, tutorial-ibvs-4pts-plotter-gain-adaptive.cpp, tutorial-ibvs-4pts-plotter.cpp, tutorial-ibvs-4pts-wireframe-camera.cpp, tutorial-ibvs-4pts-wireframe-robot-afma6.cpp, tutorial-ibvs-4pts-wireframe-robot-viper.cpp, tutorial-ibvs-4pts.cpp, tutorial-image-simulator.cpp, tutorial-mb-edge-tracker.cpp, tutorial-mb-generic-tracker-apriltag-rs2.cpp, tutorial-mb-generic-tracker-apriltag-webcam.cpp, tutorial-mb-generic-tracker-full.cpp, tutorial-mb-generic-tracker-rgbd.cpp, tutorial-mb-hybrid-tracker.cpp, tutorial-mb-klt-tracker.cpp, tutorial-mb-tracker-full.cpp, tutorial-panda3d-renderer.cpp, ukf-nonlinear-complex-example.cpp, ukf-nonlinear-example.cpp, and wireframeSimulator.cpp.

Definition at line 129 of file vpMath.h.

References deg().

Referenced by vpMbTracker::addPolygon(), vpMbTracker::addProjectionErrorPolygon(), vpMbGenericTracker::computeProjectionError(), vpMeLine::computeRhoTheta(), deg(), enu2ecef(), vpRBDenseDepthTracker::extractFeatures(), vpMbGenericTracker::from_json, vpRobotViper650::get_eJe(), vpRobotViper850::get_eJe(), vpAfma6::getInverseKinematics(), vpViper::getInverseKinematicsWrist(), vpRobotKinova::getJointPosition(), vpRobotPioneer::getVelocity(), vpPointMap::getVisiblePoints(), vpAfma6::init(), vpRobotUniversalRobots::init(), vpSimulatorAfma6::init(), vpSimulatorViper850::init(), vpSimulatorViper850::init(), vpViper650::init(), vpViper850::init(), vpSimulatorAfma6::initDisplay(), vpSimulatorViper850::initDisplay(), vpMbtPolygon::isVisible(), vpMbTracker::loadCAOModel(), vpMbDepthDenseTracker::loadConfigFile(), vpMbDepthNormalTracker::loadConfigFile(), vpMbEdgeKltTracker::loadConfigFile(), vpMbEdgeTracker::loadConfigFile(), vpMbKltTracker::loadConfigFile(), vpMbTracker::loadInitFile(), vpWireFrameSimulator::navigation(), vpWireFrameSimulator::navigation(), ned2ecef(), SoftwareArguments::parseArgs(), rad(), vpRobotAfma6::readPosFile(), vpRobotFranka::readPosFile(), vpRobotUniversalRobots::readPosFile(), vpSimulatorAfma6::readPosFile(), vpMbDepthDenseTracker::resetTracker(), vpMbDepthNormalTracker::resetTracker(), vpMbEdgeTracker::resetTracker(), vpMbGenericTracker::resetTracker(), vpMbKltTracker::resetTracker(), vpRBSilhouetteControlPoint::updateSilhouettePoint(), vpRobotBiclops::vpRobotBiclopsSpeedControlLoop(), vpRobotMavsdk::vpRobotMavsdk(), vpRobotMavsdk::vpRobotMavsdk(), vpRobotPololuPtu::vpRobotPololuPtu(), vpSickLDMRS::vpSickLDMRS(), vpViper::vpViper(), vpViper650::vpViper650(), vpViper850::vpViper850(), and vpWireFrameSimulator::vpWireFrameSimulator().

◆ round()

int vpMath::round ( double x)
inlinestatic

Round x to the nearest integer.

Parameters
x: Value to round.
Returns
Nearest integer of x.
Examples
mbot-apriltag-2D-half-vs.cpp, mbot-apriltag-ibvs.cpp, mbot-apriltag-pbvs.cpp, testHSVtoRGBa.cpp, testImageGetValue.cpp, and testMath.cpp.

Definition at line 413 of file vpMath.h.

References round().

Referenced by vpRGBa::buildFrom(), vpMeSite::computeMaskIndex(), computeRegularPointsOnSphere(), VISP_NAMESPACE_NAME::computeThresholdHuang(), VISP_NAMESPACE_NAME::computeThresholdIsoData(), vpKeyPoint::createImageMatching(), vpKeyPoint::createImageMatching(), vpKltOpencv::display(), vpKltOpencv::display(), vpKltOpencv::display(), vpKltOpencv::display(), vpKeyPoint::displayMatching(), vpKeyPoint::displayMatching(), vpMbtDistanceKltCylinder::displayPrimitive(), vpMbtDistanceKltCylinder::displayPrimitive(), vpMbtDistanceKltPoints::displayPrimitive(), vpMbtDistanceKltPoints::displayPrimitive(), vpDisplayGTK::displayRectangle(), vpDisplayGTK::displayRectangle(), vpDisplayX::displayRectangle(), vpDisplayX::displayRectangle(), vpHistogram::equalize(), vpImageTools::extract(), vpImageTools::extract(), vpBSpline::findSpan(), vpMbtDistanceKltCylinder::getFeaturesForDisplay(), vpMbtDistanceKltPoints::getFeaturesForDisplay(), vpImage< Type >::getValue(), vpImage< vpRGBa >::getValue(), vpMeSite::init(), vpKeyPoint::insertImageMatching(), vpKeyPoint::insertImageMatching(), vpImageTools::interpolate(), vpMeTracker::outOfImage(), round(), vpMeLine::sample(), saturate(), saturate(), and vpMeSite::vpMeSite().

◆ saturate() [1/37]

template<>
unsigned short vpMath::saturate ( char v)
inlinestatic

Definition at line 601 of file vpMath.h.

◆ saturate() [2/37]

template<>
unsigned char vpMath::saturate ( char v)
inlinestatic

Definition at line 515 of file vpMath.h.

◆ saturate() [3/37]

template<typename Tp>
Tp vpMath::saturate ( char v)
inlinestatic

Definition at line 307 of file vpMath.h.

◆ saturate() [4/37]

template<>
unsigned int vpMath::saturate ( double v)
inlinestatic

Definition at line 686 of file vpMath.h.

References round().

◆ saturate() [5/37]

template<>
int vpMath::saturate ( double v)
inlinestatic

Definition at line 673 of file vpMath.h.

References round().

◆ saturate() [6/37]

template<>
short vpMath::saturate ( double v)
inlinestatic

Definition at line 661 of file vpMath.h.

References round(), and saturate().

◆ saturate() [7/37]

template<>
unsigned short vpMath::saturate ( double v)
inlinestatic

Definition at line 637 of file vpMath.h.

References round(), and saturate().

◆ saturate() [8/37]

template<>
char vpMath::saturate ( double v)
inlinestatic

Definition at line 594 of file vpMath.h.

References round(), and saturate().

◆ saturate() [9/37]

template<>
unsigned char vpMath::saturate ( double v)
inlinestatic

Definition at line 556 of file vpMath.h.

References round(), and saturate().

◆ saturate() [10/37]

template<typename Tp>
Tp vpMath::saturate ( double v)
inlinestatic

Definition at line 313 of file vpMath.h.

◆ saturate() [11/37]

template<>
unsigned int vpMath::saturate ( float v)
inlinestatic

Definition at line 681 of file vpMath.h.

References round().

◆ saturate() [12/37]

template<>
int vpMath::saturate ( float v)
inlinestatic

Definition at line 668 of file vpMath.h.

References round().

◆ saturate() [13/37]

template<>
short vpMath::saturate ( float v)
inlinestatic

Definition at line 656 of file vpMath.h.

References round(), and saturate().

◆ saturate() [14/37]

template<>
unsigned short vpMath::saturate ( float v)
inlinestatic

Definition at line 631 of file vpMath.h.

References round(), and saturate().

◆ saturate() [15/37]

template<>
char vpMath::saturate ( float v)
inlinestatic

Definition at line 588 of file vpMath.h.

References round(), and saturate().

◆ saturate() [16/37]

template<>
unsigned char vpMath::saturate ( float v)
inlinestatic

Definition at line 550 of file vpMath.h.

References round(), and saturate().

◆ saturate() [17/37]

template<typename Tp>
Tp vpMath::saturate ( float v)
inlinestatic

Definition at line 312 of file vpMath.h.

◆ saturate() [18/37]

template<>
short vpMath::saturate ( int v)
inlinestatic

Definition at line 648 of file vpMath.h.

◆ saturate() [19/37]

template<>
unsigned short vpMath::saturate ( int v)
inlinestatic

Definition at line 621 of file vpMath.h.

◆ saturate() [20/37]

template<>
char vpMath::saturate ( int v)
inlinestatic

Definition at line 573 of file vpMath.h.

◆ saturate() [21/37]

template<>
unsigned char vpMath::saturate ( int v)
inlinestatic

Definition at line 535 of file vpMath.h.

◆ saturate() [22/37]

template<typename Tp>
Tp vpMath::saturate ( int v)
inlinestatic

Definition at line 311 of file vpMath.h.

◆ saturate() [23/37]

template<>
unsigned short vpMath::saturate ( short v)
inlinestatic

Definition at line 616 of file vpMath.h.

◆ saturate() [24/37]

template<>
char vpMath::saturate ( short v)
inlinestatic

Definition at line 578 of file vpMath.h.

References saturate().

◆ saturate() [25/37]

template<>
unsigned char vpMath::saturate ( short v)
inlinestatic

Definition at line 540 of file vpMath.h.

References saturate().

◆ saturate() [26/37]

template<typename Tp>
Tp vpMath::saturate ( short v)
inlinestatic

Definition at line 309 of file vpMath.h.

◆ saturate() [27/37]

template<>
char vpMath::saturate ( unsigned char v)
inlinestatic

Definition at line 563 of file vpMath.h.

◆ saturate() [28/37]

◆ saturate() [29/37]

template<>
short vpMath::saturate ( unsigned int v)
inlinestatic

Definition at line 652 of file vpMath.h.

◆ saturate() [30/37]

template<>
unsigned short vpMath::saturate ( unsigned int v)
inlinestatic

Definition at line 626 of file vpMath.h.

◆ saturate() [31/37]

template<>
char vpMath::saturate ( unsigned int v)
inlinestatic

Definition at line 583 of file vpMath.h.

◆ saturate() [32/37]

template<>
unsigned char vpMath::saturate ( unsigned int v)
inlinestatic

Definition at line 545 of file vpMath.h.

◆ saturate() [33/37]

template<>
short vpMath::saturate ( unsigned short v)
inlinestatic

Definition at line 644 of file vpMath.h.

◆ saturate() [34/37]

template<>
char vpMath::saturate ( unsigned short v)
inlinestatic

Definition at line 568 of file vpMath.h.

◆ saturate() [35/37]

template<>
unsigned char vpMath::saturate ( unsigned short v)
inlinestatic

Definition at line 530 of file vpMath.h.

◆ saturate() [36/37]

template<typename Tp>
Tp vpMath::saturate ( unsigned short v)
inlinestatic

Definition at line 308 of file vpMath.h.

◆ saturate() [37/37]

template<typename Tp>
Tp vpMath::saturate ( unsigned v)
inlinestatic

Definition at line 310 of file vpMath.h.

◆ sigmoid()

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

Sigmoid function between [x0,x1] with $ s(x)=0 if x\le x0$ and $ s(x)=1
if x \ge x1 $

Parameters
x: Value of x.
x0: Lower bound (default 0).
x1: Upper bound (default 1).
n: Degree of the exponential (default 12).
Returns
Sigmoid value $1/(1+exp(-n*((x-x0)/(x1-x0)-0.5)))$

Definition at line 501 of file vpMath.h.

◆ sign()

int vpMath::sign ( double x)
inlinestatic

Return the sign of x.

Parameters
x: Value to test.
Returns
-1 if x is negative, +1 if positive and 0 if zero.

Definition at line 432 of file vpMath.h.

Referenced by vpThetaUVector::buildFrom(), vpMbEdgeTracker::computeVVSFirstPhase(), and vpMeNurbs::seekExtremities().

◆ sinc() [1/2]

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

Compute sinus cardinal $ \frac{sin(x)}{x}$.

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

Definition at line 306 of file vpMath.cpp.

◆ sinc() [2/2]

double vpMath::sinc ( double x)
static

Compute sinus cardinal $ \frac{sin(x)}{x} $.

Parameters
x: Value of x.
Returns
Sinus cardinal.

Definition at line 289 of file vpMath.cpp.

Referenced by vpRotationMatrix::buildFrom(), vpThetaUVector::buildFrom(), vpExponentialMap::direct(), vpFeatureThetaU::interaction(), and vpExponentialMap::inverse().

◆ sqr()

double vpMath::sqr ( double x)
inlinestatic

Compute x square value.

Returns
Square value $ x^2 $.
Examples
catchColorConversion.cpp, servoPololuPtuPoint2DJointVelocity.cpp, servoSimuSphere.cpp, servoViper850Point2DArtVelocity-jointAvoidance-gpa.cpp, testRobust.cpp, and tutorial-klt-tracker-with-reinit.cpp.

Definition at line 203 of file vpMath.h.

Referenced by vpMbTracker::addPolygon(), vpMbTracker::addProjectionErrorPolygon(), vpRBVisualOdometryUtils::computeIndicesObjectAndEnvironment(), vpMbtDistanceCircle::computeInteractionMatrixError(), vpCircle::computeIntersectionPoint(), vpPose::computeResidual(), vpPose::computeResidual(), vpPose::computeResidualDementhon(), vpCalibration::computeStdDeviation(), vpCalibration::computeStdDeviation_dist(), vpMbDepthDenseTracker::computeVVS(), vpMbDepthNormalTracker::computeVVS(), vpMbEdgeKltTracker::computeVVS(), vpMbEdgeTracker::computeVVS(), vpMbGenericTracker::computeVVS(), vpMbEdgeTracker::computeVVSInit(), vpMeterPixelConversion::convertEllipse(), vpMeterPixelConversion::convertEllipse(), vpMeterPixelConversion::convertEllipse(), vpMeterPixelConversion::convertEllipse(), vpMeterPixelConversion::convertEllipse(), vpMeterPixelConversion::convertEllipse(), vpMeterPixelConversion::convertLine(), vpMeterPixelConversion::convertLine(), vpPixelMeterConversion::convertLine(), vpPixelMeterConversion::convertLine(), vpPose::coplanar(), vpFeatureBuilder::create(), vpFeatureBuilder::create(), vpDot2::defineDots(), vpDisplayGTK::displayArrow(), vpDisplayX::displayArrow(), vpCalibration::displayGrid(), vpImagePoint::distance(), vpImageDraw::drawArrow(), vpImageDraw::drawArrow(), vpImageDraw::drawDottedLine(), vpImageDraw::drawDottedLine(), vpMbtFaceDepthNormal::estimateFeatures(), vpImageFilter::getGaussianDerivativeKernel(), vpImageFilter::getGaussianKernel(), vpViper::getInverseKinematicsWrist(), vpPointMap::getOutliers(), vpImageTools::initUndistortMap(), vpImageTools::integralImage(), vpFeatureEllipse::interaction(), vpFeatureThetaU::interaction(), vpRotationMatrix::isARotationMatrix(), vpScale::KernelDensityGradient(), vpScale::KernelDensityGradient_EPANECHNIKOV(), vpMeLine::leastSquare(), vpMeNurbs::localReSample(), vpScale::MeanShift(), vpImageTools::normalizedCorrelation(), vpRBConvergenceADDMetric::operator()(), vpRBConvergenceReprojectionMetric::operator()(), vpMeLine::plugHoles(), vpPose::poseVirtualVSrobust(), vpPose::poseVirtualVSWithDepth(), vpCircle::projection(), vpSphere::projection(), vpNurbs::removeCurveKnot(), vpMeLine::sample(), vpMeNurbs::sample(), vpRBProbabilistic3DDriftDetector::score(), vpMeLine::seekExtremities(), vpMeNurbs::seekExtremitiesCanny(), vpPointMap::selectValidNewCandidates(), vpImagePoint::sqrDistance(), vpMeSite::sqrDistance(), vpMeNurbs::supressNearPoints(), vpMeSite::track(), vpMeSite::trackMultipleHypotheses(), and vpRBProbabilistic3DDriftDetector::update().

◆ swap()

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

Exchange two numbers.

Parameters
aFirst number to exchange.
bSecond number to exchange

Definition at line 289 of file vpMath.h.