Skip to content

Namespace inertialsim::geometry

Namespace List > inertialsim > geometry

Namespaces

Type Name
namespace axis_angle
namespace cartesian
namespace euler_angles
namespace legendre
namespace matrix
namespace power_series
namespace quaternion
namespace random
namespace rotation_vector
namespace spherical

Classes

Type Name
class CoordinateRotation
3-dimensional coordinate frame rotations (passive convention).
class CoordinateTransform
3-dimensional coordinate frame transforms (passive convention).
class CoordinateTranslation
3-dimensional coordinate frame translations (passive convention).
class ExtendedPose
Extended pose (attitude, position, and velocity).
class FloatingPointTolerances
Singleton class for managing floating point tolerance settings.
class MatrixLieGroup <typename Derived, GroupDimension, AlgebraDimension>
Abstract base class for matrix Lie groups using CRTP.
class Pose
Pose (position and orientation).
class RigidTransform
3-dimensional rigid body transforms (SE(3)).
class RigidTransformBase <typename Derived>
CRTP base for 3-dimensional rigid body transform types.
class Rotation
3-dimensional rotations of rigid bodies.
class RotationBase <typename Derived>
CRTP base for 3-dimensional rotation types.
class Translation
3-dimensional translations.
class Vector
3-dimensional vectors.
class VectorBase <typename Derived>
CRTP base for 3-dimensional vector types.

Public Types

Type Name
enum Integrator
Integration methods.
enum Interpolator

Public Attributes

Type Name
const std::map< char, int > kAxisIndex
Map from axis character ('X','Y','Z') to index.
const std::map< char, Vector3D > kCartesianBasis
Map from axis character ('X','Y','Z') to basis vector.
constexpr double kDefaultFpTolerance = 100.0 \* std::numeric\_limits&lt;double&gt;::epsilon()
Standard tolerance for floating point equivalence checks.
constexpr double kMetersPerInternationalFoot = 0.3048
Common unit conversions.
constexpr int kNumCartesianAxes = 3
Standard number of Cartesian axes.
constexpr double kPi = 3.14159265358979323846
Mathematical constant Pi.
const Vector3D kXBasis
Standard Cartesian basis vectors.
const Vector3D kYBasis
const Vector3D kZBasis

Public Functions

Type Name
Vector3D CrossProduct (const Vector3D & a, const Vector3D & b)
Compute the column-wise cross product of 3D vectors.
Array CumulativeIntegral (const Array & array, const Timestamps & time, Integrator method=Integrator::TRAPEZOID, const std::optional< Array > initial_value=std::nullopt)
Compute column-wise cumulative integral of an array.
Array CumulativeSum (const Array & array)
Compute column-wise cumulative sum of an array.
double Deg2Rad (double degrees)
Converts degrees to radians (scalar version).
Array Deg2Rad (const Array & degrees)
Converts degrees to radians (array version).
Scalar1D DotProduct (const Vector3D & a, const Vector3D & b)
Compute the column-wise dot (inner) product of 3D vectors.
std::vector< Scalar1D > FiniteDifferenceWeights (const Timestamps & time, int order, int accuracy)
Compute finite difference weights.
bool IsOrthonormal (const RotationMatrix & matrix, std::optional< double > orthogonal_threshold=std::nullopt, std::optional< double > normal_threshold=std::nullopt)
Check if a 3x3 matrix is orthonormal.
BooleanArray IsOrthonormal (const RotationMatrixArray & matrices, std::optional< double > orthogonal_threshold=std::nullopt, std::optional< double > normal_threshold=std::nullopt)
Check if an array of 3x3 matrices are orthonormal.
bool IsSorted (const Scalar1D & array)
Checks if an array is sorted.
bool IsStrictlySorted (const Scalar1D & array)
Checks if an array is strictly sorted.
bool IsUnit (double value)
Check if input is close to one.
BooleanArray IsUnit (const Array & array)
Check if elements of an array are close to one.
bool IsZero (double value)
Check if input is close to zero.
BooleanArray IsZero (const Array & array)
Check if elements of an array are close to zero.
int LeviCivita (int i, int j, int k)
Levi-Civita symbol.
std::pair< Matrix, Scalar1D > NormalizeVector (const Matrix & vectors)
Normalize an array of vectors.
double Rad2Deg (double radians)
Converts radians to degrees (scalar version).
Array Rad2Deg (const Array & radians)
Converts radians to degrees (array version).
int Sign (double value)
Element-wise sign function.
RotationMatrix SkewMatrix (const Eigen::Vector3d & vector)
Create a skew-symmetric matrix from a single 3D vector.
RotationMatrixArray SkewMatrix (const Vector3D & vector)
Create skew-symmetric matrices from multiple 3D vectors.
std::vector< Array > SlidingWindow (const Array & array, int window_size)
Column-wise sliding windows over an array.
IntegerArray VectorArgmax (const Matrix & vectors)
Find the argmax for each vector in an array.
Array WrapTo2Pi (const Array & angle)
Wraps the input angles such that 0 <= angle < 2*pi .
Array WrapToPi (const Array & angle)
Wraps the input angles such that -pi < angle <= pi .

