git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@936 fdac6126-5c0c-442c-9429-916003d36597
This commit is contained in:
Jan Möbius
2013-08-21 07:52:33 +00:00
parent 201c0ceecb
commit cb25e07252
5 changed files with 25 additions and 36 deletions

View File

@@ -275,8 +275,7 @@ int main(int argc, char **argv)
//
MyMesh::FaceFaceIter ff_it;
double quality(0.0), face_quality, temp_quality;
int valence;
double quality(0.0);
// ---------------------------------------- subdivide
std::cout << "\nSubdividing...\n";
@@ -306,7 +305,7 @@ int main(int argc, char **argv)
for (f_it = mesh.faces_begin(); f_it != mesh.faces_end(); ++f_it) {
if (mesh.data(*f_it).state() < target1) {
if (mesh.data(*f_it).state() < int(target1) ) {
++i;
fh = *f_it;
timer2.start();
@@ -317,7 +316,7 @@ int main(int argc, char **argv)
for (v_it = mesh.vertices_begin(); v_it != mesh.vertices_end(); ++v_it) {
if (mesh.data(*v_it).state() < target2) {
if (mesh.data(*v_it).state() < int(target2) ) {
vh = *v_it;
timer2.cont();
subdivider.refine(vh);
@@ -355,12 +354,12 @@ int main(int argc, char **argv)
// check every face
for (f_it = mesh.faces_begin(); f_it != mesh.faces_end(); ++f_it) {
face_quality = 0.0;
valence = 0;
double face_quality = 0.0;
int valence = 0;
for (ff_it = mesh.ff_iter(*f_it); ff_it.is_valid(); ++ff_it) {
temp_quality = OpenMesh::dot( mesh.normal(*f_it), mesh.normal(*ff_it) );
double temp_quality = OpenMesh::dot( mesh.normal(*f_it), mesh.normal(*ff_it) );
if (temp_quality >= 1.0)
temp_quality = .99;

View File

@@ -808,19 +808,18 @@ void
compute_cone_of_normals(VHierarchyNodeHandle node_handle,
VHierarchyNodeHandleContainer &leaf_nodes)
{
float max_angle, angle;
Vec3f n, ln;
VertexHandle vh = vhierarchy_.node(node_handle).vertex_handle();
VHierarchyNodeHandleContainer::iterator n_it, n_end(leaf_nodes.end());
n = mesh_.calc_vertex_normal(vh);
max_angle = 0.0f;
n = mesh_.calc_vertex_normal(vh);
float max_angle = 0.0f;
n_it = leaf_nodes.begin();
while( n_it != n_end )
{
ln = vhierarchy_.node(*n_it).normal();
angle = acosf( dot(n,ln) );
const float angle = acosf( dot(n,ln) );
max_angle = std::max(max_angle, angle );
++n_it;
@@ -844,7 +843,6 @@ compute_screen_space_error(VHierarchyNodeHandle node_handle, VHierarchyNodeHandl
Mesh::VertexHandle vh;
Vec3f residual, res;
Vec3f lp, tri[3];
float min_distance;
float s, t;
VHierarchyNodeHandleContainer::iterator n_it, n_end(leaf_nodes.end());
@@ -855,7 +853,7 @@ compute_screen_space_error(VHierarchyNodeHandle node_handle, VHierarchyNodeHandl
// compute residual of a leaf-vertex from the current mesh_
vh = vhierarchy_.node(node_handle).vertex_handle();
residual = lp - mesh_.point(vh);
min_distance = residual.length();
float min_distance = residual.length();
for (vf_it=mesh_.vf_iter(vh); vf_it.is_valid(); ++vf_it)
{
@@ -912,18 +910,16 @@ compute_mue_sigma(VHierarchyNodeHandle node_handle,
float ratio = std::max(1.0f, max_inner/max_cross);
float whole_degree = acosf(1.0f/ratio);
float mue, max_mue;
float degree;
float res_length;
Vec3f res;
max_mue = 0.0f;
for (r_it = residuals.begin(); r_it != r_end; ++r_it)
{
res = *r_it;
res_length = res.length();
float res_length = res.length();
// TODO: take care when res.length() is too small
degree = acosf(dot(vn,res) / res_length);
float degree = acosf(dot(vn,res) / res_length);
if (degree < 0.0f) degree = -degree;
if (degree > float(M_PI_2)) degree = float(M_PI) - degree;