X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAlgoAPI%2FGeomAlgoAPI_ShapeTools.h;h=f69ad5cd56ef1c0c0657c2eeeb63dc4750ac400b;hb=f0cec241aae9ca16d86e166f45cb5c4987d2c792;hp=8726f670a5dd12414650efab90f0cdc8b2c4314a;hpb=5315361b0c34c6e603474413024db5485c850d80;p=modules%2Fshaper.git diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.h b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.h index 8726f670a..f69ad5cd5 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.h @@ -9,48 +9,61 @@ #include "GeomAlgoAPI.h" -#include #include #include +#include + +class GeomAPI_Edge; +class GeomAPI_Dir; +class GeomAPI_Face; +class GeomAPI_PlanarEdges; +class GeomAPI_Pln; +class GeomAPI_Pnt; + /// \class GeomAlgoAPI_ShapeTools /// \ingroup DataAlgo /// \brief Useful tools for working with shapes. -class GEOMALGOAPI_EXPORT GeomAlgoAPI_ShapeTools +class GeomAlgoAPI_ShapeTools { public: /// \return the total volume of the solids of the current shape or 0.0 if it can be computed. - static double volume(const std::shared_ptr theShape); + GEOMALGOAPI_EXPORT static double volume(const std::shared_ptr theShape); /// \return the centre of mass of the current face. The coordinates returned for the center of mass /// are expressed in the absolute Cartesian coordinate system. (This function works only for surfaces). - static std::shared_ptr centreOfMass(const std::shared_ptr theShape); + GEOMALGOAPI_EXPORT static std::shared_ptr centreOfMass(const std::shared_ptr theShape); /// \brief Combines faces with common edges to shells, or solids to compsolids. /// \param[in] theCompound compound of shapes. /// \param[in] theType type of combine. /// \param[out] theCombinedShapes resulting shapes. /// \param[out] theFreeShapes shapes that does not have common subshapes. - static void combineShapes(const std::shared_ptr theCompound, - const GeomAPI_Shape::ShapeType theType, - ListOfShape& theCombinedShapes, - ListOfShape& theFreeShapes); + GEOMALGOAPI_EXPORT static std::shared_ptr combineShapes(const std::shared_ptr theCompound, + const GeomAPI_Shape::ShapeType theType, + ListOfShape& theCombinedShapes, + ListOfShape& theFreeShapes); + + /// \brief Groups shapes with shared topology to compounds. + /// \param[in] theCompound compound of shapes. + /// \return compound of compounds with shared topology. + GEOMALGOAPI_EXPORT static std::shared_ptr groupSharedTopology(const std::shared_ptr theCompound); /// \brief Calculates bounding box for theShapes /// \return list of eight points. /// \param[in] theShapes list of shapes. /// \param[in] theEnlarge enlarges bounding box size. - static std::list > getBoundingBox(const ListOfShape& theShapes, const double theEnlarge = 0.0); + GEOMALGOAPI_EXPORT static std::list > getBoundingBox(const ListOfShape& theShapes, const double theEnlarge = 0.0); /// \return infinite plane received from theFace plane. - static std::shared_ptr faceToInfinitePlane(const std::shared_ptr theFace); + GEOMALGOAPI_EXPORT static std::shared_ptr faceToInfinitePlane(const std::shared_ptr theFace); /// \brief Enlarges or reduces plane to fit bounding box. /// \return plane that fits to bounding box. /// \param[in] thePlane base plane. /// \param[in] thePoints bounding box points (shoud be eight). - static std::shared_ptr fitPlaneToBox(const std::shared_ptr thePlane, - const std::list >& thePoints); + GEOMALGOAPI_EXPORT static std::shared_ptr fitPlaneToBox(const std::shared_ptr thePlane, + const std::list >& thePoints); /// \brief Finds the start and end vertices of theShape. theShape can be of the following type:\n /// Vertex: theV1 and theV2 are the same and equal to theShape;\n @@ -58,10 +71,46 @@ public: /// Wire : theV1 is start vertex of the first edge, theV2 is end vertex of the last edge. If wire /// contains no edges theV1 and theV2 are nullified.\n /// If none of the above theV1 and theV2 are nullified. - static void findBounds(const std::shared_ptr theShape, - std::shared_ptr& theV1, - std::shared_ptr& theV2); + GEOMALGOAPI_EXPORT static void findBounds(const std::shared_ptr theShape, + std::shared_ptr& theV1, + std::shared_ptr& theV2); + + /// \brief Creates faces with holes from wires. + /// \param[in] theWires base wires. + /// \param[out] theFaces resulting faces. + GEOMALGOAPI_EXPORT static void makeFacesWithHoles(const std::shared_ptr theOrigin, + const std::shared_ptr theDirection, + const ListOfShape& theWires, + ListOfShape& theFaces); + + /// \brief Return a plane for list of shapes if they are all planar. + /// \param[in] theShapes shapes to find plane. + /// \return plane where all shapes lie or empty ptr if they not planar. + GEOMALGOAPI_EXPORT static std::shared_ptr findPlane(const ListOfShape& theShapes); + + /// \brief Checks that vertex/edge is inside face or vertext inside wire. + /// \param[in] theSubShape shape that should be inside. + /// \param[in] theBaseShape base shape. + /// \return true if edge inside the face. + GEOMALGOAPI_EXPORT static bool isSubShapeInsideShape(const std::shared_ptr theSubShape, + const std::shared_ptr theBaseShape); + + /// \return true if theShape is valid. + GEOMALGOAPI_EXPORT static bool isShapeValid(const std::shared_ptr theShape); + + /// \return outer wire for face. If theShape has different type returns empty pointer. + GEOMALGOAPI_EXPORT static std::shared_ptr getFaceOuterWire(const std::shared_ptr theFace); + /// \return true if edge is parallel to face. + GEOMALGOAPI_EXPORT static bool isParallel(const std::shared_ptr theEdge, + const std::shared_ptr theFace); + /// \brief Performs the split of the shape by points. + /// \param[in] theBaseShape shape that should be splitted. + /// \param[in] thePoints container of points to split + /// \param[out] theShapes container of shapes after split + GEOMALGOAPI_EXPORT static void splitShape(const std::shared_ptr& theBaseShape, + const std::set >& thePoints, + std::set >& theShapes); }; #endif