515 |
s042372 |
1 |
|
|
|
2 |
/* ----------------------------------------------------------------------- *
|
|
|
3 |
* This file is part of GEL, www.imm.dtu.dk/GEL
|
|
|
4 |
* Copyright (C) the authors (see AUTHORS.txt) and DTU Informatics
|
|
|
5 |
*
|
|
|
6 |
* Principal authors:
|
|
|
7 |
* Christian Thode Larsen (thode2d@gmail.com)
|
|
|
8 |
* J. Andreas Baerentzen (jab@imm.dtu.dk)
|
|
|
9 |
*
|
|
|
10 |
* See LICENSE.txt for licensing information
|
|
|
11 |
* ----------------------------------------------------------------------- */
|
|
|
12 |
|
|
|
13 |
#include "ConnectivityKernel.h"
|
|
|
14 |
|
|
|
15 |
namespace HMesh
|
|
|
16 |
{
|
|
|
17 |
using namespace std;
|
|
|
18 |
|
|
|
19 |
void ConnectivityKernel::cleanup(IDRemap& map)
|
|
|
20 |
{
|
|
|
21 |
IndexType k = 0;
|
|
|
22 |
for(VertexID v = vertices_begin(); v != vertices_end(); v = vertices_next(v), ++k)
|
|
|
23 |
map.vmap[v] = VertexID(k);
|
|
|
24 |
|
|
|
25 |
k = 0;
|
|
|
26 |
for(FaceID f = faces_begin(); f != faces_end(); f = faces_next(f), ++k)
|
|
|
27 |
map.fmap[f] = FaceID(k);
|
|
|
28 |
|
|
|
29 |
k = 0;
|
|
|
30 |
for(HalfEdgeID h = halfedges_begin(); h != halfedges_end(); h = halfedges_next(h), ++k){
|
|
|
31 |
map.hmap[h] = HalfEdgeID(k);
|
|
|
32 |
}
|
|
|
33 |
|
|
|
34 |
//2. update the connectivity kernel connectivity with the new locations
|
|
|
35 |
for(VertexID v = vertices_begin(); v != vertices_end(); v = vertices_next(v))
|
|
|
36 |
set_out(v, map.hmap[out(v)]);
|
|
|
37 |
|
|
|
38 |
for(FaceID f = faces_begin(); f != faces_end(); f = faces_next(f))
|
|
|
39 |
set_last(f, map.hmap[last(f)]);
|
|
|
40 |
|
|
|
41 |
for(HalfEdgeID h = halfedges_begin(); h != halfedges_end(); h = halfedges_next(h)){
|
|
|
42 |
// do not update holes
|
|
|
43 |
if(face(h) != InvalidFaceID)
|
|
|
44 |
set_face(h, map.fmap[face(h)]);
|
|
|
45 |
set_next(h, map.hmap[next(h)]);
|
|
|
46 |
set_prev(h, map.hmap[prev(h)]);
|
|
|
47 |
set_opp(h, map.hmap[opp(h)]);
|
|
|
48 |
set_vert(h, map.vmap[vert(h)]);
|
|
|
49 |
}
|
|
|
50 |
|
|
|
51 |
vertices.cleanup();
|
|
|
52 |
faces.cleanup();
|
|
|
53 |
halfedges.cleanup();
|
|
|
54 |
}
|
|
|
55 |
}
|