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)
48 template<
typename Po
intT>
51 setTransformation (rodrigues, translation, box_size);
55 template<
typename Po
intT>
61 template<
typename Po
intT>
void
64 transformation_ = transformation;
69 template<
typename Po
intT>
void
72 transformation_ = Eigen::Translation3f (translation) * Eigen::AngleAxisf(rodrigues.norm (), rodrigues.normalized ()) * Eigen::Scaling (box_size);
84 template<
typename Po
intT>
void
87 const Eigen::Vector4f& point = pointIn.getVector4fMap ();
88 pointOut.getVector4fMap () = transformation_ * point;
96 pointOut.x += (1 - point [3]) * transformation_.data () [ 9];
97 pointOut.y += (1 - point [3]) * transformation_.data () [10];
98 pointOut.z += (1 - point [3]) * transformation_.data () [11];
102 pointOut.x += transformation_.data () [ 9];
103 pointOut.y += transformation_.data () [10];
104 pointOut.z += transformation_.data () [11];
111 template<
typename Po
intT>
bool
114 return (fabs(transformation_.data () [ 0] * point.x +
115 transformation_.data () [ 3] * point.y +
116 transformation_.data () [ 6] * point.z +
117 transformation_.data () [ 9]) <= 1 &&
118 fabs(transformation_.data () [ 1] * point.x +
119 transformation_.data () [ 4] * point.y +
120 transformation_.data () [ 7] * point.z +
121 transformation_.data () [10]) <= 1 &&
122 fabs(transformation_.data () [ 2] * point.x +
123 transformation_.data () [ 5] * point.y +
124 transformation_.data () [ 8] * point.z +
125 transformation_.data () [11]) <= 1 );
132 template<
typename Po
intT>
bool
185 template<
typename Po
intT>
void
189 clipped_polygon.clear ();
196 template<
typename Po
intT>
void
205 template<
typename Po
intT>
void
208 if (indices.empty ())
210 clipped.reserve (cloud_in.
size ());
211 for (
register unsigned pIdx = 0; pIdx < cloud_in.
size (); ++pIdx)
212 if (clipPoint3D (cloud_in[pIdx]))
213 clipped.push_back (pIdx);
217 for (std::vector<int>::const_iterator iIt = indices.begin (); iIt != indices.end (); ++iIt)
218 if (clipPoint3D (cloud_in[*iIt]))
219 clipped.push_back (*iIt);
222 #endif //PCL_FILTERS_IMPL_BOX_CLIPPER3D_HPP
virtual bool clipPoint3D(const PointT &point) const
interface to clip a single point
void transformPoint(const PointT &pointIn, PointT &pointOut) const
virtual void clipPlanarPolygon3D(std::vector< PointT > &polygon) const
virtual Clipper3D< PointT > * clone() const
polymorphic method to clone the underlying clipper with its parameters.
void setTransformation(const Eigen::Affine3f &transformation)
Set the affine transformation.
Implementation of a box clipper in 3D. Actually it allows affine transformations, thus any parallelep...
virtual void clipPointCloud3D(const pcl::PointCloud< PointT > &cloud_in, std::vector< int > &clipped, const std::vector< int > &indices=std::vector< int >()) const
interface to clip a point cloud
BoxClipper3D(const Eigen::Affine3f &transformation)
Constructor taking an affine transformation matrix, which allows also shearing of the clipping area...
virtual ~BoxClipper3D()
virtual destructor
Base class for 3D clipper objects.
virtual bool clipLineSegment3D(PointT &from, PointT &to) const
A point structure representing Euclidean xyz coordinates, and the RGB color.