Point Cloud Library (PCL)
1.15.1
Toggle main menu visibility
Loading...
Searching...
No Matches
pcl
outofcore
impl
outofcore_breadth_first_iterator.hpp
1
/*
2
* Software License Agreement (BSD License)
3
*
4
* Point Cloud Library (PCL) - www.pointclouds.org
5
* Copyright (c) 2010-2012, Willow Garage, Inc.
6
*
7
* All rights reserved.
8
*
9
* Redistribution and use in source and binary forms, with or without
10
* modification, are permitted provided that the following conditions
11
* are met:
12
*
13
* * Redistributions of source code must retain the above copyright
14
* notice, this list of conditions and the following disclaimer.
15
* * Redistributions in binary form must reproduce the above
16
* copyright notice, this list of conditions and the following
17
* disclaimer in the documentation and/or other materials provided
18
* with the distribution.
19
* * Neither the name of Willow Garage, Inc. nor the names of its
20
* contributors may be used to endorse or promote products derived
21
* from this software without specific prior written permission.
22
*
23
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34
* POSSIBILITY OF SUCH DAMAGE.
35
*
36
* $Id: outofcore_depth_first_iterator.hpp 7938 2012-11-14 06:27:39Z jrosen $
37
*/
38
39
#ifndef PCL_OUTOFCORE_BREADTH_FIRST_ITERATOR_IMPL_H_
40
#define PCL_OUTOFCORE_BREADTH_FIRST_ITERATOR_IMPL_H_
41
42
namespace
pcl
43
{
44
namespace
outofcore
45
{
46
47
template
<
typename
Po
int
T,
typename
ContainerT>
48
OutofcoreBreadthFirstIterator<PointT, ContainerT>::OutofcoreBreadthFirstIterator
(
OutofcoreOctreeBase<ContainerT, PointT>
& octree_arg)
49
:
OutofcoreIteratorBase
<PointT, ContainerT> (octree_arg)
50
{
51
reset
();
52
}
53
54
////////////////////////////////////////////////////////////////////////////////
55
56
template
<
typename
Po
int
T,
typename
ContainerT>
57
OutofcoreBreadthFirstIterator<PointT, ContainerT>::~OutofcoreBreadthFirstIterator
() =
default
;
58
59
////////////////////////////////////////////////////////////////////////////////
60
61
template
<
typename
Po
int
T,
typename
ContainerT>
62
OutofcoreBreadthFirstIterator<PointT, ContainerT>
&
63
OutofcoreBreadthFirstIterator<PointT, ContainerT>::operator++
()
64
{
65
if
(!
FIFO_
.empty ())
66
{
67
// Get the first entry from the FIFO queue
68
OctreeDiskNode
*node =
FIFO_
.front ();
69
FIFO_
.pop_front ();
70
71
// If not skipping children, not at the max specified depth and we're a branch then iterate over children
72
if
(!
skip_child_voxels_
&& node->
getDepth
() < this->max_depth_ && node->
getNodeType
() ==
pcl::octree::BRANCH_NODE
)
73
{
74
// Get the branch node
75
auto
* branch =
static_cast<
BranchNode
*
>
(node);
76
OctreeDiskNode
* child =
nullptr
;
77
78
// Iterate over the branches children
79
for
(
unsigned
char
child_idx = 0; child_idx < 8 ; child_idx++)
80
{
81
// If child/index exists add it to FIFO queue
82
child = this->
octree_
.getBranchChildPtr (*branch, child_idx);
83
if
(child)
84
{
85
FIFO_
.push_back (child);
86
}
87
}
88
}
89
}
90
91
// Reset skipped children
92
skip_child_voxels_
=
false
;
93
94
// If there's a queue, set the current node to the first entry
95
if
(!
FIFO_
.empty ())
96
{
97
this->
currentNode_
=
FIFO_
.front ();
98
}
99
else
100
{
101
this->
currentNode_
=
nullptr
;
102
}
103
104
return
(*
this
);
105
}
106
107
////////////////////////////////////////////////////////////////////////////////
108
109
}
//namespace pcl
110
}
//namespace outofcore
111
112
#endif
//PCL_OUTOFCORE_BREADTH_FIRST_ITERATOR_IMPL_H_
113
pcl::outofcore::OutofcoreBreadthFirstIterator
Definition
outofcore_breadth_first_iterator.h:58
pcl::outofcore::OutofcoreBreadthFirstIterator::BranchNode
pcl::outofcore::OutofcoreOctreeBaseNode< ContainerT, PointT > BranchNode
Definition
outofcore_breadth_first_iterator.h:64
pcl::outofcore::OutofcoreBreadthFirstIterator::reset
void reset() override
Definition
outofcore_breadth_first_iterator.h:85
pcl::outofcore::OutofcoreBreadthFirstIterator::OutofcoreBreadthFirstIterator
OutofcoreBreadthFirstIterator(OctreeDisk &octree_arg)
Definition
outofcore_breadth_first_iterator.hpp:48
pcl::outofcore::OutofcoreBreadthFirstIterator::operator++
OutofcoreBreadthFirstIterator & operator++()
Definition
outofcore_breadth_first_iterator.hpp:63
pcl::outofcore::OutofcoreBreadthFirstIterator::OctreeDiskNode
pcl::outofcore::OutofcoreOctreeBaseNode< ContainerT, PointT > OctreeDiskNode
Definition
outofcore_breadth_first_iterator.h:61
pcl::outofcore::OutofcoreBreadthFirstIterator::~OutofcoreBreadthFirstIterator
~OutofcoreBreadthFirstIterator() override
pcl::outofcore::OutofcoreBreadthFirstIterator::skip_child_voxels_
bool skip_child_voxels_
Definition
outofcore_breadth_first_iterator.h:106
pcl::outofcore::OutofcoreBreadthFirstIterator::FIFO_
std::deque< OctreeDiskNode * > FIFO_
FIFO list.
Definition
outofcore_breadth_first_iterator.h:105
pcl::outofcore::OutofcoreIteratorBase::currentNode_
OctreeDiskNode * currentNode_
Definition
outofcore_iterator_base.h:133
pcl::outofcore::OutofcoreIteratorBase::octree_
OctreeDisk & octree_
Definition
outofcore_iterator_base.h:132
pcl::outofcore::OutofcoreIteratorBase::OutofcoreIteratorBase
OutofcoreIteratorBase(OctreeDisk &octree_arg)
Definition
outofcore_iterator_base.h:77
pcl::outofcore::OutofcoreOctreeBase
This code defines the octree used for point storage at Urban Robotics.
Definition
octree_base.h:151
pcl::outofcore::OutofcoreOctreeBaseNode::getDepth
virtual std::size_t getDepth() const
Definition
octree_base_node.h:279
pcl::outofcore::OutofcoreOctreeBaseNode::getNodeType
node_type_t getNodeType() const override
Pure virtual method for retrieving the type of octree node (branch or leaf).
Definition
octree_base_node.h:260
pcl::octree::BRANCH_NODE
@ BRANCH_NODE
Definition
octree_nodes.h:52
pcl::outofcore
Definition
octree_base.hpp:67
pcl
Definition
convolution.h:46