snark
partition.h
1 // This file is part of snark, a generic and flexible library
2 // for robotics research.
3 //
4 // Copyright (C) 2011 The University of Sydney
5 //
6 // snark is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 3 of the License, or (at your option) any later version.
10 //
11 // snark is distributed in the hope that it will be useful, but WITHOUT ANY
12 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
14 // for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with snark. If not, see <http://www.gnu.org/licenses/>.
18 
19 #ifndef SNARK_POINTCLOUD_PARTITION_H_
20 #define SNARK_POINTCLOUD_PARTITION_H_
21 
22 #include <boost/optional.hpp>
23 #include <Eigen/Core>
24 #include <comma/base/types.h>
25 #include <snark/math/interval.h>
26 #include <snark/point_cloud/voxel_grid.h>
27 
28 namespace snark {
29 
30 class partition
31 {
32  public:
33  typedef snark::math::closed_interval< double, 3 > extents_type;
34  partition( const extents_type& extents
35  , const Eigen::Vector3d& resolution
36  , std::size_t min_points_per_voxel = 1 );
37 
38  ~partition();
39 
40  const boost::optional< comma::uint32 >& insert( const Eigen::Vector3d& point );
41 
42  void commit( std::size_t min_voxels_per_partition = 1
43  , std::size_t min_points_per_partition = 1
44  , comma::uint32 min_id = 0 );
45 
46  private:
47  class impl_;
48  impl_* pimpl_;
49 };
50 
51 } // namespace snark {
52 
53 #endif // SNARK_POINTCLOUD_PARTITION_H_