Subversion Repositories gelsvn

Rev

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

Rev 585 Rev 586
Line 42... Line 42...
42
 
42
 
43
        template<class T> 
43
        template<class T> 
44
        void smooth_something_on_mesh(const Manifold& m, VertexAttributeVector<T>& vec, int smooth_steps)
44
        void smooth_something_on_mesh(const Manifold& m, VertexAttributeVector<T>& vec, int smooth_steps)
45
        {
45
        {
46
            for(int iter=0;iter<smooth_steps;++iter){
46
            for(int iter=0;iter<smooth_steps;++iter){
47
                VertexAttributeVector<T> new_vec(m.total_vertices());
47
                VertexAttributeVector<T> new_vec(m.allocated_vertices());
48
                for(VertexIDIterator v = m.vertices_begin(); v != m.vertices_end(); ++v){
48
                for(VertexIDIterator v = m.vertices_begin(); v != m.vertices_end(); ++v){
49
                    new_vec[*v] = vec[*v];
49
                    new_vec[*v] = vec[*v];
50
                    for(HalfEdgeWalker w = m.halfedgewalker(*v); !w.full_circle(); w = w.circulate_vertex_cw()){
50
                    for(HalfEdgeWalker w = m.halfedgewalker(*v); !w.full_circle(); w = w.circulate_vertex_cw()){
51
                        new_vec[*v] += vec[w.vertex()];
51
                        new_vec[*v] += vec[w.vertex()];
52
                    }
52
                    }
Line 258... Line 258...
258
            curvature_tensors[*v] = curvature_tensor_from_edges(m, *v);
258
            curvature_tensors[*v] = curvature_tensor_from_edges(m, *v);
259
    }
259
    }
260
 
260
 
261
    void smooth_curvature_tensors(const Manifold& m, VertexAttributeVector<Mat3x3d>& curvature_tensors)
261
    void smooth_curvature_tensors(const Manifold& m, VertexAttributeVector<Mat3x3d>& curvature_tensors)
262
    {
262
    {
263
        assert(curvature_tensors.size() == m.total_vertices());
263
        assert(curvature_tensors.size() == m.allocated_vertices());
264
        VertexAttributeVector<Mat3x3d> tmp_curvature_tensors(m.total_vertices());
264
        VertexAttributeVector<Mat3x3d> tmp_curvature_tensors(m.allocated_vertices());
265
        double tmp_area;
265
        double tmp_area;
266
 
266
 
267
        for(VertexIDIterator v = m.vertices_begin(); v != m.vertices_end(); ++v){
267
        for(VertexIDIterator v = m.vertices_begin(); v != m.vertices_end(); ++v){
268
            if(boundary(m, *v))
268
            if(boundary(m, *v))
269
                continue;
269
                continue;
Line 339... Line 339...
339
                                const VertexAttributeVector<Mat3x3d>& curvature_tensors,
339
                                const VertexAttributeVector<Mat3x3d>& curvature_tensors,
340
                                VertexAttributeVector<Vec3d>& min_curv_direction,
340
                                VertexAttributeVector<Vec3d>& min_curv_direction,
341
                                VertexAttributeVector<Vec3d>& max_curv_direction,
341
                                VertexAttributeVector<Vec3d>& max_curv_direction,
342
                                VertexAttributeVector<double>& curvature)
342
                                VertexAttributeVector<double>& curvature)
343
    {
343
    {
344
        assert(curvature_tensors.size() == m.total_vertices());
344
        assert(curvature_tensors.size() == m.allocated_vertices());
345
 
345
 
346
        double max_val = -1e30;
346
        double max_val = -1e30;
347
        for(VertexIDIterator v = m.vertices_begin(); v != m.vertices_end(); ++v){
347
        for(VertexIDIterator v = m.vertices_begin(); v != m.vertices_end(); ++v){
348
            Mat3x3d C,Q,L;
348
            Mat3x3d C,Q,L;
349
            C = curvature_tensors[*v];
349
            C = curvature_tensors[*v];