688 |
khor |
1 |
/* ----------------------------------------------------------------------- *
|
|
|
2 |
* This file is part of GEL, http://www.imm.dtu.dk/GEL
|
|
|
3 |
* Copyright (C) the authors and DTU Informatics
|
|
|
4 |
* For license and list of authors, see ../../doc/intro.pdf
|
|
|
5 |
* ----------------------------------------------------------------------- */
|
|
|
6 |
|
|
|
7 |
#include "ConnectivityKernel.h"
|
|
|
8 |
|
|
|
9 |
namespace HMesh
|
|
|
10 |
{
|
|
|
11 |
using namespace std;
|
|
|
12 |
|
|
|
13 |
void ConnectivityKernel::cleanup(IDRemap& map)
|
|
|
14 |
{
|
|
|
15 |
VertexID::IndexType vid = 0;
|
|
|
16 |
for(VertexID v = vertices.index_begin(); v != vertices.index_end(); v = vertices.index_next(v), ++vid)
|
|
|
17 |
map.vmap[v] = VertexID(vid);
|
|
|
18 |
|
|
|
19 |
FaceID::IndexType fid = 0;
|
|
|
20 |
for(FaceID f = faces.index_begin(); f != faces.index_end(); f = faces.index_next(f), ++fid)
|
|
|
21 |
map.fmap[f] = FaceID(fid);
|
|
|
22 |
|
|
|
23 |
HalfEdgeID::IndexType hid = 0;
|
|
|
24 |
for(HalfEdgeID h = halfedges.index_begin(); h != halfedges.index_end(); h = halfedges.index_next(h), ++hid){
|
|
|
25 |
map.hmap[h] = HalfEdgeID(hid);
|
|
|
26 |
}
|
|
|
27 |
|
|
|
28 |
//2. update the connectivity kernel connectivity with the new locations
|
|
|
29 |
for(VertexID v = vertices.index_begin(); v != vertices.index_end(); v = vertices.index_next(v))
|
|
|
30 |
set_out(v, map.hmap[out(v)]);
|
|
|
31 |
|
|
|
32 |
for(FaceID f = faces.index_begin(); f != faces.index_end(); f = faces.index_next(f))
|
|
|
33 |
set_last(f, map.hmap[last(f)]);
|
|
|
34 |
|
|
|
35 |
for(HalfEdgeID h = halfedges.index_begin(); h != halfedges.index_end(); h = halfedges.index_next(h)){
|
|
|
36 |
// do not update holes
|
|
|
37 |
if(face(h) != InvalidFaceID)
|
|
|
38 |
set_face(h, map.fmap[face(h)]);
|
|
|
39 |
set_next(h, map.hmap[next(h)]);
|
|
|
40 |
set_prev(h, map.hmap[prev(h)]);
|
|
|
41 |
set_opp(h, map.hmap[opp(h)]);
|
|
|
42 |
set_vert(h, map.vmap[vert(h)]);
|
|
|
43 |
}
|
|
|
44 |
|
|
|
45 |
vertices.cleanup();
|
|
|
46 |
faces.cleanup();
|
|
|
47 |
halfedges.cleanup();
|
|
|
48 |
}
|
|
|
49 |
}
|