Point Cloud Library (PCL)
1.12.1
Toggle main menu visibility
Loading...
Searching...
No Matches
octree
src
internal.hpp
1
/*
2
* Software License Agreement (BSD License)
3
*
4
* Copyright (c) 2011, Willow Garage, Inc.
5
* All rights reserved.
6
*
7
* Redistribution and use in source and binary forms, with or without
8
* modification, are permitted provided that the following conditions
9
* are met:
10
*
11
* * Redistributions of source code must retain the above copyright
12
* notice, this list of conditions and the following disclaimer.
13
* * Redistributions in binary form must reproduce the above
14
* copyright notice, this list of conditions and the following
15
* disclaimer in the documentation and/or other materials provided
16
* with the distribution.
17
* * Neither the name of Willow Garage, Inc. nor the names of its
18
* contributors may be used to endorse or promote products derived
19
* from this software without specific prior written permission.
20
*
21
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32
* POSSIBILITY OF SUCH DAMAGE.
33
*
34
* Author: Anatoly Baskeheev, Itseez Ltd, (myname.mysurname@mycompany.com)
35
*/
36
37
#ifndef PCL_GPU_OCTREE_INTERNAL_HPP_
38
#define PCL_GPU_OCTREE_INTERNAL_HPP_
39
40
#include <pcl/gpu/containers/device_array.h>
41
#include <pcl/gpu/octree/device_format.hpp>
42
#include <pcl/gpu/utils/safe_call.hpp>
43
44
namespace
pcl
45
{
46
namespace
device
47
{
48
struct
OctreeGlobal
49
{
50
int
*
nodes
;
51
int
*
codes
;
52
int
*
begs
;
53
int
*
ends
;
54
55
int
*
nodes_num
;
56
57
int
*
parent
;
58
59
OctreeGlobal
() :
nodes
(nullptr),
codes
(nullptr),
begs
(nullptr),
ends
(nullptr),
nodes_num
(nullptr),
parent
(nullptr) {}
60
};
61
62
struct
OctreeGlobalWithBox
:
public
OctreeGlobal
63
{
64
float3
minp
,
maxp
;
65
};
66
67
68
class
OctreeImpl
69
{
70
public
:
71
using
PointType
= float4;
72
using
PointArray
=
DeviceArray<PointType>
;
73
74
using
PointCloud
=
PointArray
;
75
using
Queries
=
PointArray
;
76
77
using
Radiuses
=
DeviceArray<float>
;
78
using
BatchResult
=
DeviceArray<int>
;
79
using
BatchResultSizes
=
DeviceArray<int>
;
80
using
BatchResultSqrDists
=
DeviceArray<float>
;
81
using
Indices
=
DeviceArray<int>
;
82
83
using
NeighborIndices
=
pcl::gpu::NeighborIndices
;
84
85
static
void
get_gpu_arch_compiled_for
(
int
& bin,
int
& ptr);
86
87
OctreeImpl
() {};
88
~OctreeImpl
() {};
89
90
void
setCloud
(
const
PointCloud
& input_points);
91
void
build
();
92
void
radiusSearchHost
(
const
PointType
& center,
float
radius, std::vector<int>& out,
int
max_nn)
const
;
93
void
approxNearestSearchHost
(
const
PointType
& query,
int
& out_index,
float
& sqr_dist)
const
;
94
95
void
radiusSearch
(
const
Queries
& queries,
float
radius,
NeighborIndices
& results);
96
void
radiusSearch
(
const
Queries
& queries,
const
Radiuses
& radiuses,
NeighborIndices
& results);
97
98
void
radiusSearch
(
const
Queries
& queries,
const
Indices
&
indices
,
float
radius,
NeighborIndices
& results);
99
100
void
approxNearestSearch
(
const
Queries
& queries,
NeighborIndices
& results,
BatchResultSqrDists
& sqr_distance)
const
;
101
102
void
nearestKSearchBatch
(
const
Queries
& queries,
int
k,
NeighborIndices
& results,
BatchResultSqrDists
& sqr_distances)
const
;
103
104
//just reference
105
PointCloud
points
;
106
107
// data
108
DeviceArray2D<float>
points_sorted
;
109
DeviceArray<int>
codes
;
110
DeviceArray<int>
indices
;
111
112
OctreeGlobalWithBox
octreeGlobal
;
113
114
//storage
115
DeviceArray2D<int>
storage
;
116
117
struct
OctreeDataHost
118
{
119
std::vector<int>
nodes
;
120
std::vector<int>
codes
;
121
122
std::vector<int>
begs
;
123
std::vector<int>
ends
;
124
125
126
std::vector<int>
indices
;
127
128
std::vector<float>
points_sorted
;
129
int
points_sorted_step
;
130
131
int
downloaded
;
132
133
}
host_octree
;
134
135
136
void
internalDownload
();
137
private
:
138
template
<
typename
BatchType>
139
void
radiusSearchEx(BatchType& batch,
const
Queries
& queries,
NeighborIndices
& results);
140
};
141
142
void
bruteForceRadiusSearch
(
const
OctreeImpl::PointCloud
& cloud,
const
OctreeImpl::PointType
& query,
float
radius,
DeviceArray<int>
& result,
DeviceArray<int>
& buffer);
143
144
}
145
}
146
147
#endif
/* PCL_GPU_OCTREE_INTERNAL_HPP_ */
pcl::device::OctreeImpl::octreeGlobal
OctreeGlobalWithBox octreeGlobal
Definition
internal.hpp:112
pcl::device::OctreeImpl::BatchResultSizes
DeviceArray< int > BatchResultSizes
Definition
internal.hpp:79
pcl::device::OctreeImpl::Queries
PointArray Queries
Definition
internal.hpp:75
pcl::device::OctreeImpl::host_octree
struct pcl::device::OctreeImpl::OctreeDataHost host_octree
pcl::device::OctreeImpl::BatchResultSqrDists
DeviceArray< float > BatchResultSqrDists
Definition
internal.hpp:80
pcl::device::OctreeImpl::radiusSearch
void radiusSearch(const Queries &queries, float radius, NeighborIndices &results)
pcl::device::OctreeImpl::points
PointCloud points
Definition
internal.hpp:105
pcl::device::OctreeImpl::points_sorted
DeviceArray2D< float > points_sorted
Definition
internal.hpp:108
pcl::device::OctreeImpl::~OctreeImpl
~OctreeImpl()
Definition
internal.hpp:88
pcl::device::OctreeImpl::Indices
DeviceArray< int > Indices
Definition
internal.hpp:81
pcl::device::OctreeImpl::codes
DeviceArray< int > codes
Definition
internal.hpp:109
pcl::device::OctreeImpl::get_gpu_arch_compiled_for
static void get_gpu_arch_compiled_for(int &bin, int &ptr)
pcl::device::OctreeImpl::Radiuses
DeviceArray< float > Radiuses
Definition
internal.hpp:77
pcl::device::OctreeImpl::BatchResult
DeviceArray< int > BatchResult
Definition
internal.hpp:78
pcl::device::OctreeImpl::build
void build()
pcl::device::OctreeImpl::nearestKSearchBatch
void nearestKSearchBatch(const Queries &queries, int k, NeighborIndices &results, BatchResultSqrDists &sqr_distances) const
pcl::device::OctreeImpl::OctreeImpl
OctreeImpl()
Definition
internal.hpp:87
pcl::device::OctreeImpl::radiusSearchHost
void radiusSearchHost(const PointType ¢er, float radius, std::vector< int > &out, int max_nn) const
pcl::device::OctreeImpl::storage
DeviceArray2D< int > storage
Definition
internal.hpp:115
pcl::device::OctreeImpl::internalDownload
void internalDownload()
pcl::device::OctreeImpl::PointCloud
PointArray PointCloud
Definition
internal.hpp:74
pcl::device::OctreeImpl::setCloud
void setCloud(const PointCloud &input_points)
pcl::device::OctreeImpl::PointType
float4 PointType
Definition
internal.hpp:71
pcl::device::OctreeImpl::indices
DeviceArray< int > indices
Definition
internal.hpp:110
pcl::device::OctreeImpl::approxNearestSearchHost
void approxNearestSearchHost(const PointType &query, int &out_index, float &sqr_dist) const
pcl::device::OctreeImpl::radiusSearch
void radiusSearch(const Queries &queries, const Radiuses &radiuses, NeighborIndices &results)
pcl::device::OctreeImpl::PointArray
DeviceArray< PointType > PointArray
Definition
internal.hpp:72
pcl::device::OctreeImpl::radiusSearch
void radiusSearch(const Queries &queries, const Indices &indices, float radius, NeighborIndices &results)
pcl::device::OctreeImpl::NeighborIndices
pcl::gpu::NeighborIndices NeighborIndices
Definition
internal.hpp:83
pcl::device::OctreeImpl::approxNearestSearch
void approxNearestSearch(const Queries &queries, NeighborIndices &results, BatchResultSqrDists &sqr_distance) const
pcl::gpu::DeviceArray2D
DeviceArray2D class
Definition
device_array.h:188
pcl::gpu::DeviceArray
DeviceArray class
Definition
device_array.h:54
pcl::device
Definition
device_array.h:315
pcl::device::bruteForceRadiusSearch
void bruteForceRadiusSearch(const OctreeImpl::PointCloud &cloud, const OctreeImpl::PointType &query, float radius, DeviceArray< int > &result, DeviceArray< int > &buffer)
pcl
Definition
convolution.h:46
pcl::device::OctreeGlobal::ends
int * ends
Definition
internal.hpp:53
pcl::device::OctreeGlobal::begs
int * begs
Definition
internal.hpp:52
pcl::device::OctreeGlobal::nodes_num
int * nodes_num
Definition
internal.hpp:55
pcl::device::OctreeGlobal::codes
int * codes
Definition
internal.hpp:51
pcl::device::OctreeGlobal::parent
int * parent
Definition
internal.hpp:57
pcl::device::OctreeGlobal::nodes
int * nodes
Definition
internal.hpp:50
pcl::device::OctreeGlobal::OctreeGlobal
OctreeGlobal()
Definition
internal.hpp:59
pcl::device::OctreeGlobalWithBox
Definition
internal.hpp:63
pcl::device::OctreeGlobalWithBox::minp
float3 minp
Definition
internal.hpp:64
pcl::device::OctreeGlobalWithBox::maxp
float3 maxp
Definition
internal.hpp:64
pcl::device::OctreeImpl::OctreeDataHost
Definition
internal.hpp:118
pcl::device::OctreeImpl::OctreeDataHost::downloaded
int downloaded
Definition
internal.hpp:131
pcl::device::OctreeImpl::OctreeDataHost::nodes
std::vector< int > nodes
Definition
internal.hpp:119
pcl::device::OctreeImpl::OctreeDataHost::points_sorted_step
int points_sorted_step
Definition
internal.hpp:129
pcl::device::OctreeImpl::OctreeDataHost::ends
std::vector< int > ends
Definition
internal.hpp:123
pcl::device::OctreeImpl::OctreeDataHost::codes
std::vector< int > codes
Definition
internal.hpp:120
pcl::device::OctreeImpl::OctreeDataHost::begs
std::vector< int > begs
Definition
internal.hpp:122
pcl::device::OctreeImpl::OctreeDataHost::indices
std::vector< int > indices
Definition
internal.hpp:126
pcl::device::OctreeImpl::OctreeDataHost::points_sorted
std::vector< float > points_sorted
Definition
internal.hpp:128
pcl::gpu::NeighborIndices
Definition
device_format.hpp:47