Subversion Repositories gelsvn

Rev

Rev 518 | Rev 588 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
515 s042372 1
/* ----------------------------------------------------------------------- *
572 jab 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
515 s042372 5
 * ----------------------------------------------------------------------- */
6
 
7
#include "ConnectivityKernel.h"
8
 
9
namespace HMesh
10
{
11
    using namespace std;
12
 
13
    void ConnectivityKernel::cleanup(IDRemap& map)
14
    {
518 s042372 15
        VertexID::IndexType vid = 0;
16
        for(VertexID v = vertices_begin(); v != vertices_end(); v = vertices_next(v), ++vid)
17
            map.vmap[v] = VertexID(vid);
515 s042372 18
 
518 s042372 19
        FaceID::IndexType fid = 0;
20
        for(FaceID f = faces_begin(); f != faces_end(); f = faces_next(f), ++fid)
21
            map.fmap[f] = FaceID(fid);
515 s042372 22
 
518 s042372 23
        HalfEdgeID::IndexType hid = 0;
24
        for(HalfEdgeID h = halfedges_begin(); h != halfedges_end(); h = halfedges_next(h), ++hid){
25
            map.hmap[h] = HalfEdgeID(hid);
515 s042372 26
        }
27
 
28
        //2. update the connectivity kernel connectivity with the new locations
29
        for(VertexID v = vertices_begin(); v != vertices_end(); v = vertices_next(v))
30
            set_out(v, map.hmap[out(v)]);
31
 
32
        for(FaceID f = faces_begin(); f != faces_end(); f = faces_next(f))
33
            set_last(f, map.hmap[last(f)]);
34
 
35
        for(HalfEdgeID h = halfedges_begin(); h != halfedges_end(); h = halfedges_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
}