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

Go to the source code of this file.


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


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

onethe first vector
twothe second vector
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

athe 3d vector
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

normalizedthe normalized vector is stored here
toNormalizethe vector to normalize

Definition at line 34 of file helpers.hpp.

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

Definition at line 9 of file helpers.hpp.