Detect cases where Newell's Method returns a zero-length vector and make no attempt to normalize it in order to prevent an exception. In this case the face will be flagged as invalid down the road, because its perimeter doesn't span any area.

This commit is contained in:
Thomas Krijnen
2014-06-07 17:49:21 +00:00
parent 49e4ff31ca
commit 81292f1adc
+6 -3
View File
@@ -189,9 +189,12 @@ bool IfcGeom::convert(const IfcSchema::IfcFace* l, TopoDS_Shape& face) {
// as the topological face normal the face orientation is
// reversed
gp_Vec face_normal2(x,y,z);
if ( face_normal1.Dot(face_normal2) < 0 ) {
TopAbs_Orientation o = face.Orientation();
face.Orientation(o == TopAbs_FORWARD ? TopAbs_REVERSED : TopAbs_FORWARD);
if (face_normal2.Magnitude() > ALMOST_ZERO) {
if ( face_normal1.Dot(face_normal2) < 0 ) {
TopAbs_Orientation o = face.Orientation();
face.Orientation(o == TopAbs_FORWARD ? TopAbs_REVERSED : TopAbs_FORWARD);
}
}
}