#include <BRepAlgoAPI_Section.hxx>
#include <BRepBndLib.hxx>
#include <BRepBuilderAPI_FindPlane.hxx>
+#include <BRepExtrema_DistShapeShape.hxx>
#include <BRepTools.hxx>
#include <Bnd_Box.hxx>
#include <Geom_Circle.hxx>
#include <sstream>
#include <algorithm> // for std::transform
+#include <BRepTools.hxx>
+
#define MY_SHAPE implPtr<TopoDS_Shape>()
GeomAPI_Shape::GeomAPI_Shape()
aResShape->setImpl(new TopoDS_Shape(aResult));
return aResShape;
}
+
+bool GeomAPI_Shape::isIntersect(const GeomShapePtr theShape) const
+{
+ if(!theShape.get()) {
+ return false;
+ }
+
+ const TopoDS_Shape& aShape1 = const_cast<GeomAPI_Shape*>(this)->impl<TopoDS_Shape>();
+ const TopoDS_Shape& aShape2 = theShape->impl<TopoDS_Shape>();
+
+ BRepExtrema_DistShapeShape aDist(aShape1, aShape2);
+ aDist.Perform();
+ if(aDist.IsDone() && aDist.Value() < Precision::Confusion()) {
+ return true;
+ }
+
+ return false;
+}
/// Returns intersection of shapes
GEOMAPI_EXPORT
std::shared_ptr<GeomAPI_Shape> intersect(const std::shared_ptr<GeomAPI_Shape> theShape) const;
+
+ /// Returns true if min distance between shapes < tolerance.
+ GEOMAPI_EXPORT
+ bool isIntersect(const std::shared_ptr<GeomAPI_Shape> theShape) const;
};
//! Pointer on list of shapes
if(aResult.get()) {
GeomShapePtr aShape = toInfiniteEdge(aResult->shape());
if(aShape.get() && !aShape->isNull()) {
- GeomShapePtr anIntersection = anArcShape->intersect(aShape);
- if(anIntersection.get() && !anIntersection->isNull()) {
+ if(anArcShape->isIntersect(aShape)) {
return true;
}
}
{
GeomShapePtr aShape = toInfiniteEdge((*anIt)->shape());
if(aShape.get() && !aShape->isNull()) {
- GeomShapePtr anIntersection = anArcShape->intersect(aShape);
- if(anIntersection.get() && !anIntersection->isNull()) {
+ if(anArcShape->isIntersect(aShape)) {
return true;
}
}