maliput
maliput::math Namespace Reference

Detailed Description

Namespace to group basic mathematical and geometric support to maliput.

Namespaces

 details
 

Classes

class  AxisAlignedBox
 Implements BoundingRegion abstract class for axis-aligned-box-shaped bounding regions. More...
 
class  BoundingBox
 Implements BoundingRegion abstract class for non-axis-aligned-box-shaped bounding regions. More...
 
class  BoundingRegion
 Abstract API for bounding description. More...
 
class  KDTree
 N-Dimension KDTree. More...
 
class  KDTree3D
 3-Dimensional KDTree. More...
 
class  Matrix
 A squared N-dimensional matrix. More...
 
class  Quaternion
 A Quaternion representation. More...
 
class  RollPitchYaw
 This class represents the orientation between two arbitrary frames A and D associated with a Space-fixed (extrinsic) X-Y-Z rotation by "roll-pitch-yaw" angles [r, p, y], which is equivalent to a Body-fixed (intrinsic) Z-Y-X rotation by "yaw-pitch-roll" angles [y, p, r]. More...
 
class  Vector
 A N-dimensional vector. More...
 
class  Vector2
 A 2-dimensional vector. More...
 
class  Vector3
 A 3-dimensional vector. More...
 
class  Vector4
 A 4-dimensional vector. More...
 
class  VectorBase
 Base class for an N-dimensional vector. More...
 

Typedefs

using Matrix2 = Matrix< 2 >
 Convinient alias declaration. More...
 
using Matrix3 = Matrix< 3 >
 
using Matrix4 = Matrix< 4 >
 

Enumerations

enum  CompareType { kAbsolute, kRelative }
 
enum  OverlappingType : unsigned int { kDisjointed = 0, kIntersected = 1, kContained = 3 }
 Holds the possible overlapping types between regions. More...
 

Functions

template<std::size_t N, typename Derived >
common::ComparisonResult< math::VectorBase< N, Derived > > CompareVectors (const math::VectorBase< N, Derived > &v1, const math::VectorBase< N, Derived > &v2, double tolerance=0.0, CompareType compare_type=CompareType::kAbsolute)
 Evaluate that two vectors v1 and v2 are equal down to a certain tolerance. More...
 
template<std::size_t N>
common::ComparisonResult< math::Matrix< N > > CompareMatrices (const math::Matrix< N > &m1, const math::Matrix< N > &m2, double tolerance=0.0, CompareType compare_type=CompareType::kAbsolute)
 Evaluate that two matrices m1 and m2 are equal down to a certain tolerance. More...
 
Vector2 ComputeFresnelCosineAndSine (double t)
 Computes the value the Fresnel cosine and sine as a vector. More...
 
double FresnelSpiralHeading (double t, double k_dot)
 Computes the unwrapped heading angle of a Fresnel (Cornu) spiral. More...
 
double FresnelSpiralHeadingDot (double t, double k_dot)
 Computes the derivative of the heading angle of a Fresnel (Cornu) spiral. More...
 
template<std::size_t N, typename Derived >
Derived operator* (const Matrix< N > &matrix, const VectorBase< N, Derived > vector)
 Product operator overload between a Matrix<N> and a VectorBase<N, Derived>. More...
 
OverlappingType operator| (const OverlappingType &first, const OverlappingType &second)
 
OverlappingType operator& (const OverlappingType &first, const OverlappingType &second)
 
std::ostream & operator<< (std::ostream &os, const Quaternion &q)
 Serialization operator overload. More...
 
double saturate (double x, double min, double max)
 When x is less than min, it returns min. More...
 
template<std::size_t N_>
Matrix< N_ > operator* (const Matrix< N_ > &matrix, double k)
 
template<std::size_t N_>
Matrix< N_ > operator* (double k, const Matrix< N_ > &matrix)
 
template<std::size_t N_>
std::ostream & operator<< (std::ostream &os, const Matrix< N_ > &matrix)
 
template Matrix< 2 > operator* (const Matrix< 2 > &, double)
 
template Matrix< 3 > operator* (const Matrix< 3 > &, double)
 
template Matrix< 4 > operator* (const Matrix< 4 > &, double)
 
template Matrix< 2 > operator* (double, const Matrix< 2 > &)
 
template Matrix< 3 > operator* (double, const Matrix< 3 > &)
 
template Matrix< 4 > operator* (double, const Matrix< 4 > &)
 
template std::ostream & operator<< (std::ostream &, const Matrix< 2 > &)
 
template std::ostream & operator<< (std::ostream &, const Matrix< 3 > &)
 
