Salome HOME
Merge branch 'jfa/40620_ExportXAO_separate_BREP'
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_ShapeTools.h
index 49b3432445b394744ae06d5faa901f6dde0dc01f..55ae6fb78792fe6910f97d9d2531446c2f83bac6 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2019  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2024  CEA, EDF
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 
 #include <GeomAPI_Shape.h>
 #include <GeomAPI_Vertex.h>
-
+#include <GeomAPI_Pnt.h>
 #include <map>
 #include <set>
+#ifdef WIN32
+#include<array>
+#endif
 
 class GeomAPI_Ax1;
 class GeomAPI_Edge;
@@ -45,12 +48,28 @@ class ModelAPI_Object;
 class GeomAlgoAPI_ShapeTools
 {
 public:
+  /// \return the lenth of the edges of the current shape or 0.0 if it can be computed.
+  GEOMALGOAPI_EXPORT static double length(const std::shared_ptr<GeomAPI_Shape> theShape);
+
   /// \return the total volume of the solids of the current shape or 0.0 if it can be computed.
   GEOMALGOAPI_EXPORT static double volume(const std::shared_ptr<GeomAPI_Shape> theShape);
 
   /// \return the total area of the faces of the current shape or 0.0 if it can be computed.
   GEOMALGOAPI_EXPORT static double area(const std::shared_ptr<GeomAPI_Shape> theShape);
 
+  /// indicate if two faces are continuous
+  /// with an angular tolerance used for G1 continuity to compare the angle between the normals
+  /// \param theFace1  the first face
+  /// \param theFace2  the second face
+  /// \param thePoint  the point for the normal
+  /// \param theAngle  the angular tolerance
+  /// \param theError  error
+  GEOMALGOAPI_EXPORT static bool isContinuousFaces(const GeomShapePtr& theFace1,
+                                                   const GeomShapePtr& theFace2,
+                                                   const GeomPointPtr& thePoint,
+                                                   const double & theAngle,
+                                                   std::string& theError);
+
   /// \return the center of mass of the current face.
   /// The coordinates returned for the center of mass
   /// are expressed in the absolute Cartesian coordinate system.
@@ -65,6 +84,14 @@ public:
   /// \brief Calculate minimal distance between shapes
   GEOMALGOAPI_EXPORT static double minimalDistance(const GeomShapePtr& theShape1,
                                                    const GeomShapePtr& theShape2);
+  GEOMALGOAPI_EXPORT static double minimalDistance(const GeomShapePtr& theShape1,
+                                                   const GeomShapePtr& theShape2,
+                                                   std::array<double, 3> & fromShape1To2);
+
+  /// \brief Calculate maximal value of all possible distances between shapes.
+  ///        The shapes can be two edges or two faces only.
+  GEOMALGOAPI_EXPORT static double shapeProximity(const GeomShapePtr& theShape1,
+                                                  const GeomShapePtr& theShape2);
 
   /// \brief Combines faces with common edges to shells, or solids to compsolids.
   /// \param[in] theCompound compound of shapes.
@@ -141,16 +168,20 @@ public:
   GEOMALGOAPI_EXPORT static
     std::shared_ptr<GeomAPI_Shape> getFaceOuterWire(const std::shared_ptr<GeomAPI_Shape> theFace);
 
+  /// \return \c true if edges are tangent in the specified point
+  GEOMALGOAPI_EXPORT static bool isTangent(const std::shared_ptr<GeomAPI_Edge> theEdge1,
+                                           const std::shared_ptr<GeomAPI_Edge> theEdge2,
+                                           const std::shared_ptr<GeomAPI_Vertex> theTgPoint);
+
   /// \return true if edge is parallel to face.
   GEOMALGOAPI_EXPORT static bool isParallel(const std::shared_ptr<GeomAPI_Edge> theEdge,
                                             const std::shared_ptr<GeomAPI_Face> theFace);
 
-  // Computes intersection point between the edge curve and a face surface (only one point, with
-  // preferences to point that belongs to edge and face boundaries.
+  /// Computes intersection point between the edge curve and a face surface (only one point, with
+  /// preferences to point that belongs to edge and face boundaries.
   /// \returns null if there is no intersection
   GEOMALGOAPI_EXPORT static std::list<std::shared_ptr<GeomAPI_Vertex> > intersect(
-    const std::shared_ptr<GeomAPI_Edge> theEdge, const std::shared_ptr<GeomAPI_Face> theFace,
-    const bool thePointsOutsideFace);
+    const std::shared_ptr<GeomAPI_Edge> theEdge, const std::shared_ptr<GeomAPI_Face> theFace);
 
   typedef std::map<std::shared_ptr<GeomAPI_Pnt>,
                    std::pair<std::list<std::shared_ptr<GeomDataAPI_Point2D> >,
@@ -204,6 +235,11 @@ public:
                                                    const ListOfShape& theBaseShapes,
                                                    const std::shared_ptr<GeomAPI_Dir> theDir,
                                                    double& theToSize, double& theFromSize);
+
+  /// \brief Get shared faces of a shape
+  /// \param[in] theShape shape that should be exploded
+  /// \return list of shared faces
+  GEOMALGOAPI_EXPORT static ListOfShape getSharedFaces(const GeomShapePtr& theShape);
 };
 
 #endif