Salome HOME
Issue #2024: Redesign of circle and arc of circle
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_ShapeTools.cpp
index 1df2c7f8745f37b64881a809f7885f922452a77e..cf3ab9623ab8d0a94497b6c1c3cd7b9f963551b2 100644 (file)
@@ -648,6 +648,27 @@ bool GeomAlgoAPI_ShapeTools::isSubShapeInsideShape(
   return true;
 }
 
+//==================================================================================================
+bool GeomAlgoAPI_ShapeTools::isShapesIntersects(
+  const std::shared_ptr<GeomAPI_Shape> theShape1,
+  const std::shared_ptr<GeomAPI_Shape> theShape2)
+{
+  if(!theShape1.get() || !theShape2.get()) {
+    return false;
+  }
+
+  const TopoDS_Shape& aShape1 = theShape1->impl<TopoDS_Shape>();
+  const TopoDS_Shape& aShape2 = theShape2->impl<TopoDS_Shape>();
+
+  BRepExtrema_DistShapeShape aDist(aShape1, aShape2);
+  aDist.Perform();
+  if(aDist.IsDone() && aDist.Value() < Precision::Confusion()) {
+    return true;
+  }
+
+  return false;
+}
+
 //==================================================================================================
 bool GeomAlgoAPI_ShapeTools::isShapeValid(const std::shared_ptr<GeomAPI_Shape> theShape)
 {