Subversion Repositories gelsvn

Rev

Rev 662 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 662 Rev 666
Line 252... Line 252...
252
        ensure_boundary_consistency(hv);
252
        ensure_boundary_consistency(hv);
253
    }
253
    }
254
	
254
	
255
    FaceID Manifold::split_face_by_edge(FaceID f, VertexID v0, VertexID v1)
255
    FaceID Manifold::split_face_by_edge(FaceID f, VertexID v0, VertexID v1)
256
    {
256
    {
257
		assert(!connected(*this, v0, v1));
257
		if(connected(*this, v0, v1))
-
 
258
            return InvalidFaceID;
-
 
259
        
258
        HalfEdgeID he = kernel.last(f);
260
        HalfEdgeID he = kernel.last(f);
259
        HalfEdgeID last = he;
261
        HalfEdgeID last = he;
260
        int steps = 0;
262
        int steps = 0;
261
        while(he != last || steps == 0){
263
        while(he != last || steps == 0){
262
            ++steps;
264
            ++steps;
Line 1250... Line 1252...
1250
                }
1252
                }
1251
                link.push_back(ring_v);
1253
                link.push_back(ring_v);
1252
                
1254
                
1253
                // test for infinite loop around vertex
1255
                // test for infinite loop around vertex
1254
                if(static_cast<size_t>(j.no_steps()) > m.no_vertices()){
1256
                if(static_cast<size_t>(j.no_steps()) > m.no_vertices()){
1255
                    cout << "Vertex loop contains more vertices than manifold" << endl;
1257
                    cout << "Vertex loop CW contains more vertices than manifold" << endl;
-
 
1258
                    return false;
-
 
1259
                }
-
 
1260
            }
-
 
1261
            
-
 
1262
            for(Walker j = m.walker(*v); !j.full_circle(); j = j.circulate_vertex_ccw()) {
-
 
1263
                if(static_cast<size_t>(j.no_steps()) > m.no_vertices()){
-
 
1264
                    cout << "Vertex loop CCW contains more vertices than manifold" << endl;
1256
                    return false;
1265
                    return false;
1257
                }
1266
                }
1258
            }
1267
            }
1259
            
1268
            
1260
            // test one_ring size for boundary consistency
1269
            // test one_ring size for boundary consistency
Line 1330... Line 1339...
1330
        VertexID v1 = hew.vertex();
1339
        VertexID v1 = hew.vertex();
1331
        
1340
        
1332
        // get the one-ring of v0
1341
        // get the one-ring of v0
1333
        vector<VertexID> link0;
1342
        vector<VertexID> link0;
1334
        vector<FaceID> faces0;
1343
        vector<FaceID> faces0;
-
 
1344
        int k = 0;
1335
        for(Walker vj = m.walker(h);
1345
        for(Walker vj = m.walker(h);
1336
            !vj.full_circle(); vj = vj.circulate_vertex_ccw()){
1346
            !vj.full_circle(); vj = vj.circulate_vertex_ccw()){
1337
            link0.push_back(vj.vertex());
1347
            link0.push_back(vj.vertex());
1338
            if(vj.halfedge() != h)
1348
            if(vj.halfedge() != h)
1339
                faces0.push_back(vj.face());
1349
                faces0.push_back(vj.face());
-
 
1350
            if(++k>m.no_vertices())
-
 
1351
            {
-
 
1352
                cout << "mesh is corrupted" << endl;
-
 
1353
                return false;
-
 
1354
            }
1340
        }
1355
        }
1341
        assert(link0.size() > 1);
1356
        assert(link0.size() > 1);
1342
        
1357
        
1343
        // get the one-ring of v1
1358
        // get the one-ring of v1
1344
        vector<VertexID> link1;
1359
        vector<VertexID> link1;
1345
        vector<FaceID> faces1;
1360
        vector<FaceID> faces1;
-
 
1361
        k=0;
1346
        for(Walker vj = m.walker(ho);
1362
        for(Walker vj = m.walker(ho);
1347
            !vj.full_circle(); vj = vj.circulate_vertex_ccw()){
1363
            !vj.full_circle(); vj = vj.circulate_vertex_ccw()){
1348
            link1.push_back(vj.vertex());
1364
            link1.push_back(vj.vertex());
1349
            if(vj.halfedge() != ho)
1365
            if(vj.halfedge() != ho)
1350
                faces1.push_back(vj.face());
1366
                faces1.push_back(vj.face());
-
 
1367
            if(++k>m.no_vertices())
-
 
1368
            {
-
 
1369
                cout << "mesh is corrupted" << endl;
-
 
1370
                return false;
-
 
1371
            }
1351
        }
1372
        }
1352
        assert(link1.size() > 1);
1373
        assert(link1.size() > 1);
1353
        
1374
        
1354
        // sort the vertices of the two rings
1375
        // sort the vertices of the two rings
1355
        sort(link0.begin(), link0.end());
1376
        sort(link0.begin(), link0.end());
Line 1373... Line 1394...
1373
                         faces1.begin(), faces1.end(),
1394
                         faces1.begin(), faces1.end(),
1374
                         fii);
1395
                         fii);
1375
        if(fisect.size() > 0)
1396
        if(fisect.size() > 0)
1376
            return false;
1397
            return false;
1377
        
1398
        
1378
        int k = 0;
1399
         k = 0;
1379
        // if the adjacent face is a triangle (see 2)
1400
        // if the adjacent face is a triangle (see 2)
1380
        if(hew.next().next().next().halfedge() == h){
1401
        if(hew.next().next().next().halfedge() == h){
1381
            VertexID v = hew.next().vertex();
1402
            VertexID v = hew.next().vertex();
1382
            
1403
            
1383
            // valency test (see 5)
1404
            // valency test (see 5)