40 #ifndef PCL_FILTERS_IMPL_CROP_BOX_H_
41 #define PCL_FILTERS_IMPL_CROP_BOX_H_
47 template<
typename Po
intT>
51 output.
resize (input_->points.size ());
57 Eigen::Affine3f transform = Eigen::Affine3f::Identity();
58 Eigen::Affine3f inverse_transform = Eigen::Affine3f::Identity();
60 if (rotation_ != Eigen::Vector3f::Zero ())
63 rotation_ (0), rotation_ (1), rotation_ (2),
65 inverse_transform = transform.inverse ();
68 for (
size_t index = 0; index < indices_->size (); ++index)
70 if (!input_->is_dense)
72 if (!
isFinite (input_->points[index]))
76 PointT local_pt = input_->points[(*indices_)[index]];
79 if (!(transform_.matrix ().isIdentity ()))
80 local_pt = pcl::transformPoint<PointT> (local_pt, transform_);
82 if (translation_ != Eigen::Vector3f::Zero ())
84 local_pt.x -= translation_ (0);
85 local_pt.y -= translation_ (1);
86 local_pt.z -= translation_ (2);
90 if (!(inverse_transform.matrix ().isIdentity ()))
91 local_pt = pcl::transformPoint<PointT> (local_pt, inverse_transform);
93 if (local_pt.x < min_pt_[0] || local_pt.y < min_pt_[1] || local_pt.z < min_pt_[2])
95 if (local_pt.x > max_pt_[0] || local_pt.y > max_pt_[1] || local_pt.z > max_pt_[2])
98 output.
points[indice_count++] = input_->points[(*indices_)[index]];
100 output.
width = indice_count;
106 template<
typename Po
intT>
void
109 indices.resize (input_->points.size ());
110 int indice_count = 0;
112 Eigen::Affine3f transform = Eigen::Affine3f::Identity ();
113 Eigen::Affine3f inverse_transform = Eigen::Affine3f::Identity ();
115 if (rotation_ != Eigen::Vector3f::Zero ())
118 rotation_ (0), rotation_ (1), rotation_ (2),
120 inverse_transform = transform.inverse ();
123 for (
size_t index = 0; index < indices_->size (); ++index)
125 if (!input_->is_dense)
127 if (!
isFinite (input_->points[index]))
131 PointT local_pt = input_->points[(*indices_)[index]];
134 if (!(transform_.matrix ().isIdentity ()))
135 local_pt = pcl::transformPoint<PointT> (local_pt, transform_);
137 if (translation_ != Eigen::Vector3f::Zero ())
139 local_pt.x -= translation_ (0);
140 local_pt.y -= translation_ (1);
141 local_pt.z -= translation_ (2);
145 if (!(inverse_transform.matrix ().isIdentity ()))
146 local_pt = pcl::transformPoint<PointT> (local_pt, inverse_transform);
148 if (local_pt.x < min_pt_[0] || local_pt.y < min_pt_[1] || local_pt.z < min_pt_[2])
150 if (local_pt.x > max_pt_[0] || local_pt.y > max_pt_[1] || local_pt.z > max_pt_[2])
153 indices[indice_count++] = (*indices_)[index];
155 indices.resize (indice_count);
158 #define PCL_INSTANTIATE_CropBox(T) template class PCL_EXPORTS pcl::CropBox<T>;
160 #endif // PCL_FILTERS_IMPL_CROP_BOX_H_