Salome HOME
Issue #1834: Fix length of lines
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_PointBuilder.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        GeomAlgoAPI_PointBuilder.h
4 // Created:     02 Jun 2014
5 // Author:      Mikhail PONIKAROV
6
7 #ifndef GeomAlgoAPI_PointBuilder_H_
8 #define GeomAlgoAPI_PointBuilder_H_
9
10 #include <GeomAlgoAPI.h>
11 #include <memory>
12
13 class GeomAPI_Edge;
14 class GeomAPI_Face;
15 class GeomAPI_Pnt;
16 class GeomAPI_Shape;
17 class GeomAPI_Vertex;
18
19 /// \class GeomAlgoAPI_PointBuilder
20 /// \ingroup DataAlgo
21 /// \brief Allows to create vertex-shapes by different parameters
22 class GEOMALGOAPI_EXPORT GeomAlgoAPI_PointBuilder
23 {
24 public:
25   /// Creates a vertex by point
26   static std::shared_ptr<GeomAPI_Vertex> vertex(const std::shared_ptr<GeomAPI_Pnt> thePoint);
27
28   /// Creates a vertex by point coordinates
29   static std::shared_ptr<GeomAPI_Vertex> vertex(const double theX,
30                                                 const double theY,
31                                                 const double theZ);
32
33   /// \brief Creates vertex by edge and distance on it.
34   /// \param[in] theEdge edge.
35   /// \param[in] theValue distance value.
36   /// \param[in] theIsPercent if true theValue will be treated 
37   ///                         as a percentage of theEdge total length.
38   /// \param[in] theIsReverse if true the distance will be measured from the edge end point.
39   /// \return created vertex.
40   static std::shared_ptr<GeomAPI_Vertex> vertexOnEdge(const std::shared_ptr<GeomAPI_Edge> theEdge,
41                                                       const double theValue,
42                                                       const bool theIsPercent = false,
43                                                       const bool theIsReverse = false);
44
45   /// \brief Creates vertex by projection another vertex on plane.
46   /// \param[in] theVertex vertex to project.
47   /// \param[in] thePlane face for projection. Should be planar.
48   /// \return created vertex.
49   static std::shared_ptr<GeomAPI_Vertex>
50     vertexByProjection(const std::shared_ptr<GeomAPI_Vertex> theVertex,
51                        const std::shared_ptr<GeomAPI_Face> thePlane);
52
53   /// \brief Creates vertex by intersection two coplanar lines.
54   /// \param[in] theEdge1 first linear edge.
55   /// \param[in] theEdge2 second linear edge.
56   /// \return created vertex.
57   static std::shared_ptr<GeomAPI_Vertex>
58     vertexByIntersection(const std::shared_ptr<GeomAPI_Edge> theEdge1,
59                          const std::shared_ptr<GeomAPI_Edge> theEdge2);
60
61   /// \brief Creates vertex by intersection line and plane.
62   /// \param[in] theEdge linear edge.
63   /// \param[in] theFace planar face.
64   /// \return created vertex.
65   static std::shared_ptr<GeomAPI_Vertex> 
66     vertexByIntersection(const std::shared_ptr<GeomAPI_Edge> theEdge,
67                          const std::shared_ptr<GeomAPI_Face> theFace);
68
69   /// Return point by shape vertex
70   static std::shared_ptr<GeomAPI_Pnt> point(const std::shared_ptr<GeomAPI_Shape> theVertex);
71 };
72
73 #endif