Point Cloud Library (PCL)  1.11.0
internal.h
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Point Cloud Library (PCL) - www.pointclouds.org
5  * Copyright (c) 2011, 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  */
37 
38 #pragma once
39 
40 #include <cstdint>
41 #include <cuda_runtime.h>
42 
43 #include <pcl/gpu/containers/device_array.h>
44 
45 namespace pcl
46 {
47  namespace device
48  {
49  using PointType = float4;
51 
54 
56  {
57  float3 x1, x2, x3, x4;
58  int i1, i2, i3, i4;
59 
60  float4 p1, p2, p3, p4;
61  };
62 
63  struct FacetStream
64  {
65  public:
66  FacetStream(std::size_t buffer_size);
67 
68  // indeces: in each col indeces of vertexes for single facet
70 
72  std::size_t facet_count;
73 
76 
78 
79  void setInitialFacets(const InitalSimplex& simplex);
80 
81  void compactFacets();
82 
83  bool canSplit() const;
84  void splitFacets();
85  private:
86 
87  //for compation (double buffering)
88  DeviceArray2D<int> verts_inds2;
89  DeviceArray<float4> facet_planes2;
90  DeviceArray<int> head_points2;
91  };
92 
93  struct PointStream
94  {
95  public:
96  PointStream(const Cloud& cloud);
97 
98  const Cloud cloud;
101 
102  std::size_t cloud_size;
103 
105  float cloud_diag;
106 
107  void computeInitalSimplex();
108 
109  void initalClassify();
110 
111 
112  int searchFacetHeads(std::size_t facet_count, DeviceArray<int>& head_points);
113 
114  void classify(FacetStream& fs);
115  };
116 
117 
118  std::size_t remove_duplicates(DeviceArray<int>& indeces);
119  void pack_hull(const DeviceArray<PointType>& points, const DeviceArray<int>& indeces, DeviceArray<PointType>& output);
120  }
121 }
pcl::device::PointStream::computeInitalSimplex
void computeInitalSimplex()
pcl::device::remove_duplicates
std::size_t remove_duplicates(DeviceArray< int > &indeces)
pcl::device::InitalSimplex::i1
int i1
Definition: internal.h:58
pcl
Definition: convolution.h:46
pcl::device::FacetStream::facet_count
std::size_t facet_count
Definition: internal.h:72
pcl::device::InitalSimplex::i4
int i4
Definition: internal.h:58
pcl::device::FacetStream::splitFacets
void splitFacets()
pcl::device::InitalSimplex::i2
int i2
Definition: internal.h:58
pcl::device::PointStream::PointStream
PointStream(const Cloud &cloud)
pcl::device::PointStream::perm
Perm perm
Definition: internal.h:100
pcl::device::PointStream::classify
void classify(FacetStream &fs)
pcl::device::PointStream::cloud_diag
float cloud_diag
Definition: internal.h:105
pcl::device::FacetStream
Definition: internal.h:63
pcl::gpu::DeviceArray2D
DeviceArray2D class
Definition: device_array.h:153
pcl::device::InitalSimplex::x2
float3 x2
Definition: internal.h:57
pcl::device::FacetStream::verts_inds
DeviceArray2D< int > verts_inds
Definition: internal.h:69
pcl::device::InitalSimplex::p3
float4 p3
Definition: internal.h:60
pcl::device::PointStream::cloud
const Cloud cloud
Definition: internal.h:98
pcl::device::FacetStream::empty_facets
DeviceArray2D< int > empty_facets
Definition: internal.h:74
pcl::device::Cloud
DeviceArray2D< float4 > Cloud
Definition: internal.h:52
pcl::device::PointType
float4 PointType
Definition: internal.hpp:58
pcl::device::FacetStream::head_points
DeviceArray< int > head_points
Definition: internal.h:71
pcl::device::InitalSimplex
Definition: internal.h:55
pcl::device::FacetStream::setInitialFacets
void setInitialFacets(const InitalSimplex &simplex)
pcl::device::InitalSimplex::x1
float3 x1
Definition: internal.h:57
pcl::gpu::DeviceArray< PointType >
pcl::device::InitalSimplex::i3
int i3
Definition: internal.h:58
pcl::device::InitalSimplex::p4
float4 p4
Definition: internal.h:60
pcl::device::InitalSimplex::x3
float3 x3
Definition: internal.h:57
pcl::device::FacetStream::scan_buffer
DeviceArray< int > scan_buffer
Definition: internal.h:77
pcl::device::InitalSimplex::p2
float4 p2
Definition: internal.h:60
pcl::device::FacetStream::compactFacets
void compactFacets()
pcl::device::PointStream
Definition: internal.h:93
pcl::device::PointStream::searchFacetHeads
int searchFacetHeads(std::size_t facet_count, DeviceArray< int > &head_points)
pcl::device::pack_hull
void pack_hull(const DeviceArray< PointType > &points, const DeviceArray< int > &indeces, DeviceArray< PointType > &output)
pcl::device::InitalSimplex::x4
float3 x4
Definition: internal.h:57
pcl::device::PointStream::simplex
InitalSimplex simplex
Definition: internal.h:104
pcl::device::PointStream::facets_dists
FacetsDists facets_dists
Definition: internal.h:99
pcl::device::PointStream::cloud_size
std::size_t cloud_size
Definition: internal.h:102
pcl::device::FacetStream::empty_count
DeviceArray< int > empty_count
Definition: internal.h:75
pcl::device::FacetStream::canSplit
bool canSplit() const
pcl::device::FacetStream::FacetStream
FacetStream(std::size_t buffer_size)
pcl::device::PointStream::initalClassify
void initalClassify()
pcl::device::FacetsDists
DeviceArray< std::uint64_t > FacetsDists
Definition: internal.h:52
pcl::device::InitalSimplex::p1
float4 p1
Definition: internal.h:60