Salome HOME
2d59a12636d183c2cc62c8154ea929e0734a53c9
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_PointBuilder.h
1 // Copyright (C) 2014-2017  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
19 //
20
21 #ifndef GeomAlgoAPI_PointBuilder_H_
22 #define GeomAlgoAPI_PointBuilder_H_
23
24 #include <GeomAlgoAPI.h>
25 #include <memory>
26
27 class GeomAPI_Edge;
28 class GeomAPI_Face;
29 class GeomAPI_Pnt;
30 class GeomAPI_Shape;
31 class GeomAPI_Vertex;
32
33 /// \class GeomAlgoAPI_PointBuilder
34 /// \ingroup DataAlgo
35 /// \brief Allows to create vertex-shapes by different parameters
36 class GEOMALGOAPI_EXPORT GeomAlgoAPI_PointBuilder
37 {
38 public:
39   /// Creates a vertex by point
40   static std::shared_ptr<GeomAPI_Vertex> vertex(const std::shared_ptr<GeomAPI_Pnt> thePoint);
41
42   /// Creates a vertex by point coordinates
43   static std::shared_ptr<GeomAPI_Vertex> vertex(const double theX,
44                                                 const double theY,
45                                                 const double theZ);
46
47   /// \brief Creates vertex by edge and distance on it.
48   /// \param[in] theEdge edge.
49   /// \param[in] theValue distance value.
50   /// \param[in] theIsPercent if true theValue will be treated
51   ///                         as a percentage of theEdge total length.
52   /// \param[in] theIsReverse if true the distance will be measured from the edge end point.
53   /// \return created vertex.
54   static std::shared_ptr<GeomAPI_Vertex> vertexOnEdge(const std::shared_ptr<GeomAPI_Edge> theEdge,
55                                                       const double theValue,
56                                                       const bool theIsPercent = false,
57                                                       const bool theIsReverse = false);
58
59   /// \brief Creates vertex by projection another vertex on plane.
60   /// \param[in] theVertex vertex to project.
61   /// \param[in] theFace face for projection. Should be planar.
62   /// \return created vertex.
63   static std::shared_ptr<GeomAPI_Vertex>
64     vertexByProjection(const std::shared_ptr<GeomAPI_Vertex> theVertex,
65                        const std::shared_ptr<GeomAPI_Face> theFace);
66
67   /// \brief Creates vertex by intersection two coplanar lines.
68   /// \param[in] theEdge1 first linear edge.
69   /// \param[in] theEdge2 second linear edge.
70   /// \return created vertex.
71   static std::shared_ptr<GeomAPI_Vertex>
72     vertexByIntersection(const std::shared_ptr<GeomAPI_Edge> theEdge1,
73                          const std::shared_ptr<GeomAPI_Edge> theEdge2);
74
75   /// \brief Creates vertex by intersection line and plane.
76   /// \param[in] theEdge linear edge.
77   /// \param[in] theFace planar face.
78   /// \return created vertex.
79   static std::shared_ptr<GeomAPI_Vertex>
80     vertexByIntersection(const std::shared_ptr<GeomAPI_Edge> theEdge,
81                          const std::shared_ptr<GeomAPI_Face> theFace);
82
83   /// Return point by shape vertex
84   static std::shared_ptr<GeomAPI_Pnt> point(const std::shared_ptr<GeomAPI_Shape> theVertex);
85 };
86
87 #endif