Subversion Repositories gelsvn

Rev

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

Rev 403 Rev 412
Line 109... Line 109...
109
		barea += area(f)/3.0;
109
		barea += area(f)/3.0;
110
	}
110
	}
111
	return barea;
111
	return barea;
112
}
112
}
113
 
113
 
114
const Vec3d mean_curvature_normal(VertexIter v)
114
void unnormalized_mean_curvature_normal(VertexIter v, Vec3d& curv_normal, double& w_sum)
115
{
115
{
116
	if(!is_boundary(v))
116
	if(!is_boundary(v))
117
	{
117
	{
118
		Vec3d vertex(v->pos);
118
		Vec3d vertex(v->pos);
119
		Vec3d curv_normal(0);
119
		curv_normal = Vec3d(0);
120
		double a_sum = 0;
120
		w_sum = 0;
121
		for(VertexCirculator vc(v); !vc.end(); ++vc)
121
		for(VertexCirculator vc(v); !vc.end(); ++vc)
122
		{
122
		{
123
			HalfEdgeIter h = vc.get_halfedge();
123
			HalfEdgeIter h = vc.get_halfedge();
124
			Vec3d nbr(h->vert->pos);
124
			Vec3d nbr(h->vert->pos);
125
			Vec3d left(h->next->vert->pos);
125
			Vec3d left(h->next->vert->pos);
Line 133... Line 133...
133
			double a_right = acos(min(1.0, max(-1.0, d_right)));
133
			double a_right = acos(min(1.0, max(-1.0, d_right)));
134
			
134
			
135
			double w = 1.0/tan(a_left) + 1.0/tan(a_right);
135
			double w = 1.0/tan(a_left) + 1.0/tan(a_right);
136
			
136
			
137
			curv_normal += w * (vertex-nbr);
137
			curv_normal += w * (vertex-nbr);
138
			
-
 
139
			a_sum += area(vc.get_face());
138
			w_sum += w;
140
		}
139
		}
141
		
-
 
142
		return curv_normal/(4*a_sum);
-
 
143
	}
140
	}
-
 
141
}
-
 
142
 
-
 
143
const Vec3d mean_curvature_normal(VertexIter v)
-
 
144
{
-
 
145
	Vec3d curv_normal;
144
	return Vec3d(0);
146
	double w_sum;
-
 
147
	unnormalized_mean_curvature_normal(v, curv_normal, w_sum);
-
 
148
	
-
 
149
	return curv_normal / (4*voronoi_area(v));
145
}
150
}
146
 
151
 
147
double sum_curvatures(Manifold& m, vector<double>& curvature)
152
double sum_curvatures(Manifold& m, vector<double>& curvature)
148
{
153
{
149
	double sum = 0;
154
	double sum = 0;