Subversion Repositories gelsvn

Rev

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

Rev 572 Rev 586
Line 326... Line 326...
326
    return avg_pos / asum - m.pos(v);
326
    return avg_pos / asum - m.pos(v);
327
}
327
}
328
 
328
 
329
void aw_laplacian_smooth(Manifold& m, float t)
329
void aw_laplacian_smooth(Manifold& m, float t)
330
{
330
{
331
    VertexAttributeVector<Vec3f> pos(m.total_vertices());
331
    VertexAttributeVector<Vec3f> pos(m.allocated_vertices());
332
    
332
    
333
    for(VertexIDIterator v = m.vertices_begin(); v != m.vertices_end(); ++v){
333
    for(VertexIDIterator v = m.vertices_begin(); v != m.vertices_end(); ++v){
334
        if(!boundary(m, *v))
334
        if(!boundary(m, *v))
335
        {
335
        {
336
            Vec3f n = normal(m, *v);
336
            Vec3f n = normal(m, *v);
Line 350... Line 350...
350
void polarize_mesh(Manifold& m, VertexAttributeVector<double>& fun, double vmin, double vmax, const int divisions, VertexAttributeVector<double>& parametrization)
350
void polarize_mesh(Manifold& m, VertexAttributeVector<double>& fun, double vmin, double vmax, const int divisions, VertexAttributeVector<double>& parametrization)
351
{
351
{
352
    vmax -= 0.01 * (vmax-vmin);
352
    vmax -= 0.01 * (vmax-vmin);
353
    float interval = (vmax-vmin)/divisions;
353
    float interval = (vmax-vmin)/divisions;
354
    
354
    
355
    VertexAttributeVector<int> status(m.total_vertices(), 0);
355
    VertexAttributeVector<int> status(m.allocated_vertices(), 0);
356
    
356
    
357
    
357
    
358
    // ----------------------------------------
358
    // ----------------------------------------
359
    cout << "Tracing level set curves" << endl;
359
    cout << "Tracing level set curves" << endl;
360
    
360
    
Line 425... Line 425...
425
    
425
    
426
    float max_length = 0;
426
    float max_length = 0;
427
    double max_length_fun = 0;
427
    double max_length_fun = 0;
428
    int max_length_id =-1;
428
    int max_length_id =-1;
429
    HalfEdgeID max_length_h;
429
    HalfEdgeID max_length_h;
430
    HalfEdgeAttributeVector<int> level_set_id(m.total_halfedges(), 0);
430
    HalfEdgeAttributeVector<int> level_set_id(m.allocated_halfedges(), 0);
431
    VertexAttributeVector<int> level_set_id_vertex(m.total_vertices(), 0);
431
    VertexAttributeVector<int> level_set_id_vertex(m.allocated_vertices(), 0);
432
    int no_id=1;
432
    int no_id=1;
433
    for(HalfEdgeIDIterator hid = m.halfedges_begin(); hid != m.halfedges_end(); ++hid)
433
    for(HalfEdgeIDIterator hid = m.halfedges_begin(); hid != m.halfedges_end(); ++hid)
434
    {
434
    {
435
        HalfEdgeWalker w = m.halfedgewalker(*hid);
435
        HalfEdgeWalker w = m.halfedgewalker(*hid);
436
        if(status[w.vertex()] == 1 && status[w.opp().vertex()] == 1 &&
436
        if(status[w.vertex()] == 1 && status[w.opp().vertex()] == 1 &&
Line 467... Line 467...
467
    
467
    
468
    // -------------
468
    // -------------
469
    cout << "Parametrize level sets " << endl;
469
    cout << "Parametrize level sets " << endl;
470
    
470
    
471
    queue<HalfEdgeID> hq;
471
    queue<HalfEdgeID> hq;
472
    HalfEdgeAttributeVector<int> touched(m.active_halfedges(), 0);
472
    HalfEdgeAttributeVector<int> touched(m.no_halfedges(), 0);
473
    HalfEdgeWalker w = m.halfedgewalker(max_length_h);
473
    HalfEdgeWalker w = m.halfedgewalker(max_length_h);
474
    float param = 0;
474
    float param = 0;
475
    do
475
    do
476
    {
476
    {
477
        parametrization[w.opp().vertex()] = 2.0 * M_PI * param / max_length;
477
        parametrization[w.opp().vertex()] = 2.0 * M_PI * param / max_length;
Line 553... Line 553...
553
        TriangleQualityValence tqv_energy(level_set_id_vertex);
553
        TriangleQualityValence tqv_energy(level_set_id_vertex);
554
        TriangleQuality tq_energy(level_set_id_vertex);
554
        TriangleQuality tq_energy(level_set_id_vertex);
555
        priority_queue_optimization(m, tqv_energy);
555
        priority_queue_optimization(m, tqv_energy);
556
        priority_queue_optimization(m, tq_energy);
556
        priority_queue_optimization(m, tq_energy);
557
        
557
        
558
        VertexAttributeVector<Vec3f> new_pos(m.total_vertices(), Vec3f(0));
558
        VertexAttributeVector<Vec3f> new_pos(m.allocated_vertices(), Vec3f(0));
559
        VertexAttributeVector<float> new_pos_wsum(m.total_vertices(), 0.0);
559
        VertexAttributeVector<float> new_pos_wsum(m.allocated_vertices(), 0.0);
560
        for(HalfEdgeIDIterator hid = m.halfedges_begin(); hid != m.halfedges_end(); ++hid)
560
        for(HalfEdgeIDIterator hid = m.halfedges_begin(); hid != m.halfedges_end(); ++hid)
561
        {
561
        {
562
            HalfEdgeWalker w = m.halfedgewalker(*hid);
562
            HalfEdgeWalker w = m.halfedgewalker(*hid);
563
            if(level_set_id[w.halfedge()] != 0)
563
            if(level_set_id[w.halfedge()] != 0)
564
            {
564
            {
Line 797... Line 797...
797
//// ----------------------------
797
//// ----------------------------
798
//cout << "smooth level set curves" << endl;
798
//cout << "smooth level set curves" << endl;
799
//
799
//
800
//for(int iter=0;iter<2;++iter)
800
//for(int iter=0;iter<2;++iter)
801
//{
801
//{
802
//    VertexAttributeVector<Vec3f> new_pos(m.total_vertices(), Vec3f(0));
802
//    VertexAttributeVector<Vec3f> new_pos(m.allocated_vertices(), Vec3f(0));
803
//    for(HalfEdgeIDIterator hid = m.halfedges_begin(); hid != m.halfedges_end(); ++hid)
803
//    for(HalfEdgeIDIterator hid = m.halfedges_begin(); hid != m.halfedges_end(); ++hid)
804
//    {
804
//    {
805
//        HalfEdgeWalker w = m.halfedgewalker(*hid);
805
//        HalfEdgeWalker w = m.halfedgewalker(*hid);
806
//        if(status[w.vertex()] == 1 && status[w.opp().vertex()] == 1 &&
806
//        if(status[w.vertex()] == 1 && status[w.opp().vertex()] == 1 &&
807
//           same_level(fun[w.vertex()], fun[w.opp().vertex()]))
807
//           same_level(fun[w.vertex()], fun[w.opp().vertex()]))
Line 882... Line 882...
882
//            cout << "k=" << k << endl;
882
//            cout << "k=" << k << endl;
883
//    priority_queue_optimization(m, energy);
883
//    priority_queue_optimization(m, energy);
884
 
884
 
885
 
885
 
886
//priority_queue<EdgeQElem> edge_queue;
886
//priority_queue<EdgeQElem> edge_queue;
887
//HalfEdgeAttributeVector<int> time_stamp(m.total_halfedges(), 0);
887
//HalfEdgeAttributeVector<int> time_stamp(m.allocated_halfedges(), 0);
888
//for(HalfEdgeIDIterator hid = m.halfedges_begin(); hid != m.halfedges_end(); ++hid)
888
//for(HalfEdgeIDIterator hid = m.halfedges_begin(); hid != m.halfedges_end(); ++hid)
889
//if(level_set_id[*hid]==0)
889
//if(level_set_id[*hid]==0)
890
//{
890
//{
891
//    HalfEdgeWalker w = m.halfedgewalker(*hid);
891
//    HalfEdgeWalker w = m.halfedgewalker(*hid);
892
//    if(w.halfedge()<w.opp().halfedge() && !(status[w.vertex()]==1 && status[w.opp().vertex()]==1))
892
//    if(w.halfedge()<w.opp().halfedge() && !(status[w.vertex()]==1 && status[w.opp().vertex()]==1))