X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAlgoAPI%2FGeomAlgoAPI_ShapeTools.cpp;h=39b06f92723b9cfe1ed4c8082a617234fd75ce5d;hb=580f1752efd9d3e8c2890c4016b04dafd639bab7;hp=54835f857cccdaef0bd32fda7b64d5b399b1924a;hpb=0b5646d3d6db37d5e17db76aec12db185c4b24a0;p=modules%2Fshaper.git diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp index 54835f857..39b06f927 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp @@ -8,15 +8,23 @@ #include +#include + #include +#include #include #include +#include +#include #include #include #include #include +#include #include #include +#include + //================================================================================================= double GeomAlgoAPI_ShapeTools::volume(std::shared_ptr theShape) @@ -159,3 +167,25 @@ void GeomAlgoAPI_ShapeTools::combineShapes(const std::shared_ptr theFreeShapes.push_back(aGeomShape); } } + +//================================================================================================= +std::shared_ptr GeomAlgoAPI_ShapeTools::faceToInfinitePlane(const std::shared_ptr& theFace) +{ + if (!theFace.get()) + return std::shared_ptr(); + + TopoDS_Face aPlaneFace = TopoDS::Face(theFace->impl()); + if (aPlaneFace.IsNull()) + return std::shared_ptr(); + + Handle(Geom_Plane) aPlane = Handle(Geom_Plane)::DownCast(BRep_Tool::Surface(aPlaneFace)); + if (aPlane.IsNull()) + return std::shared_ptr(); + + // make an infinity face on the plane + TopoDS_Shape anInfiniteFace = BRepBuilderAPI_MakeFace(aPlane->Pln()).Shape(); + + std::shared_ptr aResult(new GeomAPI_Shape); + aResult->setImpl(new TopoDS_Shape(anInfiniteFace)); + return aResult; +}