Point Cloud Library (PCL)
1.15.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
89
void
setCloud
(
const
PointCloud
& input_points);
90
void
build
();
91
void
radiusSearchHost
(
const
PointType
& center,
float
radius, std::vector<int>& out,
int
max_nn)
const
;
92
void
approxNearestSearchHost
(
const
PointType
& query,
int
& out_index,
float
& sqr_dist)
const
;
93
94
void
radiusSearch
(
const
Queries
& queries,
float
radius,
NeighborIndices
& results);
95
void
radiusSearch
(
const
Queries
& queries,
const
Radiuses
& radiuses,
NeighborIndices
& results);
96
97
void
radiusSearch
(
const
Queries
& queries,
const
Indices
&
indices
,
float
radius,
NeighborIndices
& results);
98
99
void
approxNearestSearch
(
const
Queries
& queries,
NeighborIndices
& results,
BatchResultSqrDists
& sqr_distance)
const
;
100
101
void
nearestKSearchBatch
(
const
Queries
& queries,
int
k,
NeighborIndices
& results,
BatchResultSqrDists
& sqr_distances)
const
;
102
103
//just reference
104
PointCloud
points
;
105
106
// data
107
DeviceArray2D<float>
points_sorted
;
108
DeviceArray<int>
codes
;
109
DeviceArray<int>
indices
;
110
111
OctreeGlobalWithBox
octreeGlobal
;
112
113
//storage
114
DeviceArray2D<int>
storage
;
115
116
struct
OctreeDataHost
117
{
118
std::vector<int>
nodes
;
119
std::vector<int>
codes
;
120
121
std::vector<int>
begs
;
122
std::vector<int>
ends
;
123
124
125
std::vector<int>
indices
;
126
127
std::vector<float>
points_sorted
;
128
int
points_sorted_step
;
129
130
int
downloaded
;
131
132
}
host_octree
;
133
134
135
void
internalDownload
();
136
private
:
137
template
<
typename
BatchType>
138
void
radiusSearchEx(BatchType& batch,
const
Queries
& queries,
NeighborIndices
& results);
139
};
140
141
void
bruteForceRadiusSearch
(
const
OctreeImpl::PointCloud
& cloud,
const
OctreeImpl::PointType
& query,
float
radius,
DeviceArray<int>
& result,
DeviceArray<int>
& buffer);
142
143
}
144
}
145
146
#endif
/* PCL_GPU_OCTREE_INTERNAL_HPP_ */
pcl::device::OctreeImpl::octreeGlobal
OctreeGlobalWithBox octreeGlobal
Definition
internal.hpp:111
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:104
pcl::device::OctreeImpl::points_sorted
DeviceArray2D< float > points_sorted
Definition
internal.hpp:107
pcl::device::OctreeImpl::Indices
DeviceArray< int > Indices
Definition
internal.hpp:81
pcl::device::OctreeImpl::codes
DeviceArray< int > codes
Definition
internal.hpp:108
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:114
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:109
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:117
pcl::device::OctreeImpl::OctreeDataHost::downloaded
int downloaded
Definition
internal.hpp:130
pcl::device::OctreeImpl::OctreeDataHost::nodes
std::vector< int > nodes
Definition
internal.hpp:118
pcl::device::OctreeImpl::OctreeDataHost::points_sorted_step
int points_sorted_step
Definition
internal.hpp:128
pcl::device::OctreeImpl::OctreeDataHost::ends
std::vector< int > ends
Definition
internal.hpp:122
pcl::device::OctreeImpl::OctreeDataHost::codes
std::vector< int > codes
Definition
internal.hpp:119
pcl::device::OctreeImpl::OctreeDataHost::begs
std::vector< int > begs
Definition
internal.hpp:121
pcl::device::OctreeImpl::OctreeDataHost::indices
std::vector< int > indices
Definition
internal.hpp:125
pcl::device::OctreeImpl::OctreeDataHost::points_sorted
std::vector< float > points_sorted
Definition
internal.hpp:127
pcl::gpu::NeighborIndices
Definition
device_format.hpp:47