deletes unnecessary part from the mesh
| 112 | |
| 113 | /// deletes unnecessary part from the mesh |
| 114 | VacantElements preparePart( Mesh& mesh, const FaceBitSet& leftPart, |
| 115 | bool needFlip, BooleanResultMapper::Maps* maps ) |
| 116 | { |
| 117 | MR_TIMER; |
| 118 | |
| 119 | auto rightPart = mesh.topology.getValidFaces() - leftPart; |
| 120 | auto res = mesh.deleteFaces( rightPart ); |
| 121 | if ( needFlip ) |
| 122 | mesh.topology.flipOrientation(); |
| 123 | |
| 124 | if ( maps ) |
| 125 | { |
| 126 | auto& fmap = maps->cut2newFaces; |
| 127 | if ( fmap.size() < mesh.topology.faceSize() ) |
| 128 | fmap.resize( mesh.topology.faceSize() ); |
| 129 | for ( auto f : mesh.topology.getValidFaces() ) |
| 130 | fmap[f] = f; |
| 131 | |
| 132 | auto& vmap = maps->old2newVerts; |
| 133 | if ( vmap.size() < mesh.topology.vertSize() ) |
| 134 | vmap.resize( mesh.topology.vertSize() ); |
| 135 | for ( auto v : mesh.topology.getValidVerts() ) |
| 136 | vmap[v] = v; |
| 137 | |
| 138 | auto& emap = maps->old2newEdges; |
| 139 | if ( emap.size() < mesh.topology.undirectedEdgeSize() ) |
| 140 | emap.resize( mesh.topology.undirectedEdgeSize() ); |
| 141 | for ( auto ue : undirectedEdges( mesh.topology ) ) |
| 142 | emap[ue] = ue; |
| 143 | } |
| 144 | return res; |
| 145 | } |
| 146 | |
| 147 | // transforms partB if needed and adds it to partA |
| 148 | // stitches parts by paths if they are not empty |
no test coverage detected