50 # pragma GCC system_header
51 #elif defined __SUNPRO_CC
55 #include <pcl/ModelCoefficients.h>
57 #include <Eigen/StdVector>
58 #include <Eigen/Geometry>
68 template <
typename Scalar,
typename Roots>
void
69 computeRoots2 (
const Scalar &b,
const Scalar &c, Roots &roots);
75 template <
typename Matrix,
typename Roots>
void
84 template <
typename Matrix,
typename Vector>
void
85 eigen22 (
const Matrix &mat,
typename Matrix::Scalar &eigenvalue, Vector &eigenvector);
93 template <
typename Matrix,
typename Vector>
void
94 eigen22 (
const Matrix &mat, Matrix &eigenvectors, Vector &eigenvalues);
102 template <
typename Matrix,
typename Vector>
void
112 template <
typename Matrix,
typename Vector>
void
113 eigen33 (
const Matrix &mat,
typename Matrix::Scalar &eigenvalue, Vector &eigenvector);
120 template <
typename Matrix,
typename Vector>
void
121 eigen33 (
const Matrix &mat, Vector &evals);
129 template <
typename Matrix,
typename Vector>
void
130 eigen33 (
const Matrix &mat, Matrix &evecs, Vector &evals);
139 template <
typename Matrix>
typename Matrix::Scalar
140 invert2x2 (
const Matrix &matrix, Matrix &inverse);
149 template <
typename Matrix>
typename Matrix::Scalar
158 template <
typename Matrix>
typename Matrix::Scalar
166 template <
typename Matrix>
typename Matrix::Scalar
178 const Eigen::Vector3f& y_direction,
179 Eigen::Affine3f& transformation);
188 inline Eigen::Affine3f
190 const Eigen::Vector3f& y_direction);
201 const Eigen::Vector3f& y_direction,
202 Eigen::Affine3f& transformation);
211 inline Eigen::Affine3f
213 const Eigen::Vector3f& y_direction);
224 const Eigen::Vector3f& z_axis,
225 Eigen::Affine3f& transformation);
234 inline Eigen::Affine3f
236 const Eigen::Vector3f& z_axis);
248 const Eigen::Vector3f& z_axis,
249 const Eigen::Vector3f& origin,
250 Eigen::Affine3f& transformation);
259 template <
typename Scalar>
void
260 getEulerAngles (
const Eigen::Transform<Scalar, 3, Eigen::Affine> &t, Scalar &roll, Scalar &pitch, Scalar &yaw);
272 template <
typename Scalar>
void
274 Scalar &x, Scalar &y, Scalar &z,
275 Scalar &roll, Scalar &pitch, Scalar &yaw);
287 template <
typename Scalar>
void
288 getTransformation (Scalar x, Scalar y, Scalar z, Scalar roll, Scalar pitch, Scalar yaw,
289 Eigen::Transform<Scalar, 3, Eigen::Affine> &t);
295 return (getTransformation<float> (x, y, z, roll, pitch, yaw, t));
302 return (getTransformation<double> (x, y, z, roll, pitch, yaw, t));
315 inline Eigen::Affine3f
319 getTransformation<float> (x, y, z, roll, pitch, yaw, t);
328 template <
typename Derived>
void
329 saveBinary (
const Eigen::MatrixBase<Derived>& matrix, std::ostream& file);
336 template <
typename Derived>
void
337 loadBinary (Eigen::MatrixBase<Derived>
const& matrix, std::istream& file);
342 #define PCL_EIGEN_SIZE_MIN_PREFER_DYNAMIC(a,b) ((int (a) == 0 || int (b) == 0) ? 0 \
343 : (int (a) == 1 || int (b) == 1) ? 1 \
344 : (int (a) == Eigen::Dynamic || int (b) == Eigen::Dynamic) ? Eigen::Dynamic \
345 : (int (a) <= int (b)) ? int (a) : int (b))
377 template <
typename Derived,
typename OtherDerived>
378 typename Eigen::internal::umeyama_transform_matrix_type<Derived, OtherDerived>::type
379 umeyama (
const Eigen::MatrixBase<Derived>& src,
const Eigen::MatrixBase<OtherDerived>& dst,
bool with_scaling =
false);
388 template<
typename Scalar>
inline void
390 Eigen::Matrix<Scalar, 3, 1> &point_out,
391 const Eigen::Transform<Scalar, 3, Eigen::Affine> &transformation)
393 Eigen::Matrix<Scalar, 4, 1> point;
394 point << point_in, 1.0;
395 point_out = (transformation * point).
template head<3> ();
405 template <
typename Scalar>
inline void
407 Eigen::Matrix<Scalar, 3, 1> &vector_out,
408 const Eigen::Transform<Scalar, 3, Eigen::Affine> &transformation)
410 vector_out = transformation.linear () * vector_in;
424 template <
typename Scalar>
bool
425 transformLine (
const Eigen::Matrix<Scalar, Eigen::Dynamic, 1> &line_in,
426 Eigen::Matrix<Scalar, Eigen::Dynamic, 1> &line_out,
427 const Eigen::Transform<Scalar, 3, Eigen::Affine> &transformation);
438 template <
typename Scalar>
void
440 Eigen::Matrix<Scalar, 4, 1> &plane_out,
441 const Eigen::Transform<Scalar, 3, Eigen::Affine> &transformation);
453 template<
typename Scalar>
void
456 const Eigen::Transform<Scalar, 3, Eigen::Affine> &transformation);
481 template<
typename Scalar>
bool
483 const Eigen::Matrix<Scalar, Eigen::Dynamic, 1> &line_y,
484 const Scalar norm_limit = 1e-3,
485 const Scalar dot_limit = 1e-3);
497 template <
typename Scalar>
inline bool
499 const Eigen::Matrix<Scalar, 3, 1> &x_direction,
500 const Eigen::Matrix<Scalar, 3, 1> &y_direction,
501 const Scalar norm_limit = 1e-3,
502 const Scalar dot_limit = 1e-3)
504 Eigen::Matrix<Scalar, Eigen::Dynamic, 1> line_x;
505 Eigen::Matrix<Scalar, Eigen::Dynamic, 1> line_y;
508 line_x << origin, x_direction;
509 line_y << origin, y_direction;
510 return (checkCoordinateSystem<Scalar> (line_x, line_y, norm_limit, dot_limit));
525 template <
typename Scalar>
bool
527 const Eigen::Matrix<Scalar, Eigen::Dynamic, 1> from_line_y,
528 const Eigen::Matrix<Scalar, Eigen::Dynamic, 1> to_line_x,
529 const Eigen::Matrix<Scalar, Eigen::Dynamic, 1> to_line_y,
530 Eigen::Transform<Scalar, 3, Eigen::Affine> &transformation);
534 #include <pcl/common/impl/eigen.hpp>
536 #if defined __SUNPRO_CC
void computeCorrespondingEigenVector(const Matrix &mat, const typename Matrix::Scalar &eigenvalue, Vector &eigenvector)
determines the corresponding eigenvector to the given eigenvalue of the symmetric positive semi defin...
void getTranslationAndEulerAngles(const Eigen::Transform< Scalar, 3, Eigen::Affine > &t, Scalar &x, Scalar &y, Scalar &z, Scalar &roll, Scalar &pitch, Scalar &yaw)
Extract x,y,z and the Euler angles (intrinsic rotations, ZYX-convention) from the given transformatio...
void getTransformationFromTwoUnitVectorsAndOrigin(const Eigen::Vector3f &y_direction, const Eigen::Vector3f &z_axis, const Eigen::Vector3f &origin, Eigen::Affine3f &transformation)
Get the transformation that will translate origin to (0,0,0) and rotate z_axis into (0,...
Matrix::Scalar determinant3x3Matrix(const Matrix &matrix)
Calculate the determinant of a 3x3 matrix.
Matrix::Scalar invert3x3SymMatrix(const Matrix &matrix, Matrix &inverse)
Calculate the inverse of a 3x3 symmetric matrix.
void loadBinary(Eigen::MatrixBase< Derived > const &matrix, std::istream &file)
Read a matrix from an input stream.
void getTransformation(Scalar x, Scalar y, Scalar z, Scalar roll, Scalar pitch, Scalar yaw, Eigen::Transform< Scalar, 3, Eigen::Affine > &t)
Create a transformation from the given translation and Euler angles (intrinsic rotations,...
void getEulerAngles(const Eigen::Transform< Scalar, 3, Eigen::Affine > &t, Scalar &roll, Scalar &pitch, Scalar &yaw)
Extract the Euler angles (intrinsic rotations, ZYX-convention) from the given transformation.
void eigen22(const Matrix &mat, typename Matrix::Scalar &eigenvalue, Vector &eigenvector)
determine the smallest eigenvalue and its corresponding eigenvector
void getTransformationFromTwoUnitVectors(const Eigen::Vector3f &y_direction, const Eigen::Vector3f &z_axis, Eigen::Affine3f &transformation)
Get the unique 3D rotation that will rotate z_axis into (0,0,1) and y_direction into a vector with x=...
void getTransFromUnitVectorsXY(const Eigen::Vector3f &x_axis, const Eigen::Vector3f &y_direction, Eigen::Affine3f &transformation)
Get the unique 3D rotation that will rotate x_axis into (1,0,0) and y_direction into a vector with z=...
Matrix::Scalar invert3x3Matrix(const Matrix &matrix, Matrix &inverse)
Calculate the inverse of a general 3x3 matrix.
void eigen33(const Matrix &mat, typename Matrix::Scalar &eigenvalue, Vector &eigenvector)
determines the eigenvector and eigenvalue of the smallest eigenvalue of the symmetric positive semi d...
void saveBinary(const Eigen::MatrixBase< Derived > &matrix, std::ostream &file)
Write a matrix to an output stream.
Matrix::Scalar invert2x2(const Matrix &matrix, Matrix &inverse)
Calculate the inverse of a 2x2 matrix.
void getTransFromUnitVectorsZY(const Eigen::Vector3f &z_axis, const Eigen::Vector3f &y_direction, Eigen::Affine3f &transformation)
Get the unique 3D rotation that will rotate z_axis into (0,0,1) and y_direction into a vector with x=...
bool checkCoordinateSystem(const Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > &line_x, const Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > &line_y, const Scalar norm_limit=1e-3, const Scalar dot_limit=1e-3)
Check coordinate system integrity.
void transformPlane(const Eigen::Matrix< Scalar, 4, 1 > &plane_in, Eigen::Matrix< Scalar, 4, 1 > &plane_out, const Eigen::Transform< Scalar, 3, Eigen::Affine > &transformation)
Transform plane vectors using an affine matrix.
void transformPoint(const Eigen::Matrix< Scalar, 3, 1 > &point_in, Eigen::Matrix< Scalar, 3, 1 > &point_out, const Eigen::Transform< Scalar, 3, Eigen::Affine > &transformation)
Transform a point using an affine matrix.
void transformVector(const Eigen::Matrix< Scalar, 3, 1 > &vector_in, Eigen::Matrix< Scalar, 3, 1 > &vector_out, const Eigen::Transform< Scalar, 3, Eigen::Affine > &transformation)
Transform a vector using an affine matrix.
Eigen::internal::umeyama_transform_matrix_type< Derived, OtherDerived >::type umeyama(const Eigen::MatrixBase< Derived > &src, const Eigen::MatrixBase< OtherDerived > &dst, bool with_scaling=false)
Returns the transformation between two point sets.
bool transformBetween2CoordinateSystems(const Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > from_line_x, const Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > from_line_y, const Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > to_line_x, const Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > to_line_y, Eigen::Transform< Scalar, 3, Eigen::Affine > &transformation)
Compute the transformation between two coordinate systems.
bool transformLine(const Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > &line_in, Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > &line_out, const Eigen::Transform< Scalar, 3, Eigen::Affine > &transformation)
Transform a line using an affine matrix.
void computeRoots2(const Scalar &b, const Scalar &c, Roots &roots)
Compute the roots of a quadratic polynom x^2 + b*x + c = 0.
void computeRoots(const Matrix &m, Roots &roots)
computes the roots of the characteristic polynomial of the input matrix m, which are the eigenvalues
shared_ptr< ::pcl::ModelCoefficients > Ptr
shared_ptr< const ::pcl::ModelCoefficients > ConstPtr