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