Subversion Repositories gelsvn

Rev

Rev 631 | Rev 636 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 631 Rev 633
Line 313... Line 313...
313
 
313
 
314
    /// Returns true if the halfedge is a boundary halfedge.
314
    /// Returns true if the halfedge is a boundary halfedge.
315
    bool boundary(const Manifold& m, HalfEdgeID h);
315
    bool boundary(const Manifold& m, HalfEdgeID h);
316
 
316
 
317
    /// Return the geometric length of a halfedge.
317
    /// Return the geometric length of a halfedge.
318
    float length(const Manifold& m, HalfEdgeID h);
318
    double length(const Manifold& m, HalfEdgeID h);
319
 
319
 
320
    /// Returns true if the vertex is a boundary vertex.
320
    /// Returns true if the vertex is a boundary vertex.
321
    bool boundary(const Manifold& m, VertexID v);
321
    bool boundary(const Manifold& m, VertexID v);
322
 
322
 
323
    /// Compute valency, i.e. number of incident edges.
323
    /// Compute valency, i.e. number of incident edges.
Line 336... Line 336...
336
    the normal is not defined, but computed using the first three
336
    the normal is not defined, but computed using the first three
337
    vertices of the face. */
337
    vertices of the face. */
338
    Manifold::Vec normal(const Manifold& m, FaceID f);
338
    Manifold::Vec normal(const Manifold& m, FaceID f);
339
 
339
 
340
    /// Compute the area of a face. 
340
    /// Compute the area of a face. 
341
    float area(const Manifold& m, FaceID f);
341
    double area(const Manifold& m, FaceID f);
342
 
342
 
343
    /// Compute the perimeter of a face. 
343
    /// Compute the perimeter of a face. 
344
    float perimeter(const Manifold& m, FaceID f);
344
    double perimeter(const Manifold& m, FaceID f);
345
 
345
 
346
    /// Compute the centre of a face
346
    /// Compute the centre of a face
347
    Manifold::Vec centre(const Manifold& m, FaceID f);
347
    Manifold::Vec centre(const Manifold& m, FaceID f);
348
 
348
 
