Super4PCS Library  V1.1.2(719f5c0)
bbox.h
1 // Copyright 2014 Nicolas Mellado
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 //
15 // -------------------------------------------------------------------------- //
16 //
17 // Authors: Moos Hueting, Nicolas Mellado
18 //
19 // This file is part of the implementation of the Super 4-points Congruent Sets
20 // (Super 4PCS) algorithm presented in:
21 //
22 // Super 4PCS: Fast Global Pointcloud Registration via Smart Indexing
23 // Nicolas Mellado, Dror Aiger, Niloy J. Mitra
24 // Symposium on Geometry Processing 2014.
25 //
26 // Data acquisition in large-scale scenes regularly involves accumulating
27 // information across multiple scans. A common approach is to locally align scan
28 // pairs using Iterative Closest Point (ICP) algorithm (or its variants), but
29 // requires static scenes and small motion between scan pairs. This prevents
30 // accumulating data across multiple scan sessions and/or different acquisition
31 // modalities (e.g., stereo, depth scans). Alternatively, one can use a global
32 // registration algorithm allowing scans to be in arbitrary initial poses. The
33 // state-of-the-art global registration algorithm, 4PCS, however has a quadratic
34 // time complexity in the number of data points. This vastly limits its
35 // applicability to acquisition of large environments. We present Super 4PCS for
36 // global pointcloud registration that is optimal, i.e., runs in linear time (in
37 // the number of data points) and is also output sensitive in the complexity of
38 // the alignment problem based on the (unknown) overlap across scan pairs.
39 // Technically, we map the algorithm as an 'instance problem' and solve it
40 // efficiently using a smart indexing data organization. The algorithm is
41 // simple, memory-efficient, and fast. We demonstrate that Super 4PCS results in
42 // significant speedup over alternative approaches and allows unstructured
43 // efficient acquisition of scenes at scales previously not possible. Complete
44 // source code and datasets are available for research use at
45 // http://geometry.cs.ucl.ac.uk/projects/2014/super4PCS/.
46 
47 #ifndef _SUPER4PCS_ACCELERATORS_BBOX_H
48 #define _SUPER4PCS_ACCELERATORS_BBOX_H
49 
50 #include "super4pcs/utils/disablewarnings.h"
51 #include <Eigen/Geometry>
52 #include <limits>
53 
55 
56 template <typename _Scalar, int _Dim>
57 class AABB : public Eigen::AlignedBox<_Scalar, _Dim>
58 {
59 public:
60  using Base = Eigen::AlignedBox<_Scalar, _Dim>;
61  using Scalar = typename Base::Scalar;
62  static constexpr int Dim = _Dim;
63 
64  using VectorType = Eigen::Matrix<Scalar, Dim, 1>;
65 
66  using Base::extend;
67 
68  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
69 
70  AABB(Scalar min = std::numeric_limits<Scalar>::max() / 2,
71  Scalar max = -std::numeric_limits<Scalar>::max() / 2)
72  : Base(VectorType::Constant(min), VectorType::Constant(max)) {}
73 
74  template <class InputIt>
75  inline void extend(InputIt first, InputIt last)
76  { std::for_each(first, last,
77  std::bind1st(std::mem_fun(&Base::extend), this)); }
78 
79 }; // class AABB
80 
81 template <typename _Scalar>
83 
84 } // namespace Super4PCS
85 
86 #endif // BBOX_H
87 
88 
89 
90 
static constexpr int Dim
Definition: bbox.h:62
typename Base::Scalar Scalar
Definition: bbox.h:61
void extend(InputIt first, InputIt last)
Definition: bbox.h:75
Definition: bbox.h:54
Eigen::Matrix< Scalar, Dim, 1 > VectorType
Definition: bbox.h:64
Definition: bbox.h:57
EIGEN_MAKE_ALIGNED_OPERATOR_NEW AABB(Scalar min=std::numeric_limits< Scalar >::max()/2, Scalar max=-std::numeric_limits< Scalar >::max()/2)
Definition: bbox.h:70
Eigen::AlignedBox< Scalar, _Dim > Base
Definition: bbox.h:60