From 6b1e578377eb24e94a2e4b16721e2a540da9f190 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Mon, 27 Sep 2010 10:53:45 +0000 Subject: [PATCH] Take care of collinear points when computing a facet normal --- Polyhedron/demo/Polyhedron/include/CGAL/compute_normal.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Polyhedron/demo/Polyhedron/include/CGAL/compute_normal.h b/Polyhedron/demo/Polyhedron/include/CGAL/compute_normal.h index 3437332ab75..61cbf051d3c 100644 --- a/Polyhedron/demo/Polyhedron/include/CGAL/compute_normal.h +++ b/Polyhedron/demo/Polyhedron/include/CGAL/compute_normal.h @@ -16,7 +16,9 @@ typename Kernel::Vector_3 compute_facet_normal(const Facet& f) const Point& curr = he->vertex()->point(); const Point& next = he->next()->vertex()->point(); 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); }