Skip to content

Commit

Permalink
Adding template parameter
Browse files Browse the repository at this point in the history
Deduction using decltype is also possible but dangerous
  • Loading branch information
kunaltyagi committed Oct 25, 2019
1 parent 750d464 commit 552fa0f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions common/include/pcl/common/impl/eigen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ struct EigenVector {
Scalar length;
};

template <typename Matrix> static EigenVector<Matrix, typename Matrix::Scalar>
template <typename Vector, typename Matrix> static EigenVector<Matrix, typename Matrix::Scalar>
get_largest_3x3_eigenvector (const Matrix scaledMatrix)
{
std::array<Vector, 3> vector {scaledMatrix.row (0).cross (scaledMatrix.row (1)),
Expand Down Expand Up @@ -297,7 +297,7 @@ pcl::eigen33 (const Matrix& mat, typename Matrix::Scalar& eigenvalue, Vector& ei

scaledMat.diagonal ().array () -= eigenvalues (0);

eigenvector = detail::get_largest_3x3_eigenvector(scaledMat).vector;
eigenvector = detail::get_largest_3x3_eigenvector<Vector> (scaledMat).vector;
}

//////////////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -343,7 +343,7 @@ pcl::eigen33 (const Matrix& mat, Matrix& evecs, Vector& evals)
tmp = scaledMat;
tmp.diagonal ().array () -= evals (2);

evecs.col (2) = detail::get_largest_3x3_eigenvector(tmp).vector;
evecs.col (2) = detail::get_largest_3x3_eigenvector<Vector> (tmp).vector;
evecs.col (1) = evecs.col (2).unitOrthogonal ();
evecs.col (0) = evecs.col (1).cross (evecs.col (2));
}
Expand All @@ -354,7 +354,7 @@ pcl::eigen33 (const Matrix& mat, Matrix& evecs, Vector& evals)
tmp = scaledMat;
tmp.diagonal ().array () -= evals (0);

evecs.col (0) = detail::get_largest_3x3_eigenvector(tmp).vector;
evecs.col (0) = detail::get_largest_3x3_eigenvector<Vector> (tmp).vector;
evecs.col (1) = evecs.col (0).unitOrthogonal ();
evecs.col (2) = evecs.col (0).cross (evecs.col (1));
}
Expand All @@ -366,7 +366,7 @@ pcl::eigen33 (const Matrix& mat, Matrix& evecs, Vector& evals)
{
Matrix tmp = scaledMat;
tmp.diagonal ().array () -= evals (i);
const auto vec_len = detail::get_largest_3x3_eigenvector (tmp);
const auto vec_len = detail::get_largest_3x3_eigenvector<Vector> (tmp);
evecs.col (i) = vec_len.vector;
eigenVecLen[i] = vec_len.length;
}
Expand Down

0 comments on commit 552fa0f

Please sign in to comment.