| 101 | } |
| 102 | |
| 103 | void pcl::gpu::NormalEstimation::compute(Normals& normals) |
| 104 | { |
| 105 | assert(!cloud_.empty()); |
| 106 | if (radius_ <= 0.0f || max_results_ <= 0) { |
| 107 | pcl::gpu::error("radius and/or max_results is invalid. Set them appropriately with setRadiusSearch", __FILE__, __LINE__); |
| 108 | return; |
| 109 | } |
| 110 | |
| 111 | PointCloud& surface = surface_.empty() ? cloud_ : surface_; |
| 112 | |
| 113 | octree_.setCloud(surface); |
| 114 | octree_.build(); |
| 115 | |
| 116 | if (indices_.empty() || (!indices_.empty() && indices_.size() == cloud_.size())) |
| 117 | { |
| 118 | octree_.radiusSearch(cloud_, radius_, max_results_, nn_indices_); |
| 119 | computeNormals(surface, nn_indices_, normals); |
| 120 | flipNormalTowardsViewpoint(cloud_, vpx_, vpy_, vpz_, normals); |
| 121 | } |
| 122 | else |
| 123 | { |
| 124 | octree_.radiusSearch(cloud_, indices_, radius_, max_results_, nn_indices_); |
| 125 | computeNormals(surface, nn_indices_, normals); |
| 126 | flipNormalTowardsViewpoint(cloud_, indices_, vpx_, vpy_, vpz_, normals); |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | |
| 131 | ///////////////////////////////////////////////////////////////////////// |