Removed redundant method.
if (aResult.ShapeType() == TopAbs_COMPOUND) {
NCollection_List<TopoDS_Shape> aSubs;
addSimpleToList(aResult, aSubs);
- if (aSubs.Size() == 1)
+ if(aSubs.Size() == 1) {
aResult = aSubs.First();
+ } else if(aSubs.Size() == 0) {
+ return GeomShapePtr();
+ }
}
GeomShapePtr aResShape(new GeomAPI_Shape);
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)
{
const std::shared_ptr<GeomAPI_Shape> theSubShape,
const std::shared_ptr<GeomAPI_Shape> theBaseShape);
- /// \brief Checks that shapes intersects.
- /// \param[in] theShape1 first shape.
- /// \param[in] theShape2 second shape.
- /// \return true if shapes intersects.
- GEOMALGOAPI_EXPORT static bool GeomAlgoAPI_ShapeTools::isShapesIntersects(
- const std::shared_ptr<GeomAPI_Shape> theShape1,
- const std::shared_ptr<GeomAPI_Shape> theShape2);
-
/// \return true if theShape is valid.
GEOMALGOAPI_EXPORT static bool isShapeValid(const std::shared_ptr<GeomAPI_Shape> theShape);
if(aResult.get()) {
GeomShapePtr aShape = aResult->shape();
if(aShape.get() && !aShape->isNull()) {
- return GeomAlgoAPI_ShapeTools::isShapesIntersects(anArcShape, aShape);
+ GeomShapePtr anIntersection = anArcShape->intersect(aShape);
+ if(anIntersection.get() && !anIntersection->isNull()) {
+ return true;
+ }
}
}
{
GeomShapePtr aShape = (*anIt)->shape();
if(aShape.get() && !aShape->isNull()) {
- if(GeomAlgoAPI_ShapeTools::isShapesIntersects(anArcShape, aShape)) {
+ GeomShapePtr anIntersection = anArcShape->intersect(aShape);
+ if(anIntersection.get() && !anIntersection->isNull()) {
return true;
}
}
title="Arc"
tooltip="Create arc"
icon="icons/Sketch/arc.png">
- <toolbox id="arc_type">
+ <toolbox id="arc_type" modified_in_edit="false">
<box id="by_center_and_points"
icon="icons/Sketch/arc_base_32x32.png"
title="Center and two points">