| 140 | } |
| 141 | |
| 142 | bool PointCloudTriangulator::makeMesh_( Triangulation && t3, Triangulation && t2, const ProgressCallback& progressCb ) |
| 143 | { |
| 144 | MR_TIMER; |
| 145 | |
| 146 | if ( targetMesh_.points.empty() ) |
| 147 | { |
| 148 | assert( cloud2mesh_.empty() ); |
| 149 | targetMesh_.points = pointCloud_.points; |
| 150 | } |
| 151 | else |
| 152 | { |
| 153 | // translate t2 and t3 from pointCloud into targetMesh_ |
| 154 | ParallelFor( t3, [&]( FaceId f ) |
| 155 | { |
| 156 | for ( int i = 0; i < 3; ++i ) |
| 157 | { |
| 158 | assert( cloud2mesh_[t3[f][i]] ); |
| 159 | t3[f][i] = cloud2mesh_[t3[f][i]]; |
| 160 | } |
| 161 | } ); |
| 162 | ParallelFor( t2, [&]( FaceId f ) |
| 163 | { |
| 164 | for ( int i = 0; i < 3; ++i ) |
| 165 | { |
| 166 | assert( cloud2mesh_[t2[f][i]] ); |
| 167 | t2[f][i] = cloud2mesh_[t2[f][i]]; |
| 168 | } |
| 169 | } ); |
| 170 | } |
| 171 | |
| 172 | auto compare = [] ( const auto& l, const auto& r )->bool |
| 173 | { |
| 174 | if ( l[0] < r[0] ) |
| 175 | return true; |
| 176 | if ( l[0] > r[0] ) |
| 177 | return false; |
| 178 | if ( l[1] < r[1] ) |
| 179 | return true; |
| 180 | if ( l[1] > r[1] ) |
| 181 | return false; |
| 182 | return l[2] < r[2]; |
| 183 | }; |
| 184 | tbb::parallel_sort( t3.vec_.begin(), t3.vec_.end(), compare ); |
| 185 | tbb::parallel_sort( t2.vec_.begin(), t2.vec_.end(), compare ); |
| 186 | auto t3Size = t3.size(); |
| 187 | t3.vec_.insert( t3.vec_.end(), std::make_move_iterator( t2.vec_.begin() ), std::make_move_iterator( t2.vec_.end() ) ); |
| 188 | FaceBitSet region3( t3Size ); |
| 189 | region3.flip(); |
| 190 | FaceBitSet region2( t3.size() ); |
| 191 | region2.flip(); |
| 192 | region2 -= region3; |
| 193 | |
| 194 | // create topology |
| 195 | const MeshBuilder::BuildSettings bsettings |
| 196 | { |
| 197 | .region = ®ion3, |
| 198 | .shiftFaceId = targetMesh_.topology.getValidFaces().endId(), |
| 199 | .allowNonManifoldEdge = false |
nothing calls this directly
no test coverage detected