35 #ifndef PCL_FILTERS_IMPL_BOX_CLIPPER3D_HPP
36 #define PCL_FILTERS_IMPL_BOX_CLIPPER3D_HPP
38 #include <pcl/filters/box_clipper3D.h>
40 template<
typename Po
intT>
42 : transformation_ (transformation)
47 template<
typename Po
intT>
50 setTransformation (rodrigues, translation, box_size);
54 template<
typename Po
intT>
59 template<typename
PointT>
void
62 transformation_ = transformation;
66 template<
typename Po
intT>
void
69 transformation_ = (Eigen::Translation3f (translation) * Eigen::AngleAxisf(rodrigues.norm (), rodrigues.normalized ()) * Eigen::Scaling (0.5f * box_size)).inverse ();
80 template<
typename Po
intT>
void
83 const Eigen::Vector4f& point = pointIn.getVector4fMap ();
84 pointOut.getVector4fMap () = transformation_ * point;
92 pointOut.x += (1 - point [3]) * transformation_.data () [ 9];
93 pointOut.y += (1 - point [3]) * transformation_.data () [10];
94 pointOut.z += (1 - point [3]) * transformation_.data () [11];
98 pointOut.x += transformation_.data () [ 9];
99 pointOut.y += transformation_.data () [10];
100 pointOut.z += transformation_.data () [11];
106 template<
typename Po
intT>
bool
109 Eigen::Vector4f point_coordinates (transformation_.matrix ()
110 * point.getVector4fMap ());
111 return (point_coordinates.array ().abs () <= 1).all ();
118 template<
typename Po
intT>
bool
164 throw std::logic_error (
"Not implemented");
172 template<
typename Po
intT>
void
176 clipped_polygon.clear ();
177 throw std::logic_error (
"Not implemented");
184 template<
typename Po
intT>
void
189 throw std::logic_error (
"Not implemented");
194 template<
typename Po
intT>
void
198 if (indices.empty ())
200 clipped.reserve (cloud_in.
size ());
201 for (std::size_t pIdx = 0; pIdx < cloud_in.
size (); ++pIdx)
202 if (clipPoint3D (cloud_in[pIdx]))
203 clipped.push_back (pIdx);
207 for (
const auto &index : indices)
208 if (clipPoint3D (cloud_in[index]))
209 clipped.push_back (index);
Implementation of a box clipper in 3D. Actually it allows affine transformations, thus any parallelep...
void transformPoint(const PointT &pointIn, PointT &pointOut) const
Clipper3D< PointT > * clone() const override
polymorphic method to clone the underlying clipper with its parameters.
bool clipLineSegment3D(PointT &from, PointT &to) const override
bool clipPoint3D(const PointT &point) const override
interface to clip a single point
BoxClipper3D(const Eigen::Affine3f &transformation)
Constructor taking an affine transformation matrix, which allows also shearing of the clipping area.
void clipPlanarPolygon3D(std::vector< PointT, Eigen::aligned_allocator< PointT > > &polygon) const override
void setTransformation(const Eigen::Affine3f &transformation)
Set the affine transformation.
~BoxClipper3D() noexcept override
virtual destructor
void clipPointCloud3D(const pcl::PointCloud< PointT > &cloud_in, Indices &clipped, const Indices &indices=Indices()) const override
interface to clip a point cloud
Base class for 3D clipper objects.
PointCloud represents the base class in PCL for storing collections of 3D points.
IndicesAllocator<> Indices
Type used for indices in PCL.
A point structure representing Euclidean xyz coordinates, and the RGB color.