diff --git a/code/IFCGeometry.cpp b/code/IFCGeometry.cpp index 61442bdba..deff5a284 100644 --- a/code/IFCGeometry.cpp +++ b/code/IFCGeometry.cpp @@ -64,6 +64,7 @@ namespace Assimp { //#define to_int64(p) (static_cast( std::max( 0., std::min( static_cast((p)), 1.) ) * max_ulong64 )) #define to_int64(p) (static_cast(static_cast((p) ) * max_ulong64 )) #define from_int64(p) (static_cast((p)) / max_ulong64) +#define one_vec (IfcVector2(static_cast(1.0),static_cast(1.0))) // ------------------------------------------------------------------------------------------------ bool ProcessPolyloop(const IfcPolyLoop& loop, TempMesh& meshout, ConversionData& /*conv*/) @@ -1326,6 +1327,7 @@ void CleanupWindowContours(std::vector< std::vector >& contours) // empty polygon? drop the contour altogether if(clipped.empty()) { + IFCImporter::LogError("error during polygon clipping, window contour is degenerate"); contour.clear(); continue; } @@ -1336,7 +1338,10 @@ void CleanupWindowContours(std::vector< std::vector >& contours) scratch.clear(); BOOST_FOREACH(const ClipperLib::IntPoint& point, clipped[0].outer) { - scratch.push_back( IfcVector2(from_int64(point.X), from_int64(point.Y))); + IfcVector2 vv = IfcVector2(from_int64(point.X), from_int64(point.Y)); + vv = std::max(vv,IfcVector2()); + vv = std::min(vv,one_vec); + scratch.push_back( vv ); } contour.swap(scratch); } @@ -1437,8 +1442,6 @@ bool TryAddOpenings_Quadrulate(const std::vector& openings, { std::vector& out = curmesh.verts; - const IfcVector2 one_vec = IfcVector2(static_cast(1.0),static_cast(1.0)); - // Try to derive a solid base plane within the current surface for use as // working coordinate system. const IfcMatrix3& m = DerivePlaneCoordinateSpace(curmesh); @@ -2059,7 +2062,7 @@ bool ProcessRepresentationItem(const IfcRepresentationItem& item, #undef to_int64 #undef from_int64 -#undef from_int64_f +#undef one_vec } // ! IFC } // ! Assimp