template std::ostream & operator<< (std::ostream &, const Matrix< 4 > &)
 
template Vector2 operator* (const Matrix< 2 > &matrix, const VectorBase< 2, Vector2 > vector)
 
template Vector3 operator* (const Matrix< 3 > &matrix, const VectorBase< 3, Vector3 > vector)
 
template Vector4 operator* (const Matrix< 4 > &matrix, const VectorBase< 4, Vector4 > vector)
 
template<std::size_t N_, typename Derived_ >
Derived_ operator* (const VectorBase< N_, Derived_ > &vector, double scalar)
 
template<std::size_t N_, typename Derived_ >
Derived_ operator* (double scalar, const VectorBase< N_, Derived_ > &vector)
 
template<std::size_t N_, typename Derived_ >
std::ostream & operator<< (std::ostream &os, const VectorBase< N_, Derived_ > &vector)
 
template Vector< 1 > operator* (const VectorBase< 1, Vector< 1 >> &, double)
 
template Vector< 1 > operator* (double, const VectorBase< 1, Vector< 1 >> &)
 
template Vector< 2 > operator* (const VectorBase< 2, Vector< 2 >> &, double)
 
template Vector< 2 > operator* (double, const VectorBase< 2, Vector< 2 >> &)
 
template Vector< 3 > operator* (const VectorBase< 3, Vector< 3 >> &, double)
 
template Vector< 3 > operator* (double, const VectorBase< 3, Vector< 3 >> &)
 
template Vector< 4 > operator* (const VectorBase< 4, Vector< 4 >> &, double)
 
template Vector< 4 > operator* (double, const VectorBase< 4, Vector< 4 >> &)
 
template std::ostream & operator<< (std::ostream &, const VectorBase< 1, Vector< 1 >> &)
 
template std::ostream & operator<< (std::ostream &, const VectorBase< 2, Vector< 2 >> &)
 
template std::ostream & operator<< (std::ostream &, const VectorBase< 3, Vector< 3 >> &)
 
template std::ostream & operator<< (std::ostream &, const VectorBase< 4, Vector< 4 >> &)
 
template Vector2 operator* (const VectorBase< 2, Vector2 > &, double)
 
template Vector2 operator* (double, const VectorBase< 2, Vector2 > &)
 
template std::ostream & operator<< (std::ostream &, const VectorBase< 2, Vector2 > &)
 
template Vector3 operator* (const VectorBase< 3, Vector3 > &, double)
 
template Vector3 operator* (double, const VectorBase< 3, Vector3 > &)
 
template std::ostream & operator<< (std::ostream &, const VectorBase< 3, Vector3 > &)
 
template Vector4 operator* (const VectorBase< 4, Vector4 > &, double)
 
template Vector4 operator* (double, const VectorBase< 4, Vector4 > &)
 
template std::ostream & operator<< (std::ostream &, const VectorBase< 4, Vector4 > &)
 

Typedef Documentation

◆ Matrix2

using Matrix2 = Matrix<2>

Convinient alias declaration.

◆ Matrix3

using Matrix3 = Matrix<3>

◆ Matrix4

using Matrix4 = Matrix<4>

Enumeration Type Documentation

◆ CompareType

enum CompareType
strong
Enumerator
kAbsolute 
kRelative 

◆ OverlappingType

enum OverlappingType : unsigned int
strong

Holds the possible overlapping types between regions.

Given two sets A and B :

Enumerator
kDisjointed 

No overlapping between bounding regions.

kIntersected 

Bounding regions are intersected.

kContained 

Bounding regions are contained.

Function Documentation

◆ CompareMatrices()

common::ComparisonResult< math::Matrix< N > > CompareMatrices ( const math::Matrix< N > &  m1,
const math::Matrix< N > &  m2,
double  tolerance = 0.0,
CompareType  compare_type = CompareType::kAbsolute 
)

Evaluate that two matrices m1 and m2 are equal down to a certain tolerance.

Instantiations for comparing Matrix2, Matrix3 and Matrix4 are provided.

Parameters
m1The first matrix to compare.
m2The second matrix to compare.
toleranceThe tolerance for determining equivalence.
compare_typeWhether the tolerance is absolute or relative.
Returns
A ComparisonResult<Matrix<N>> object.

◆ CompareVectors()

common::ComparisonResult< math::VectorBase< N, Derived > > CompareVectors ( const math::VectorBase< N, Derived > &  v1,
const math::VectorBase< N, Derived > &  v2,
double  tolerance = 0.0,
CompareType  compare_type = CompareType::kAbsolute 
)

