opensurgsim
|
Definitions of small fixed-size vector types. More...
#include <array>
#include <vector>
#include <Eigen/Core>
#include <Eigen/Geometry>
#include "SurgSim/Framework/Assert.h"
Go to the source code of this file.
Namespaces | |
SurgSim | |
Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui needs glew but we need to call glewInit() from a osg callback, using this call we avoid getting warnings about redefinitions. | |
Typedefs | |
typedef Eigen::Matrix< float, 2, 1 > | SurgSim::Math::Vector2f |
A 2D vector of floats. More... | |
typedef Eigen::Matrix< float, 3, 1 > | SurgSim::Math::Vector3f |
A 3D vector of floats. More... | |
typedef Eigen::Matrix< float, 4, 1 > | SurgSim::Math::Vector4f |
A 4D vector of floats. More... | |
typedef Eigen::Matrix< float, 6, 1 > | SurgSim::Math::Vector6f |
A 6D vector of floats. More... | |
typedef Eigen::Matrix< double, 2, 1 > | SurgSim::Math::Vector2d |
A 2D vector of doubles. More... | |
typedef Eigen::Matrix< double, 3, 1 > | SurgSim::Math::Vector3d |
A 3D vector of doubles. More... | |
typedef Eigen::Matrix< double, 4, 1 > | SurgSim::Math::Vector4d |
A 4D vector of doubles. More... | |
typedef Eigen::Matrix< double, 6, 1 > | SurgSim::Math::Vector6d |
A 6D matrix of doubles. More... | |
typedef Eigen::Matrix< double, Eigen::Dynamic, 1 > | SurgSim::Math::Vector |
A dynamic size column vector. | |
Functions | |
template<class Vector , class SubVector > | |
void | SurgSim::Math::addSubVector (const SubVector &subVector, Eigen::Index blockId, Eigen::Index blockSize, Vector *vector) |
Helper method to add a sub-vector into a vector, for the sake of clarity. More... | |
template<class Vector , class SubVector > | |
void | SurgSim::Math::addSubVector (const Eigen::Ref< const SubVector > &subVector, const std::vector< size_t > &blockIds, Eigen::Index blockSize, Vector *vector) |
Helper method to add a sub-vector per block into a vector, for the sake of clarity. More... | |
template<class Vector , class SubVector > | |
void | SurgSim::Math::setSubVector (const SubVector &subVector, Eigen::Index blockId, Eigen::Index blockSize, Vector *vector) |
Helper method to set a sub-vector into a vector, for the sake of clarity. More... | |
template<class Vector > | |
Eigen::VectorBlock< Vector > | SurgSim::Math::getSubVector (Vector &vector, Eigen::Index blockId, Eigen::Index blockSize) |
Helper method to access a sub-vector from a vector, for the sake of clarity. More... | |
template<class Vector , class SubVector > | |
void | SurgSim::Math::getSubVector (const Vector &vector, const std::vector< size_t > &blockIds, Eigen::Index blockSize, SubVector *subVector) |
Helper method to get a sub-vector per block from a vector, for the sake of clarity. More... | |
template<typename T , int size, int TOpt> | |
Eigen::Matrix< T, size, 1, TOpt > | SurgSim::Math::interpolate (const Eigen::Matrix< T, size, 1, TOpt > &previous, const Eigen::Matrix< T, size, 1, TOpt > &next, T t) |
Interpolate (slerp) between 2 vectors. More... | |
template<class T , int VOpt> | |
bool | SurgSim::Math::buildOrthonormalBasis (Eigen::Matrix< T, 3, 1, VOpt > *i, Eigen::Matrix< T, 3, 1, VOpt > *j, Eigen::Matrix< T, 3, 1, VOpt > *k) |
Helper method to construct an orthonormal basis (i, j, k) given the 1st vector direction. More... | |
template<class T , int VOpt> | |
Eigen::Matrix< T, 3, 1, VOpt > | SurgSim::Math::robustCrossProduct (const std::array< Eigen::Matrix< T, 3, 1, VOpt >, 2 > &p, const std::array< Eigen::Matrix< T, 3, 1, VOpt >, 2 > &q, T epsilon) |
Calculate the best unit normal we can find in the direction of pXq for one of the endpoints of q. More... | |
Definitions of small fixed-size vector types.
typedef Eigen::Matrix<double, 2, 1> SurgSim::Math::Vector2d |
A 2D vector of doubles.
This type (and any structs that contain it) can be safely allocated via new.
typedef Eigen::Matrix<float, 2, 1> SurgSim::Math::Vector2f |
A 2D vector of floats.
This type (and any structs that contain it) can be safely allocated via new.
typedef Eigen::Matrix<double, 3, 1> SurgSim::Math::Vector3d |
A 3D vector of doubles.
This type (and any structs that contain it) can be safely allocated via new.
typedef Eigen::Matrix<float, 3, 1> SurgSim::Math::Vector3f |
A 3D vector of floats.
This type (and any structs that contain it) can be safely allocated via new.
typedef Eigen::Matrix<double, 4, 1> SurgSim::Math::Vector4d |
A 4D vector of doubles.
This type (and any structs that contain it) can be safely allocated via new.
typedef Eigen::Matrix<float, 4, 1> SurgSim::Math::Vector4f |
A 4D vector of floats.
This type (and any structs that contain it) can be safely allocated via new.
typedef Eigen::Matrix<double, 6, 1> SurgSim::Math::Vector6d |
A 6D matrix of doubles.
This type (and any structs that contain it) can be safely allocated via new.
typedef Eigen::Matrix<float, 6, 1> SurgSim::Math::Vector6f |
A 6D vector of floats.
This type (and any structs that contain it) can be safely allocated via new.
void SurgSim::Math::addSubVector | ( | const SubVector & | subVector, |
Eigen::Index | blockId, | ||
Eigen::Index | blockSize, | ||
Vector * | vector | ||
) |
Helper method to add a sub-vector into a vector, for the sake of clarity.
Vector | The vector type |
SubVector | The sub-vector type |
subVector | The sub-vector | |
blockId | The block index in vector | |
blockSize | The block size | |
[out] | vector | The vector to add the sub-vector into |
void SurgSim::Math::addSubVector | ( | const Eigen::Ref< const SubVector > & | subVector, |
const std::vector< size_t > & | blockIds, | ||
Eigen::Index | blockSize, | ||
Vector * | vector | ||
) |
Helper method to add a sub-vector per block into a vector, for the sake of clarity.
VectorType | The vector type |
subVector | The sub-vector (containing all the blocks) | |
blockIds | Vector of block indices (for accessing vector) corresponding to the blocks in sub-vector | |
blockSize | The block size | |
[out] | vector | The vector to add the sub-vector blocks into |
bool SurgSim::Math::buildOrthonormalBasis | ( | Eigen::Matrix< T, 3, 1, VOpt > * | i, |
Eigen::Matrix< T, 3, 1, VOpt > * | j, | ||
Eigen::Matrix< T, 3, 1, VOpt > * | k | ||
) |
Helper method to construct an orthonormal basis (i, j, k) given the 1st vector direction.
T | the numeric data type used for the vector argument. Can usually be deduced. |
VOpt | the option flags (alignment etc.) used for the vector argument. Can be deduced. |
[in,out] | i | Should provide the 1st direction on input. The 1st vector of the basis (i, j, k) on output. |
[out] | j,k | The 2nd and 3rd orthonormal vectors of the basis (i, j, k) |
Eigen::VectorBlock<Vector> SurgSim::Math::getSubVector | ( | Vector & | vector, |
Eigen::Index | blockId, | ||
Eigen::Index | blockSize | ||
) |
Helper method to access a sub-vector from a vector, for the sake of clarity.
Vector | The vector type to get the sub-vector from |
vector | The vector to get the sub-vector from |
blockId | The block index |
blockSize | The block size |
void SurgSim::Math::getSubVector | ( | const Vector & | vector, |
const std::vector< size_t > & | blockIds, | ||
Eigen::Index | blockSize, | ||
SubVector * | subVector | ||
) |
Helper method to get a sub-vector per block from a vector, for the sake of clarity.
Vector | The vector type |
SubVector | The sub-vector type |
vector | The vector (containing the blocks in a sparse manner) | |
blockIds | Vector of block indices (for accessing vector) corresponding to the blocks in vector | |
blockSize | The block size | |
[out] | subVector | The sub-vector to store the requested blocks (blockIds) from vector into |
Eigen::Matrix<T, size, 1, TOpt> SurgSim::Math::interpolate | ( | const Eigen::Matrix< T, size, 1, TOpt > & | previous, |
const Eigen::Matrix< T, size, 1, TOpt > & | next, | ||
T | t | ||
) |
Interpolate (slerp) between 2 vectors.
T | the numeric data type used for arguments and the return value. Can usually be deduced. |
size | the size of the vectors. Can be deduced. |
TOpt | the option flags (alignment etc.) used for the Vector arguments. Can be deduced. |
previous | The starting vector (at time 0.0). |
next | The ending vector (at time 1.0). |
t | The interpolation time requested. Within [0..1], although note bounds are not checked. |
Eigen::Matrix<T, 3, 1, VOpt> SurgSim::Math::robustCrossProduct | ( | const std::array< Eigen::Matrix< T, 3, 1, VOpt >, 2 > & | p, |
const std::array< Eigen::Matrix< T, 3, 1, VOpt >, 2 > & | q, | ||
T | epsilon | ||
) |
Calculate the best unit normal we can find in the direction of pXq for one of the endpoints of q.
Try multiple arrangements of the end points to reduce the artifacts when three of the vertices may be nearly collinear.
p | segment p |
q | segment q |
epsilon | when the norm of p x q is above epsilon, the cross product is assumed to be valid. return the normalized cross product of p x q |
void SurgSim::Math::setSubVector | ( | const SubVector & | subVector, |
Eigen::Index | blockId, | ||
Eigen::Index | blockSize, | ||
Vector * | vector | ||
) |
Helper method to set a sub-vector into a vector, for the sake of clarity.
Vector | The vector type |
SubVector | The sub-vector type |
subVector | The sub-vector | |
blockId | The block index in vector | |
blockSize | The size of the sub-vector | |
[out] | vector | The vector to set the sub-vector into |