# Utils/Algebra3D.hpp File Reference

Utility functions for 3D vector operations and affine transformations. More...

`#include <cmath>`
`#include <cstring>`
Include dependency graph for Algebra3D.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Namespaces

namespace  Utils::Algebra3D

Utility functions for 3D vector operations and affine transformations.

## Enumerations

enum  { Utils::Algebra3D::Trans_NR_ENTRIES = 3, Utils::Algebra3D::Rot_NR_ENTRIES = 9, Utils::Algebra3D::TransRot_NR_ENTRIES = 12 }

Numbers of entries for arrays representing 3D quantities.

More...

## Functions

Vector operations

static double Utils::Algebra3D::VecDotProduct (const double v1[], const double v2[])
Computes the dot product of vectors v1 and v2.
static void Utils::Algebra3D::VecCrossProduct (const double v1[], const double v2[], double v[])
Computes the cross product of vectors v1 and v2 and stores the result in v.
static double Utils::Algebra3D::VecNormSquared (const double v[])
Computes the norm squared of the vector v.
static double Utils::Algebra3D::VecNorm (const double v[])
Computes the norm of the vector v.
static void Utils::Algebra3D::VecUnit (const double v[], double vunit[])
Computes the unit vector of v and stores the result in vunit.
static void Utils::Algebra3D::VecScale (const double v[], const double s, double vscaled[])
Scales the vector v by the scalar s and stores the result in vscaled.
static void Utils::Algebra3D::VecAdd (const double v1[], const double v2[], double v[])
Adds vectors v1 and v2 and stores the result in v.
static void Utils::Algebra3D::VecSubtract (const double v1[], const double v2[], double v[])
Subtracts v2 from v1 and stores the result in v.
Identities for translations and rotations

static void Utils::Algebra3D::IdentityAsTrans (double T[])
T is set to the identity for translations.
static void Utils::Algebra3D::IdentityAsRot (double R[])
R is set to the identity for rotations.
static void Utils::Algebra3D::IdentityAsTransRot (double TR[])
TR is set to the identity for translations and rotations.
Determine if specified transformation represents the identity transformation

static bool Utils::Algebra3D::IdentitySameAsTrans (const double T[])
Determine if T is the same as the identity translation.
static bool Utils::Algebra3D::IdentitySameAsRot (const double R[])
Determine if R is the same as the identity rotation.
static bool Utils::Algebra3D::IdentitySameAsTransRot (const double TR[])
Determine if TR is the same as the identity translation and rotation.
Copy transformations

static void Utils::Algebra3D::TransAsTrans (const double x, const double y, const double z, double Tresult[])
Set Tresult to the translation given by (x, y, z).
static void Utils::Algebra3D::TransAsTrans (const double T[], double Tresult[])
Copy the translation T to Tresult.
static void Utils::Algebra3D::RotAsRot (const double R[], double Rresult[])
Copy the rotation R to Rresult.
static void Utils::Algebra3D::TransRotAsTransRot (const double TR[], double TRresult[])
Copy the transformation TR to TRresult.
Determine if specified transformations are the same

static bool Utils::Algebra3D::TransSameAsTrans (const double Ta[], const double Tb[])
Determine if the translations Ta and Tb are the same.
static bool Utils::Algebra3D::RotSameAsRot (const double Ra[], const double Rb[])
Determine if the rotations Ra and Rb are the same.
static bool Utils::Algebra3D::TransRotSameAsTransRot (const double TRa[], const double TRb[])
Determine if the transformations TRa and TRb are the same.
Apply transformation to point

static void Utils::Algebra3D::TransMultPoint (const double T[], const double p[], double pnew[])
Apply translation T to point p and store result in pnew.
static void Utils::Algebra3D::TransMultInvPoint (const double T[], const double p[], double pnew[])
Apply translation T to the inverse of point p and store result in pnew.
static void Utils::Algebra3D::InvTransMultPoint (const double T[], const double p[], double pnew[])
Apply the inverse of the translation T to point p and store result in pnew.
static void Utils::Algebra3D::InvTransMultInvPoint (const double T[], const double p[], double pnew[])
Apply the inverse translation T to the inverse of point p and store result in pnew.
static void Utils::Algebra3D::RotMultPoint (const double R[], const double p[], double pnew[])
Apply rotation R to point p and store result in pnew.
static void Utils::Algebra3D::RotMultInvPoint (const double R[], const double p[], double pnew[])
Apply rotation R to the inverse of point p and store result in pnew.
static void Utils::Algebra3D::InvRotMultPoint (const double R[], const double p[], double pnew[])
Apply the inverse of rotation R to point p and store result in pnew.
static void Utils::Algebra3D::InvRotMultInvPoint (const double R[], const double p[], double pnew[])
Apply the inverse or rotation R to the inverse of point p and store result in pnew.
static void Utils::Algebra3D::TransRotMultPoint (const double TR[], const double p[], double pnew[])
Apply transformation TR to point p and store result in pnew.
static void Utils::Algebra3D::TransRotMultInvPoint (const double TR[], const double p[], double pnew[])
Apply transformation TR to the inverse of point p and store result in pnew.
static void Utils::Algebra3D::InvTransRotMultPoint (const double TR[], const double p[], double pnew[])
Apply the inverse of the transformation TR to point p and store result in pnew.
static void Utils::Algebra3D::InvTransRotMultInvPoint (const double TR[], const double p[], double pnew[])
Apply the inverse of the transformation TR to the inverse of point p and store result in pnew.
Inverse transformations

static void Utils::Algebra3D::InvTransAsTrans (const double T[], double Tresult[])
Set Tresult as the inverse of the translation T.
static void Utils::Algebra3D::InvRotAsRot (const double R[], double Rresult[])
Set Rresult as the inverse of the rotation R.
static void Utils::Algebra3D::InvTransRotAsTransRot (const double TR[], double TRresult[])
Set TRresult as the inverse of the transformation TR.
Combine transformations

static void Utils::Algebra3D::TransMultTransAsTrans (const double Ta[], const double Tb[], double T[])
T <-- Ta + Tb.
static void Utils::Algebra3D::TransMultRotAsTransRot (const double T[], const double R[], double TR[])
TR <-- T * R.
static void Utils::Algebra3D::TransMultTransRotAsTransRot (const double T[], const double TR[], double TRresult[])
TRresult <-- T * TR.
void Utils::Algebra3D::RotMultRotAsRot (const double Ra[], const double Rb[], double R[])
R <-- Ra * Rb.
static void Utils::Algebra3D::RotMultTransAsTransRot (const double R[], const double T[], double TR[])
TR <-- R * T.
static void Utils::Algebra3D::RotMultTransRotAsTransRot (const double R[], const double TR[], double TRresult[])
TRresult <-- R * TR.
static void Utils::Algebra3D::TransRotMultTransAsTransRot (const double TR[], const double T[], double TRresult[])
TRresult <-- TR * T.
static void Utils::Algebra3D::TransRotMultRotAsTransRot (const double TR[], const double R[], double TRresult[])
TRresult <-- TR * R.
static void Utils::Algebra3D::TransRotMultTransRotAsTransRot (const double TRa[], const double TRb[], double TR[])
TRresult <-- TRa * TRb.
Validity of transformation

static bool Utils::Algebra3D::RotIsValid (const double R[])
Determine if R represent a valid rotation.

## Variables

const double Utils::Constants::EPSILON = ldexp(1.0, -36)
Defines epsilon constant.

## Detailed Description

Utility functions for 3D vector operations and affine transformations.

Definition in file Algebra3D.hpp.