clipper3D.h
/*
* Software License Agreement (BSD License)
*
* Point Cloud Library (PCL) - www.pointclouds.org
* Copyright (c) 2010-2011, Willow Garage, Inc.
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of the copyright holder(s) nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef PCL_CLIPPER3D_H_
#define PCL_CLIPPER3D_H_
#include <pcl/point_cloud.h>
#include <vector>
#include <Eigen/StdVector>
namespace pcl
{
/**
* \brief Base class for 3D clipper objects
* \author Suat Gedikli <gedikli@willowgarage.com>
* \ingroup filters
*/
template<typename PointT>
class Clipper3D
{
public:
typedef boost::shared_ptr< Clipper3D<PointT> > Ptr;
typedef boost::shared_ptr< const Clipper3D<PointT> > ConstPtr;
/**
* \brief virtual destructor. Never throws an exception.
*/
virtual ~Clipper3D () throw () {}
/**
* \brief interface to clip a single point
* \param[in] point the point to check against
* \return true, it point still exists, false if its clipped
*/
virtual bool
clipPoint3D (const PointT& point) const = 0;
/**
* \brief interface to clip a line segment given by two end points. The order of the end points is unimportant and will sty the same after clipping.
* This means basically, that the direction of the line will not flip after clipping.
* \param[in,out] pt1 start point of the line
* \param[in,out] pt2 end point of the line
* \return true if the clipped line is not empty, thus the parameters are still valid, false if line completely outside clipping space
*/
virtual bool
clipLineSegment3D (PointT& pt1, PointT& pt2) const = 0;
/**
* \brief interface to clip a planar polygon given by an ordered list of points
* \param[in,out] polygon the polygon in any direction (ccw or cw) but ordered, thus two neighboring points define an edge of the polygon
*/
virtual void
clipPlanarPolygon3D (std::vector<PointT, Eigen::aligned_allocator<PointT> >& polygon) const = 0;
/**
* \brief interface to clip a planar polygon given by an ordered list of points
* \param[in] polygon the polygon in any direction (ccw or cw) but ordered, thus two neighboring points define an edge of the polygon
* \param[out] clipped_polygon the clipped polygon
*/
virtual void
clipPlanarPolygon3D (const std::vector<PointT, Eigen::aligned_allocator<PointT> >& polygon, std::vector<PointT, Eigen::aligned_allocator<PointT> >& clipped_polygon) const = 0;
/**
* \brief interface to clip a point cloud
* \param[in] cloud_in input point cloud
* \param[out] clipped indices of points that remain after clipping the input cloud
* \param[in] indices the indices of points in the point cloud to be clipped.
* \return list of indices of remaining points after clipping.
*/
virtual void
clipPointCloud3D (const pcl::PointCloud<PointT> &cloud_in, std::vector<int>& clipped, const std::vector<int>& indices = std::vector<int> ()) const = 0;
/**
* \brief polymorphic method to clone the underlying clipper with its parameters.
* \return the new clipper object from the specific subclass with all its parameters.
*/
virtual Clipper3D<PointT>*
clone () const = 0;
};
}
#endif // PCL_CLIPPER3D_H_
pcl
Definition: convolution.h:45
pcl::Clipper3D::clone
virtual Clipper3D< PointT > * clone() const =0
polymorphic method to clone the underlying clipper with its parameters.
pcl::Clipper3D::Ptr
boost::shared_ptr< Clipper3D< PointT > > Ptr
Definition: clipper3D.h:55
pcl::PointCloud
PointCloud represents the base class in PCL for storing collections of 3D points. ...
Definition: projection_matrix.h:53
pcl::Clipper3D::clipPoint3D
virtual bool clipPoint3D(const PointT &point) const =0
interface to clip a single point
pcl::Clipper3D::ConstPtr
boost::shared_ptr< const Clipper3D< PointT > > ConstPtr
Definition: clipper3D.h:56
pcl::Clipper3D::clipPointCloud3D
virtual void clipPointCloud3D(const pcl::PointCloud< PointT > &cloud_in, std::vector< int > &clipped, const std::vector< int > &indices=std::vector< int >()) const =0
interface to clip a point cloud
pcl::PointXYZRGB
A point structure representing Euclidean xyz coordinates, and the RGB color.
Definition: point_types.hpp:606
pcl::Clipper3D::clipLineSegment3D
virtual bool clipLineSegment3D(PointT &pt1, PointT &pt2) const =0
interface to clip a line segment given by two end points.
pcl::Clipper3D
Base class for 3D clipper objects.
Definition: clipper3D.h:52
pcl::Clipper3D::clipPlanarPolygon3D
virtual void clipPlanarPolygon3D(std::vector< PointT, Eigen::aligned_allocator< PointT > > &polygon) const =0
interface to clip a planar polygon given by an ordered list of points
pcl::Clipper3D::~Clipper3D
virtual ~Clipper3D()
virtual destructor.
Definition: clipper3D.h:61