41 #ifndef PCL_FILTERS_IMPL_CROP_BOX_H_
42 #define PCL_FILTERS_IMPL_CROP_BOX_H_
44 #include <pcl/filters/crop_box.h>
47 template<
typename Po
intT>
void
50 indices.resize (input_->size ());
51 removed_indices_->resize (input_->size ());
52 int indices_count = 0;
53 int removed_indices_count = 0;
55 Eigen::Affine3f transform = Eigen::Affine3f::Identity ();
56 Eigen::Affine3f inverse_transform = Eigen::Affine3f::Identity ();
58 if (rotation_ != Eigen::Vector3f::Zero ())
61 rotation_ (0), rotation_ (1), rotation_ (2),
63 inverse_transform = transform.inverse ();
66 bool transform_matrix_is_identity = transform_.matrix ().isIdentity ();
67 bool translation_is_zero = (translation_ == Eigen::Vector3f::Zero ());
68 bool inverse_transform_matrix_is_identity = inverse_transform.matrix ().isIdentity ();
70 for (
const auto index : *indices_)
72 if (!input_->is_dense)
78 PointT local_pt = (*input_)[index];
81 if (!transform_matrix_is_identity)
82 local_pt = pcl::transformPoint<PointT> (local_pt, transform_);
84 if (!translation_is_zero)
86 local_pt.x -= translation_ (0);
87 local_pt.y -= translation_ (1);
88 local_pt.z -= translation_ (2);
92 if (!inverse_transform_matrix_is_identity)
93 local_pt = pcl::transformPoint<PointT> (local_pt, inverse_transform);
96 if ( (local_pt.x < min_pt_[0] || local_pt.y < min_pt_[1] || local_pt.z < min_pt_[2]) ||
97 (local_pt.x > max_pt_[0] || local_pt.y > max_pt_[1] || local_pt.z > max_pt_[2]))
100 indices[indices_count++] = index;
101 else if (extract_removed_indices_)
102 (*removed_indices_)[removed_indices_count++] =
static_cast<int> (index);
107 if (negative_ && extract_removed_indices_)
108 (*removed_indices_)[removed_indices_count++] =
static_cast<int> (index);
110 indices[indices_count++] = index;
113 indices.resize (indices_count);
114 removed_indices_->resize (removed_indices_count);
117 #define PCL_INSTANTIATE_CropBox(T) template class PCL_EXPORTS pcl::CropBox<T>;
void applyFilter(std::vector< int > &indices) override
Sample of point indices.
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 (XYZ-convention)
bool isFinite(const PointT &pt)
Tests if the 3D components of a point are all finite param[in] pt point to be tested return true if f...
A point structure representing Euclidean xyz coordinates, and the RGB color.