cgal icon indicating copy to clipboard operation
cgal copied to clipboard

PMP: compute_face_normal() of degenerate faces

Open afabri opened this issue 3 years ago • 3 comments

Issue Details

In this testsuite we get an assertion that the normal of a degenerate face is not the null vector. It seems that the algorithm does not check if a face is degenerate but computes something.

At the same time the platform has several errors for other packages, comparing numerical results.

Environment

  • Operating system (Windows/Mac/Linux, 32/64 bits): Linux
  • Compiler: Clang 14.0.6
  • Release or debug mode:
  • Specific flags used (if any):
  • CGAL version: master
  • Boost version:
  • Other libraries versions if used (Eigen, TBB, etc.):

afabri avatar Aug 02 '22 15:08 afabri

IIRC we had discussed with @MaelRL that it makes no sense to return NULL_VECTOR as the normal of a degenerate face. But the test seems to think the other way around...

janetournois avatar Aug 02 '22 15:08 janetournois

But what would be the better choice? Also not only that the test thinks it, but it is only one platform where this triggers an assertion.

afabri avatar Aug 03 '22 10:08 afabri

The problem is that for certain doubles a * b - b * a does not equal 0. The cross product does exactly that in the case of identical vectors. As Laurent pointed out, intermediate results may be stored as a double or in a FPU register with higher precision. Storing both products explicitly in a double resolves the problem.

soesau avatar Sep 01 '22 17:09 soesau