| 109 | } |
| 110 | |
| 111 | bool PointCloudTriangulator::triangulate( const VertBitSet& cloudPointsToOrient, const ProgressCallback& progressCb ) |
| 112 | { |
| 113 | MR_TIMER; |
| 114 | assert( ( params_.numNeighbours <= 0 && params_.radius > 0 ) |
| 115 | || ( params_.numNeighbours > 0 && params_.radius <= 0 ) ); |
| 116 | |
| 117 | const bool allTrustedNormals = cloudPointsToOrient.none(); |
| 118 | auto optLocalTriangulations = TriangulationHelpers::buildUnitedLocalTriangulations( pointCloud_, |
| 119 | { |
| 120 | .radius = params_.radius, |
| 121 | .numNeis = params_.numNeighbours, |
| 122 | .critAngle = params_.critAngle, |
| 123 | .boundaryAngle = params_.boundaryAngle, |
| 124 | .orientedNormals = pointCloud_.hasNormals() ? &pointCloud_.normals : nullptr, |
| 125 | .untrustedNormals = allTrustedNormals ? nullptr : &cloudPointsToOrient, |
| 126 | .automaticRadiusIncrease = params_.automaticRadiusIncrease, |
| 127 | .searchNeighbors = params_.searchNeighbors |
| 128 | }, subprogress( progressCb, 0.0f, allTrustedNormals ? 0.4f : 0.3f ) ); |
| 129 | if ( !optLocalTriangulations ) |
| 130 | return {}; |
| 131 | auto & localTriangulations = *optLocalTriangulations; |
| 132 | |
| 133 | Triangulation t3, t2; |
| 134 | if ( allTrustedNormals ) |
| 135 | findRepeatedOrientedTriangles( localTriangulations, &t3, &t2 ); |
| 136 | else |
| 137 | autoOrientLocalTriangulations( pointCloud_, localTriangulations, cloudPointsToOrient, subprogress( progressCb, 0.3f, 0.5f ), &t3, &t2 ); |
| 138 | |
| 139 | return makeMesh_( std::move( t3 ), std::move( t2 ), subprogress( progressCb, 0.5f, 1.0f ) ); |
| 140 | } |
| 141 | |
| 142 | bool PointCloudTriangulator::makeMesh_( Triangulation && t3, Triangulation && t2, const ProgressCallback& progressCb ) |
| 143 | { |
no test coverage detected