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

Fix behaviour of BoxClipper3D #5769

Merged
merged 1 commit into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 5 additions & 4 deletions filters/include/pcl/filters/box_clipper3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ namespace pcl
/**
* \author Suat Gedikli <gedikli@willowgarage.com>
* \brief Implementation of a box clipper in 3D. Actually it allows affine transformations, thus any parallelepiped in general pose.
* The affine transformation is used to transform the point before clipping it using the unit cube centered at origin and with an extend of -1 to +1 in each dimension
* The affine transformation is used to transform the point before clipping it using a cube centered at origin and with an extend of -1 to +1 in each dimension
* \sa CropBox
* \ingroup filters
*/
template<typename PointT>
Expand All @@ -61,7 +62,7 @@ namespace pcl
/**
* \author Suat Gedikli <gedikli@willowgarage.com>
* \brief Constructor taking an affine transformation matrix, which allows also shearing of the clipping area
* \param[in] transformation the 3x3 affine transformation matrix that is used to describe the unit cube
* \param[in] transformation the 3 dimensional affine transformation that is used to describe the cube ([-1; +1] in each dimension). The transformation is applied to the point(s)!
*/
BoxClipper3D (const Eigen::Affine3f& transformation);

Expand All @@ -75,7 +76,7 @@ namespace pcl

/**
* \brief Set the affine transformation
* \param[in] transformation
* \param[in] transformation applied to the point(s)
*/
void setTransformation (const Eigen::Affine3f& transformation);

Expand Down Expand Up @@ -115,7 +116,7 @@ namespace pcl
void transformPoint (const PointT& pointIn, PointT& pointOut) const;
private:
/**
* \brief the affine transformation that is applied before clipping is done on the unit cube.
* \brief the affine transformation that is applied before clipping is done on the [-1; +1] cube.
*/
Eigen::Affine3f transformation_;

Expand Down
5 changes: 1 addition & 4 deletions filters/include/pcl/filters/impl/box_clipper3D.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ template<typename PointT>
pcl::BoxClipper3D<PointT>::BoxClipper3D (const Eigen::Affine3f& transformation)
: transformation_ (transformation)
{
//inverse_transformation_ = transformation_.inverse ();
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand All @@ -61,15 +60,13 @@ template<typename PointT> void
pcl::BoxClipper3D<PointT>::setTransformation (const Eigen::Affine3f& transformation)
{
transformation_ = transformation;
//inverse_transformation_ = transformation_.inverse ();
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
template<typename PointT> void
pcl::BoxClipper3D<PointT>::setTransformation (const Eigen::Vector3f& rodrigues, const Eigen::Vector3f& translation, const Eigen::Vector3f& box_size)
{
transformation_ = Eigen::Translation3f (translation) * Eigen::AngleAxisf(rodrigues.norm (), rodrigues.normalized ()) * Eigen::Scaling (box_size);
//inverse_transformation_ = transformation_.inverse ();
transformation_ = (Eigen::Translation3f (translation) * Eigen::AngleAxisf(rodrigues.norm (), rodrigues.normalized ()) * Eigen::Scaling (0.5f * box_size)).inverse ();
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down