mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-24 12:46:53 +00:00
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:
@@ -189,11 +189,14 @@ bool IfcGeom::convert(const IfcSchema::IfcFace* l, TopoDS_Shape& face) {
|
|||||||
// as the topological face normal the face orientation is
|
// as the topological face normal the face orientation is
|
||||||
// reversed
|
// reversed
|
||||||
gp_Vec face_normal2(x,y,z);
|
gp_Vec face_normal2(x,y,z);
|
||||||
|
|
||||||
|
if (face_normal2.Magnitude() > ALMOST_ZERO) {
|
||||||
if ( face_normal1.Dot(face_normal2) < 0 ) {
|
if ( face_normal1.Dot(face_normal2) < 0 ) {
|
||||||
TopAbs_Orientation o = face.Orientation();
|
TopAbs_Orientation o = face.Orientation();
|
||||||
face.Orientation(o == TopAbs_FORWARD ? TopAbs_REVERSED : TopAbs_FORWARD);
|
face.Orientation(o == TopAbs_FORWARD ? TopAbs_REVERSED : TopAbs_FORWARD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// It might be a good idea to globally discard faces
|
// It might be a good idea to globally discard faces
|
||||||
// smaller than a certain treshold value. But for now
|
// smaller than a certain treshold value. But for now
|
||||||
|
|||||||
Reference in New Issue
Block a user