Public Types Documentation

enum Integrator

Integration methods.

enum inertialsim::geometry::Integrator {
    EULER,
    TRAPEZOID,
    RK4
};


enum Interpolator

enum inertialsim::geometry::Interpolator {
    LINEAR,
    CUBIC
};

Public Attributes Documentation

variable kAxisIndex

Map from axis character ('X','Y','Z') to index.

const std::map<char, int> inertialsim::geometry::kAxisIndex;


variable kCartesianBasis

Map from axis character ('X','Y','Z') to basis vector.

const std::map<char, Vector3D> inertialsim::geometry::kCartesianBasis;


variable kDefaultFpTolerance

Standard tolerance for floating point equivalence checks.

constexpr double inertialsim::geometry::kDefaultFpTolerance;


variable kMetersPerInternationalFoot

Common unit conversions.

constexpr double inertialsim::geometry::kMetersPerInternationalFoot;

Conversion factor from international feet to meters.

Note:

This is the international foot and not the U.S. survey foot. Some older inertial navigation references use the latter. As of 1/1/2023, NIST recommends avoiding any use of the survey foot. The value of the international foot is defined in Standard [01]. See: https://www.nist.gov/pml/us-surveyfoot


variable kNumCartesianAxes

Standard number of Cartesian axes.

constexpr int inertialsim::geometry::kNumCartesianAxes;


variable kPi

Mathematical constant Pi.

constexpr double inertialsim::geometry::kPi;


variable kXBasis

Standard Cartesian basis vectors.

const Vector3D inertialsim::geometry::kXBasis;


variable kYBasis

const Vector3D inertialsim::geometry::kYBasis;

variable kZBasis

const Vector3D inertialsim::geometry::kZBasis;

Public Functions Documentation

function CrossProduct

Compute the column-wise cross product of 3D vectors.

Vector3D inertialsim::geometry::CrossProduct (
    const Vector3D & a,
    const Vector3D & b
) 

Parameters:

  • a First vector.
  • b Second vector.

Returns:

The cross product vector.


function CumulativeIntegral

Compute column-wise cumulative integral of an array.

Array inertialsim::geometry::CumulativeIntegral (
    const Array & array,
    const Timestamps & time,
    Integrator method=Integrator::TRAPEZOID,
    const std::optional< Array > initial_value=std::nullopt
) 

Parameters:

  • array The array to integrate (rows are independent axes, columns are time samples).
  • time The time array.
  • method Integration method.
  • initial_value Optional initial value.

Returns:

The cumulative integral.


function CumulativeSum

Compute column-wise cumulative sum of an array.

Array inertialsim::geometry::CumulativeSum (
    const Array & array
) 

Parameters:

  • array The array to sum (rows are independent axes, columns are time samples).

Returns:

The cumulative sum.


function Deg2Rad

Converts degrees to radians (scalar version).

inline double inertialsim::geometry::Deg2Rad (
    double degrees
) 

Parameters:

  • degrees Angle in degrees.

Returns:

Angle in radians.


function Deg2Rad

Converts degrees to radians (array version).

inline Array inertialsim::geometry::Deg2Rad (
    const Array & degrees
) 

Parameters:

  • degrees Angle(s) in degrees.

Returns:

Angle(s) in radians.


function DotProduct

Compute the column-wise dot (inner) product of 3D vectors.

Scalar1D inertialsim::geometry::DotProduct (
    const Vector3D & a,
    const Vector3D & b
) 

Parameters:

  • a First vector.
  • b Second vector.

Returns:

The dot product.


function FiniteDifferenceWeights

Compute finite difference weights.

std::vector< Scalar1D > inertialsim::geometry::FiniteDifferenceWeights (
    const Timestamps & time,
    int order,
    int accuracy
) 

Parameters:

  • time Time array.
  • order Derivative order.
  • accuracy Accuracy order.

Returns:

Vector of weight arrays, one per timestamp. Each element is a Scalar1D of length window_size containing the weights for that timestamp.


function IsOrthonormal

Check if a 3x3 matrix is orthonormal.

bool inertialsim::geometry::IsOrthonormal (
    const RotationMatrix & matrix,
    std::optional< double > orthogonal_threshold=std::nullopt,
    std::optional< double > normal_threshold=std::nullopt
) 

A matrix is orthonormal if its columns (or rows) are orthogonal unit vectors. This is equivalent to checking that \(M^T M = I\).

Parameters:

  • matrix The 3x3 matrix to check.
  • orthogonal_threshold Threshold for orthogonality check (default from tolerances). Columns must be orthogonal within this tolerance.
  • normal_threshold Threshold for normality check (default from tolerances). Column norms must be 1.0 within this tolerance.

Returns:

True if the matrix is orthonormal within the specified thresholds.


function IsOrthonormal

Check if an array of 3x3 matrices are orthonormal.

BooleanArray inertialsim::geometry::IsOrthonormal (
    const RotationMatrixArray & matrices,
    std::optional< double > orthogonal_threshold=std::nullopt,
    std::optional< double > normal_threshold=std::nullopt
) 

