Take care of collinear points when computing a facet normal

This commit is contained in:
Andreas Fabri 2010-09-27 10:53:45 +00:00
parent 97f2ff7ef8
commit 6b1e578377
1 changed files with 3 additions and 1 deletions

View File

@ -16,7 +16,9 @@ typename Kernel::Vector_3 compute_facet_normal(const Facet& f)
const Point& curr = he->vertex()->point(); const Point& curr = he->vertex()->point();
const Point& next = he->next()->vertex()->point(); const Point& next = he->next()->vertex()->point();
Vector n = CGAL::cross_product(next-curr,prev-curr); Vector n = CGAL::cross_product(next-curr,prev-curr);
normal = normal + (n / std::sqrt(n*n)); if((n*n) > 0.000000001){
normal = normal + (n / std::sqrt(n*n));
}
} }
return normal / std::sqrt(normal * normal); return normal / std::sqrt(normal * normal);
} }