Point Cloud Library (PCL)  1.14.0-dev
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:
97 
98  const Cloud cloud;
101 
102  std::size_t cloud_size;
103 
105  float cloud_diag;
106 
108 
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 }
DeviceArray2D class
Definition: device_array.h:188
float4 PointType
Definition: internal.hpp:58
void pack_hull(const DeviceArray< PointType > &points, const DeviceArray< int > &indeces, DeviceArray< PointType > &output)
DeviceArray2D< float4 > Cloud
Definition: internal.h:52
DeviceArray< std::uint64_t > FacetsDists
Definition: internal.h:52
std::size_t remove_duplicates(DeviceArray< int > &indeces)
DeviceArray< int > head_points
Definition: internal.h:71
DeviceArray< int > scan_buffer
Definition: internal.h:77
DeviceArray2D< int > verts_inds
Definition: internal.h:69
DeviceArray< int > empty_count
Definition: internal.h:75
void setInitialFacets(const InitalSimplex &simplex)
DeviceArray2D< int > empty_facets
Definition: internal.h:74
std::size_t facet_count
Definition: internal.h:72
FacetStream(std::size_t buffer_size)
PointStream(const Cloud &cloud)
int searchFacetHeads(std::size_t facet_count, DeviceArray< int > &head_points)
FacetsDists facets_dists
Definition: internal.h:99
void classify(FacetStream &fs)
InitalSimplex simplex
Definition: internal.h:104
std::size_t cloud_size
Definition: internal.h:102