349
    /*******************************************************************
349
    /*******************************************************************
Line 391... Line 391...
391
    {
391
    {
392
        IDRemap map;
392
        IDRemap map;
393
        Manifold::cleanup(map);
393
        Manifold::cleanup(map);
394
    }
394
    }
395
    
395
    
396
    inline void circulate_vertex_ccw(const Manifold& m, VertexID v, std::function<void(Walker&)> f)
396
    inline int circulate_vertex_ccw(const Manifold& m, VertexID v, std::function<void(Walker&)> f)
397
    {
397
    {
-
 
398
        Walker w = m.walker(v);
398
        for(Walker w = m.walker(v); !w.full_circle(); w = w.circulate_vertex_ccw())
399
        for(; !w.full_circle(); w = w.circulate_vertex_ccw()) f(w);
399
            f(w);
400
        return w.no_steps();
400
    }
401
    }
401
    inline void circulate_vertex_ccw(const Manifold& m, VertexID v, std::function<void(VertexID)> f)
402
    inline int circulate_vertex_ccw(const Manifold& m, VertexID v, std::function<void(VertexID)> f)
402
    {
403
    {
403
        circulate_vertex_ccw(m, v, [&](Walker& w){f(w.vertex());});
404
        return circulate_vertex_ccw(m, v, [&](Walker& w){f(w.vertex());});
404
    }
405
    }
405
    inline void circulate_vertex_ccw(const Manifold& m, VertexID v, std::function<void(FaceID)> f)
406
    inline int circulate_vertex_ccw(const Manifold& m, VertexID v, std::function<void(FaceID)> f)
406
    {
407
    {
407
        circulate_vertex_ccw(m, v, [&](Walker& w){f(w.face());});
408
        return circulate_vertex_ccw(m, v, [&](Walker& w){f(w.face());});
408
    }
409
    }
409
    inline void circulate_vertex_ccw(const Manifold& m, VertexID v, std::function<void(HalfEdgeID)> f)
410
    inline int circulate_vertex_ccw(const Manifold& m, VertexID v, std::function<void(HalfEdgeID)> f)
410
    {
411
    {
411
        circulate_vertex_ccw(m, v, [&](Walker& w){f(w.halfedge());});
412
        return circulate_vertex_ccw(m, v, [&](Walker& w){f(w.halfedge());});
412
    }
413
    }
413
    
414
    
414
    inline void circulate_vertex_cw(const Manifold& m, VertexID v, std::function<void(Walker&)> f)
415
    inline int circulate_vertex_cw(const Manifold& m, VertexID v, std::function<void(Walker&)> f)
415
    {
416
    {
-
 
417
        Walker w = m.walker(v);
416
        for(Walker w = m.walker(v); !w.full_circle(); w = w.circulate_vertex_cw())
418
        for(; !w.full_circle(); w = w.circulate_vertex_cw()) f(w);
417
            f(w);
419
        return w.no_steps();
418
    }
420
    }
419
    inline void circulate_vertex_cw(const Manifold& m, VertexID v, std::function<void(VertexID)> f)
421
    inline int circulate_vertex_cw(const Manifold& m, VertexID v, std::function<void(VertexID)> f)
420
    {
422
    {
421
        circulate_vertex_cw(m, v, [&](Walker& w){f(w.vertex());});
423
        return circulate_vertex_cw(m, v, [&](Walker& w){f(w.vertex());});
422
    }
424
    }
423
    inline void circulate_vertex_cw(const Manifold& m, VertexID v, std::function<void(FaceID)> f)
425
    inline int circulate_vertex_cw(const Manifold& m, VertexID v, std::function<void(FaceID)> f)
424
    {
426
    {
425
        circulate_vertex_cw(m, v, [&](Walker& w){f(w.face());});
427
        return circulate_vertex_cw(m, v, [&](Walker& w){f(w.face());});
426
    }
428
    }
427
    inline void circulate_vertex_cw(const Manifold& m, VertexID v, std::function<void(HalfEdgeID)> f)
429
    inline int circulate_vertex_cw(const Manifold& m, VertexID v, std::function<void(HalfEdgeID)> f)
428
    {
430
    {
429
        circulate_vertex_cw(m, v, [&](Walker& w){f(w.halfedge());});
431
        return circulate_vertex_cw(m, v, [&](Walker& w){f(w.halfedge());});
430
    }
432
    }
431
    
433
    
432
    inline void circulate_face_ccw(const Manifold& m, FaceID f, std::function<void(Walker&)> g)
434
    inline int circulate_face_ccw(const Manifold& m, FaceID f, std::function<void(Walker&)> g)
433
    {
435
    {
-
 
436
        Walker w = m.walker(f);
434
        for(Walker w = m.walker(f); !w.full_circle(); w = w.circulate_face_ccw())
437
        for(; !w.full_circle(); w = w.circulate_face_ccw()) g(w);
435
            g(w);
438
        return w.no_steps();
436
    }
439
    }
437
    inline void circulate_face_ccw(const Manifold& m, FaceID f, std::function<void(VertexID)> g)
440
    inline int circulate_face_ccw(const Manifold& m, FaceID f, std::function<void(VertexID)> g)
438
    {
441
    {
439
        circulate_face_ccw(m, f, [&](Walker& w){g(w.vertex());});
442
        return circulate_face_ccw(m, f, [&](Walker& w){g(w.vertex());});
440
    }
443
    }
441
    inline void circulate_face_ccw(const Manifold& m, FaceID f, std::function<void(FaceID)> g)
444
    inline int circulate_face_ccw(const Manifold& m, FaceID f, std::function<void(FaceID)> g)
442
    {
445
    {
443
        circulate_face_ccw(m, f, [&](Walker& w){g(w.face());});
446
        return circulate_face_ccw(m, f, [&](Walker& w){g(w.face());});
444
    }
447
    }
445
    inline void circulate_face_ccw(const Manifold& m, FaceID f, std::function<void(HalfEdgeID)> g)
448
    inline int circulate_face_ccw(const Manifold& m, FaceID f, std::function<void(HalfEdgeID)> g)
446
    {
449
    {
447
        circulate_face_ccw(m, f, [&](Walker& w){g(w.halfedge());});
450
        return circulate_face_ccw(m, f, [&](Walker& w){g(w.halfedge());});
448
    }
451
    }
449
    
452
    
450
    inline void circulate_face_cw(const Manifold& m, FaceID f, std::function<void(Walker&)> g)
453
    inline int circulate_face_cw(const Manifold& m, FaceID f, std::function<void(Walker&)> g)
451
    {
454
    {
-
 
455
        Walker w = m.walker(f);
452
        for(Walker w = m.walker(f); !w.full_circle(); w = w.circulate_face_cw())
456
        for(; !w.full_circle(); w = w.circulate_face_cw()) g(w);
453
            g(w);
457
        return w.no_steps();
454
    }
458
    }
455
    inline void circulate_face_cw(const Manifold& m, FaceID f, std::function<void(VertexID)> g)
459
    inline int circulate_face_cw(const Manifold& m, FaceID f, std::function<void(VertexID)> g)
456
    {
460
    {
457
        circulate_face_cw(m, f, [&](Walker& w){g(w.vertex());});
461
        return circulate_face_cw(m, f, [&](Walker& w){g(w.vertex());});
458
    }
462
    }
459
    inline void circulate_face_cw(const Manifold& m, FaceID f, std::function<void(FaceID)> g)
463
    inline int circulate_face_cw(const Manifold& m, FaceID f, std::function<void(FaceID)> g)
460
    {
464
    {
461
        circulate_face_cw(m, f, [&](Walker& w){g(w.face());});
465
        return circulate_face_cw(m, f, [&](Walker& w){g(w.face());});
462
    }
466
    }
463
    inline void circulate_face_cw(const Manifold& m, FaceID f, std::function<void(HalfEdgeID)> g)
467
    inline int circulate_face_cw(const Manifold& m, FaceID f, std::function<void(HalfEdgeID)> g)
464
    {
468
    {
465
        circulate_face_cw(m, f, [&](Walker& w){g(w.halfedge());});
469
        return circulate_face_cw(m, f, [&](Walker& w){g(w.halfedge());});
466
    }
470
    }
467
    
471
    
468
 
472
 
469
}
473
}