CustusX  2021.09.21-dev+develop.e3cd0
An IGT application
helpers.hpp File Reference
#include <cmath>

Go to the source code of this file.

Macros

#define radToDeg(x)   (180.0*x/M_PI)
 
#define degToRad(x)   (M_PI*x/180.0)
 

Functions

template<typename T >
int sgn (T val)
 
template<typename T >
length3d (T const a[3])
 
template<typename T >
void normalize3d (T normalized[3], T const toNormalize[3])
 
template<typename T >
innerProduct (T const one[3], T const two[3])
 

Macro Definition Documentation

#define degToRad (   x)    (M_PI*x/180.0)

Definition at line 59 of file helpers.hpp.

#define radToDeg (   x)    (180.0*x/M_PI)

Definition at line 58 of file helpers.hpp.

Function Documentation

template<typename T >
T innerProduct ( T const  one[3],
T const  two[3] 
)

Calculate the inner product of two vectors

Parameters
onethe first vector
twothe second vector
Returns
the inner product of one and two

Definition at line 48 of file helpers.hpp.

template<typename T >
T length3d ( T const  a[3])

Calculate the length of a 3D vector

Parameters
athe 3d vector
Returns
the length

Definition at line 19 of file helpers.hpp.

template<typename T >
void normalize3d ( normalized[3],
T const  toNormalize[3] 
)

Normalize a 3d vector

Parameters
normalizedthe normalized vector is stored here
toNormalizethe vector to normalize

Definition at line 34 of file helpers.hpp.

template<typename T >
int sgn ( val)
Returns
-1 if val is negative 0 if val is 0 1 if positive

Definition at line 9 of file helpers.hpp.