Evaluate that two vectors v1 and v2 are equal down to a certain tolerance.

Instantiations for comparing Vector2, Vector3 and Vector4 are provided.

Parameters
v1The first vector to compare.
v2The second vector to compare.
toleranceThe tolerance for determining equivalence.
compare_typeWhether the tolerance is absolute or relative.
Returns
A ComparisonResult<VectorBase<N, Derived>> object.

◆ ComputeFresnelCosineAndSine()

Vector2 ComputeFresnelCosineAndSine ( double  t)

Computes the value the Fresnel cosine and sine as a vector.

This function wraps a Cephes Mathematical Library based implementation of the Fresnel cosine and sine functions. This code can be found in various libraries, such as the scipy.special.fresnel function and many others. For ease of use and compatibility with the expected use as a tool of curves in the plane (i.e. z=0), the output of this function is provided as a Vector2.

Note that the algorithm takes 3 ranges of values of t:

  • When t is infinity: the returned vector is (0.5, 0.5).
  • When t is less than ~ 1.13: a power series expansion is used.
  • Other cases of t: a combination of power series with auxiliary functions is used.
Parameters
tThe argument of the Fresnel cosine and sine functions.
Returns
A Vector2 whose zero index value is the Fresnel cosine and the one index value is the Fresnel sine.

◆ FresnelSpiralHeading()

double FresnelSpiralHeading ( double  t,
double  k_dot 
)

Computes the unwrapped heading angle of a Fresnel (Cornu) spiral.

Parameters
tThe parameter of the Fresnel sine and cosine.
k_dotThe rate in curvature of the spiral.
Returns
The unwrapped heading angle of a Fresnel (Cornu) spiral.

◆ FresnelSpiralHeadingDot()

double FresnelSpiralHeadingDot ( double  t,
double  k_dot 
)

Computes the derivative of the heading angle of a Fresnel (Cornu) spiral.

Parameters
tThe parameter of the Fresnel sine and cosine.
k_dotThe rate in curvature of the spiral.
Returns
The unwrapped heading angle of a Fresnel (Cornu) spiral.

◆ operator&()

OverlappingType operator& ( const OverlappingType first,
const OverlappingType second 
)

◆ operator*() [1/28]

template Matrix<2> maliput::math::operator* ( const Matrix< 2 > &  ,
double   
)

◆ operator*() [2/28]

template Vector2 maliput::math::operator* ( const Matrix< 2 > &  matrix,
const VectorBase< 2, Vector2 vector 
)

◆ operator*() [3/28]

template Matrix<3> maliput::math::operator* ( const Matrix< 3 > &  ,
double   
)

◆ operator*() [4/28]

template Vector3 maliput::math::operator* ( const Matrix< 3 > &  matrix,
const VectorBase< 3, Vector3 vector 
)

◆ operator*() [5/28]

template Matrix<4> maliput::math::operator* ( const Matrix< 4 > &  ,
double   
)

◆ operator*() [6/28]

template Vector4 maliput::math::operator* ( const Matrix< 4 > &  matrix,
const VectorBase< 4, Vector4 vector 
)

◆ operator*() [7/28]

Derived operator* ( const Matrix< N > &  matrix,
const VectorBase< N, Derived >  vector 
)

Product operator overload between a Matrix<N> and a VectorBase<N, Derived>.

◆ operator*() [8/28]

Matrix<N_> maliput::math::operator* ( const Matrix< N_ > &  matrix,
double  k 
)

◆ operator*() [9/28]

template Vector<1> maliput::math::operator* ( const VectorBase< 1, Vector< 1 >> &  ,
double   
)

◆ operator*() [10/28]

template Vector2 maliput::math::operator* ( const VectorBase< 2, Vector2 > &  ,
double   
)

◆ operator*() [11/28]

template Vector<2> maliput::math::operator* ( const VectorBase< 2, Vector< 2 >> &  ,
double   
)

◆ operator*() [12/28]

template Vector3 maliput::math::operator* ( const VectorBase< 3, Vector3 > &  ,
double   
)

◆ operator*() [13/28]

template Vector<3> maliput::math::operator* ( const VectorBase< 3, Vector< 3 >> &  ,
double   
)

◆ operator*() [14/28]

template Vector4 maliput::math::operator* ( const VectorBase< 4, Vector4 > &  ,
double   
)

◆ operator*() [15/28]

template Vector<4> maliput::math::operator* ( const VectorBase< 4, Vector< 4 >> &  ,
double   
)

◆ operator*() [16/28]

