Salome HOME
Task 2.12. New entities: ellipses and arcs of ellipses (issue #3003)
[modules/shaper.git] / src / SketchSolver / PlaneGCSSolver / PlaneGCSSolver_EdgeWrapper.cpp
index 7ec36cf236a33507de548cfad7bde4f137c137a5..bb8af7873db682ede8da9d82bf456dce45599a9c 100644 (file)
@@ -31,6 +31,11 @@ PlaneGCSSolver_EdgeWrapper::PlaneGCSSolver_EdgeWrapper(const GCSCurvePtr theEnti
     else {
       std::shared_ptr<GCS::Circle> aCircle = std::dynamic_pointer_cast<GCS::Circle>(myEntity);
       if (aCircle) myType = ENTITY_CIRCLE;
+      else {
+        std::shared_ptr<GCS::Ellipse> anEllipse =
+            std::dynamic_pointer_cast<GCS::Ellipse>(myEntity);
+        if (anEllipse) myType = ENTITY_ELLIPSE;
+      }
     }
   }
 }
@@ -62,5 +67,9 @@ bool PlaneGCSSolver_EdgeWrapper::isDegenerated() const
     return aSqRadius < aSqTol || aSqRadius > aMaxRadius * aMaxRadius || // <- arc radius
            anAngleDiff < anAngleTol || fabs(anAngleDiff - 2*PI) < anAngleTol; // <- arc angle
   }
+  else if (myType == ENTITY_ELLIPSE) {
+    std::shared_ptr<GCS::Ellipse> anEllipse = std::dynamic_pointer_cast<GCS::Ellipse>(myEntity);
+    return *anEllipse->radmin < tolerance;
+  }
   return false;
 }