Skip to content
Snippets Groups Projects
Commit 0b2d5db2 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

use geometrical tolerance to check if the simple normal computation fails;...

use geometrical tolerance to check if the simple normal computation fails; this allows to taylor the accuracy for plane surfaces defined with reduced accuracy (resulting in vertices not really co-planar)
parent 4b7871db
No related branches found
No related tags found
No related merge requests found
...@@ -452,7 +452,10 @@ void GFace::computeMeanPlane() ...@@ -452,7 +452,10 @@ void GFace::computeMeanPlane()
for(unsigned int i = 2; i < pts.size(); i++){ for(unsigned int i = 2; i < pts.size(); i++){
SVector3 d0i(pts[0], pts[i]); SVector3 d0i(pts[0], pts[i]);
SVector3 n = crossprod(d01, d0i); SVector3 n = crossprod(d01, d0i);
if(norm(n) > 1e-6){ // if too small, the points are almost colinear; tolerance is relatively
// high so that we don't accept points on plane surfaces defined by
// lines that are not exactly co-planar
if(norm(n) > sqrt(CTX::instance()->geom.tolerance) * CTX::instance()->lc){
res[0] = n.x(); res[1] = n.y(); res[2] = n.z(); res[0] = n.x(); res[1] = n.y(); res[2] = n.z();
xm = pts[0].x(); ym = pts[0].y(); zm = pts[0].z(); xm = pts[0].x(); ym = pts[0].y(); zm = pts[0].z();
ok = true; ok = true;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment