| 171 | } |
| 172 | |
| 173 | bool PointCloud::pack( VertMap * outNew2Old ) |
| 174 | { |
| 175 | MR_TIMER; |
| 176 | const auto newSz = validPoints.count(); |
| 177 | if ( points.size() == newSz ) |
| 178 | { |
| 179 | assert( normals.empty() || normals.size() == newSz ); |
| 180 | assert( validPoints.size() == newSz ); |
| 181 | return false; |
| 182 | } |
| 183 | |
| 184 | if ( outNew2Old ) |
| 185 | { |
| 186 | outNew2Old->clear(); |
| 187 | outNew2Old->reserve( newSz ); |
| 188 | } |
| 189 | |
| 190 | VertCoords packedPoints; |
| 191 | packedPoints.reserve( newSz ); |
| 192 | VertNormals packedNormals; |
| 193 | if ( !normals.empty() ) |
| 194 | packedNormals.reserve( newSz ); |
| 195 | |
| 196 | for ( auto v : validPoints ) |
| 197 | { |
| 198 | packedPoints.push_back( points[v] ); |
| 199 | if ( !normals.empty() ) |
| 200 | packedNormals.push_back( normals[v] ); |
| 201 | if ( outNew2Old ) |
| 202 | outNew2Old->push_back( v ); |
| 203 | } |
| 204 | |
| 205 | assert( packedPoints.size() == newSz ); |
| 206 | assert( packedNormals.empty() || packedNormals.size() == newSz ); |
| 207 | points = std::move( packedPoints ); |
| 208 | normals = std::move( packedNormals ); |
| 209 | validPoints.clear(); |
| 210 | validPoints.resize( newSz, true ); |
| 211 | |
| 212 | invalidateCaches(); |
| 213 | return true; |
| 214 | } |
| 215 | |
| 216 | std::vector<VertId> PointCloud::getLexicographicalOrder() const |
| 217 | { |
nothing calls this directly
no test coverage detected