Derived_ maliput::math::operator* ( const VectorBase< N_, Derived_ > &  vector,
double  scalar 
)

◆ operator*() [17/28]

Matrix<N_> maliput::math::operator* ( double  k,
const Matrix< N_ > &  matrix 
)

◆ operator*() [18/28]

Derived_ maliput::math::operator* ( double  scalar,
const VectorBase< N_, Derived_ > &  vector 
)

◆ operator*() [19/28]

template Matrix<2> maliput::math::operator* ( double  ,
const Matrix< 2 > &   
)

◆ operator*() [20/28]

template Matrix<3> maliput::math::operator* ( double  ,
const Matrix< 3 > &   
)

◆ operator*() [21/28]

template Matrix<4> maliput::math::operator* ( double  ,
const Matrix< 4 > &   
)

◆ operator*() [22/28]

template Vector<1> maliput::math::operator* ( double  ,
const VectorBase< 1, Vector< 1 >> &   
)

◆ operator*() [23/28]

template Vector2 maliput::math::operator* ( double  ,
const VectorBase< 2, Vector2 > &   
)

◆ operator*() [24/28]

template Vector<2> maliput::math::operator* ( double  ,
const VectorBase< 2, Vector< 2 >> &   
)

◆ operator*() [25/28]

template Vector3 maliput::math::operator* ( double  ,
const VectorBase< 3, Vector3 > &   
)

◆ operator*() [26/28]

template Vector<3> maliput::math::operator* ( double  ,
const VectorBase< 3, Vector< 3 >> &   
)

◆ operator*() [27/28]

template Vector4 maliput::math::operator* ( double  ,
const VectorBase< 4, Vector4 > &   
)

◆ operator*() [28/28]

template Vector<4> maliput::math::operator* ( double  ,
const VectorBase< 4, Vector< 4 >> &   
)

◆ operator<<() [1/13]

template std::ostream& maliput::math::operator<< ( std::ostream &  ,
const Matrix< 2 > &   
)

◆ operator<<() [2/13]

template std::ostream& maliput::math::operator<< ( std::ostream &  ,
const Matrix< 3 > &   
)

◆ operator<<() [3/13]

template std::ostream& maliput::math::operator<< ( std::ostream &  ,
const Matrix< 4 > &   
)

◆ operator<<() [4/13]

template std::ostream& maliput::math::operator<< ( std::ostream &  ,
const VectorBase< 1, Vector< 1 >> &   
)

◆ operator<<() [5/13]

template std::ostream& maliput::math::operator<< ( std::ostream &  ,
const VectorBase< 2, Vector2 > &   
)

◆ operator<<() [6/13]

template std::ostream& maliput::math::operator<< ( std::ostream &  ,
const VectorBase< 2, Vector< 2 >> &   
)

◆ operator<<() [7/13]

template std::ostream& maliput::math::operator<< ( std::ostream &  ,
const VectorBase< 3, Vector3 > &   
)

◆ operator<<() [8/13]

template std::ostream& maliput::math::operator<< ( std::ostream &  ,
const VectorBase< 3, Vector< 3 >> &   
)

◆ operator<<() [9/13]

template std::ostream& maliput::math::operator<< ( std::ostream &  ,
const VectorBase< 4, Vector4 > &   
)

◆ operator<<() [10/13]

template std::ostream& maliput::math::operator<< ( std::ostream &  ,
const VectorBase< 4, Vector< 4 >> &   
)

◆ operator<<() [11/13]

std::ostream& maliput::math::operator<< ( std::ostream &  os,
const Matrix< N_ > &  matrix 
)

◆ operator<<() [12/13]

std::ostream & operator<< ( std::ostream &  os,
const Quaternion q 
)

Serialization operator overload.

Parameters
osThe output stream to serialize q into.
qA Quaternion.
Returns
os.

◆ operator<<() [13/13]

std::ostream& maliput::math::operator<< ( std::ostream &  os,
const VectorBase< N_, Derived_ > &  vector 
)

◆ operator|()

OverlappingType operator| ( const OverlappingType first,
const OverlappingType second 
)

◆ saturate()

double saturate ( double  x,
double  min,
double  max 
)

When x is less than min, it returns min.

When x is greater than max, it returns max. Otherwise, it returns x.

Exceptions
common::assertion_errorWhen min is greater than max.
maliput::math::OverlappingType::kIntersected
@ kIntersected
Bounding regions are intersected.
maliput::math::OverlappingType
OverlappingType
Holds the possible overlapping types between regions.
Definition: overlapping_type.h:50