Subversion Repositories gelsvn

Rev

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

Rev 631 Rev 632
Line 41... Line 41...
41
        });
41
        });
42
        return avg_pos / n - m.pos(v);
42
        return avg_pos / n - m.pos(v);
43
    }
43
    }
44
    
44
    
45
    
45
    
46
     int CORES = 8;
46
    int CORES = 8;
47
    
47
    
48
    void laplacian_smooth0(Manifold& m,float weight, int max_iter)
48
    void laplacian_smooth0(Manifold& m,float weight, int max_iter)
49
    {
49
    {
50
        for(int iter=0;iter<max_iter; ++iter) {
50
        for(int iter=0;iter<max_iter; ++iter) {
51
            VertexAttributeVector<Vec3d> L_attr(m.no_vertices());
51
            VertexAttributeVector<Vec3d> L_attr(m.no_vertices());
Line 101... Line 101...
101
 
101
 
102
    void laplacian_smooth4(Manifold& m,float weight, int max_iter)
102
    void laplacian_smooth4(Manifold& m,float weight, int max_iter)
103
    {
103
    {
104
        auto new_pos = m.positions_attribute_vector();
104
        auto new_pos = m.positions_attribute_vector();
105
        for(int iter=0;iter<max_iter; ++iter) {
105
        for(int iter=0;iter<max_iter; ++iter) {
106
            for(auto v : m.vertices())
106
            for(VertexID v : m.vertices())
107
                if(!boundary(m, v))
107
                if(!boundary(m, v))
108
                    new_pos[v] = weight*laplacian(m, v)+m.pos(v);
108
                    new_pos[v] = weight*laplacian(m, v)+m.pos(v);
109
            swap(m.positions_attribute_vector(),new_pos);
109
            swap(m.positions_attribute_vector(),new_pos);
110
        }
110
        }
111
    }
111
    }
Line 140... Line 140...
140
    
140
    
141
    
141
    
142
    inline void laplacian_smooth_vertex(Manifold& m,vector<VertexID>& vids,
142
    inline void laplacian_smooth_vertex(Manifold& m,vector<VertexID>& vids,
143
                                        VertexAttributeVector<Vec3d>& new_pos,
143
                                        VertexAttributeVector<Vec3d>& new_pos,
144
                                        float weight){
144
                                        float weight){
145
        for(auto v: vids)
145
        for(VertexID v: vids)
146
            new_pos[v] = m.pos(v)+weight*laplacian(m, v);
146
            new_pos[v] = m.pos(v)+weight*laplacian(m, v);
147
    }
147
    }
148
    
148
    
149
    void laplacian_smooth6(Manifold& m, float weight, int max_iter)
149
    void laplacian_smooth6(Manifold& m, float weight, int max_iter)
150
    {
150
    {