Parameters:

  • matrices Vector of matrices.
  • orthogonal_threshold Threshold for orthogonality check.
  • normal_threshold Threshold for normality check.

Returns:

Array of booleans indicating orthonormality.


function IsSorted

Checks if an array is sorted.

bool inertialsim::geometry::IsSorted (
    const Scalar1D & array
) 

Parameters:

  • array The array to check.

Returns:

True if the array is sorted, false otherwise.


function IsStrictlySorted

Checks if an array is strictly sorted.

bool inertialsim::geometry::IsStrictlySorted (
    const Scalar1D & array
) 

Parameters:

  • array The array to check.

Returns:

True if the array is strictly sorted, false otherwise.


function IsUnit

Check if input is close to one.

bool inertialsim::geometry::IsUnit (
    double value
) 

Parameters:

  • value The value to check.

Returns:

True if the value is "close" to one.


function IsUnit

Check if elements of an array are close to one.

BooleanArray inertialsim::geometry::IsUnit (
    const Array & array
) 

Parameters:

  • array The array to check.

Returns:

Boolean array indicating which elements are close to one.


function IsZero

Check if input is close to zero.

bool inertialsim::geometry::IsZero (
    double value
) 

Checks if the value is within the default floating point tolerance of zero. This is crucial for avoiding numerical precision issues with small divisors and for robust algorithm implementation.

Parameters:

  • value The value to check.

Returns:

True if the value is "close" to zero within tolerance.


function IsZero

Check if elements of an array are close to zero.

BooleanArray inertialsim::geometry::IsZero (
    const Array & array
) 

Parameters:

  • array The array to check.

Returns:

Boolean array indicating which elements are close to zero.


function LeviCivita

Levi-Civita symbol.

int inertialsim::geometry::LeviCivita (
    int i,
    int j,
    int k
) 

Parameters:

  • i First index.
  • j Second index.
  • k Third index.

Returns:

+1 for even permutations of (0,1,2), -1 for odd, 0 otherwise.


function NormalizeVector

Normalize an array of vectors.

std::pair< Matrix, Scalar1D > inertialsim::geometry::NormalizeVector (
    const Matrix & vectors
) 

Normalizes vectors to unit length. Handles divide-by-zero gracefully by detecting zero-length vectors.

Parameters:

  • vectors Matrix where each column is a vector to normalize (½/3xN).

Returns:

A tuple containing: * normalized vectors (same shape as input) * original norms (1 x N array)


function Rad2Deg

Converts radians to degrees (scalar version).

inline double inertialsim::geometry::Rad2Deg (
    double radians
) 

Parameters:

  • radians Angle in radians.

Returns:

Angle in degrees.


function Rad2Deg

Converts radians to degrees (array version).

inline Array inertialsim::geometry::Rad2Deg (
    const Array & radians
) 

Parameters:

  • radians Angle(s) in radians.

Returns:

Angle(s) in degrees.


function Sign

Element-wise sign function.

int inertialsim::geometry::Sign (
    double value
) 

Parameters:

  • value The input value.

Returns:

-1 if value < 0, 1 if value >= 0.


function SkewMatrix

Create a skew-symmetric matrix from a single 3D vector.

RotationMatrix inertialsim::geometry::SkewMatrix (
    const Eigen::Vector3d & vector
) 

Parameters:

  • vector A 3D vector.

Returns:

The 3x3 skew-symmetric matrix.


function SkewMatrix

Create skew-symmetric matrices from multiple 3D vectors.

RotationMatrixArray inertialsim::geometry::SkewMatrix (
    const Vector3D & vector
) 

Parameters:

  • vectors Matrix where each column is a 3D vector (3xN).

Returns:

Vector of 3x3 skew-symmetric matrices, one per column.


function SlidingWindow

Column-wise sliding windows over an array.

std::vector< Array > inertialsim::geometry::SlidingWindow (
    const Array & array,
    int window_size
) 

Parameters:

  • array The input array.
  • window_size Size of each window.

Returns:

Vector of windows.


function VectorArgmax

Find the argmax for each vector in an array.

IntegerArray inertialsim::geometry::VectorArgmax (
    const Matrix & vectors
) 

For each column vector, finds the index of the maximum component.

Example: For vector [0.1, 0.5, 0.3]^T, returns 1 (the index of 0.5).

Parameters:

  • vectors Matrix where each column is a vector (3xN).

Returns:

Array of indices (0, 1, or 2 for 3D vectors) of the largest elements in each column.


function WrapTo2Pi

Wraps the input angles such that 0 <= angle < 2*pi .

Array inertialsim::geometry::WrapTo2Pi (
    const Array & angle
) 

Parameters:

  • angle Array of angles. The operation is element-wise.

Returns:

Array of angles wrapped between [0, 2*pi).


function WrapToPi

Wraps the input angles such that -pi < angle <= pi .

Array inertialsim::geometry::WrapToPi (
    const Array & angle
) 

Parameters:

  • angle Array of angles. The operation is element-wise.

Returns:

Array of angles wrapped between (-pi, pi].



The documentation for this class was generated from the following file cpp/include/inertialsim/geometry/angle.h