Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework of eigen features in common #660

Merged
merged 19 commits into from
May 24, 2014
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Moved determinant3x3Matrix implementation into hpp + missing document…
…ation written
  • Loading branch information
VictorLamoine committed May 22, 2014
commit a8a8b95cb628e1a1293e6697f40fec7644b49b51
15 changes: 7 additions & 8 deletions common/include/pcl/common/eigen.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,13 @@ namespace pcl
template <typename Matrix> typename Matrix::Scalar
invert3x3Matrix (const Matrix &matrix, Matrix &inverse);

template<typename Matrix> inline typename Matrix::Scalar
determinant3x3Matrix (const Matrix& matrix)
{
// result is independent of Row/Col Major storage!
return matrix.coeff (0) * (matrix.coeff (4) * matrix.coeff (8) - matrix.coeff (5) * matrix.coeff (7)) +
matrix.coeff (1) * (matrix.coeff (5) * matrix.coeff (6) - matrix.coeff (3) * matrix.coeff (8)) +
matrix.coeff (2) * (matrix.coeff (3) * matrix.coeff (7) - matrix.coeff (4) * matrix.coeff (6)) ;
}
/** \brief Calculate the determinant of a 3x3 matrix.
* \param[in] matrix matrix
* \return determinant of the matrix
* \ingroup common
*/
template <typename Matrix> typename Matrix::Scalar
determinant3x3Matrix (const Matrix &matrix);

/** \brief Get the unique 3D rotation that will rotate \a z_axis into (0,0,1) and \a y_direction into a vector
* with x=0 (or into (0,1,0) should \a y_direction be orthogonal to \a z_axis)
Expand Down
10 changes: 10 additions & 0 deletions common/include/pcl/common/impl/eigen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,16 @@ pcl::invert3x3Matrix (const Matrix& matrix, Matrix& inverse)
return det;
}

//////////////////////////////////////////////////////////////////////////////////////////
template <typename Matrix> inline typename Matrix::Scalar
pcl::determinant3x3Matrix (const Matrix& matrix)
{
// result is independent of Row/Col Major storage!
return matrix.coeff (0) * (matrix.coeff (4) * matrix.coeff (8) - matrix.coeff (5) * matrix.coeff (7)) +
matrix.coeff (1) * (matrix.coeff (5) * matrix.coeff (6) - matrix.coeff (3) * matrix.coeff (8)) +
matrix.coeff (2) * (matrix.coeff (3) * matrix.coeff (7) - matrix.coeff (4) * matrix.coeff (6)) ;
}

//////////////////////////////////////////////////////////////////////////////////////////
void
pcl::getTransFromUnitVectorsZY (const Eigen::Vector3f& z_axis,
Expand Down