Salome HOME
Fix for the issue #2753 : error when dump/load script
[modules/shaper.git] / src / GeomAPI / GeomAPI_Wire.cpp
index bcbaf3e946be37bff95143533d3635145f0dd2c8..05062a145cc25abc95b00133c5c7e91a7f52c145 100644 (file)
@@ -81,6 +81,8 @@ bool GeomAPI_Wire::isPolygon(std::list<GeomPointPtr>& thePoints) const
 //==================================================================================================
 bool GeomAPI_Wire::isRectangle(std::list<GeomPointPtr>& thePoints) const
 {
+  thePoints.clear();
+
   const TopoDS_Wire& aWire = TopoDS::Wire(impl<TopoDS_Shape>());
   const Handle(Standard_Type)& aLineType = STANDARD_TYPE(Geom_Line);
 
@@ -104,6 +106,9 @@ bool GeomAPI_Wire::isRectangle(std::list<GeomPointPtr>& thePoints) const
     gp_Pnt aStart = aC3D->Value(aT1);
     gp_Pnt aEnd = aC3D->Value(aT2);
 
+    if (aStart.Distance(aEnd) <= Precision::Confusion())
+      return false;
+
     // check the edge is orthogonal to the previous
     gp_XYZ aCurDir = (aEnd.XYZ() - aStart.XYZ()).Normalized();
     if (aPrevDir.Dot(aCurDir) < Precision::Confusion())