Salome HOME
Issue #17347: B-Splines in Sketcher
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_EdgeBuilder.h
1 // Copyright (C) 2014-2019  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 email : webmaster.salome@opencascade.com
18 //
19
20 #ifndef GeomAlgoAPI_EdgeBuilder_H_
21 #define GeomAlgoAPI_EdgeBuilder_H_
22
23 #include <GeomAlgoAPI.h>
24 #include <GeomAPI_Edge.h>
25 #include <GeomAPI_Pnt.h>
26 #include <GeomAPI_Dir.h>
27 #include <GeomAPI_Lin.h>
28 #include <GeomAPI_Circ.h>
29 #include <memory>
30 #include <vector>
31
32 class GeomAPI_BSpline2d;
33
34 /**\class GeomAlgoAPI_EdgeBuilder
35  * \ingroup DataAlgo
36  * \brief Allows to create face-shapes by different parameters
37  */
38
39 class GEOMALGOAPI_EXPORT GeomAlgoAPI_EdgeBuilder
40 {
41  public:
42   /// Creates linear edge by two points.
43   /// \param theStart a first point of an edge
44   /// \param theEnd an end point of an edge
45   static std::shared_ptr<GeomAPI_Edge> line(std::shared_ptr<GeomAPI_Pnt> theStart,
46                                             std::shared_ptr<GeomAPI_Pnt> theEnd);
47
48   /// Creates linear edge by three dimensions.
49   /// \param theX the X dimension
50   /// \param theY the Y dimension
51   /// \param theZ the Z dimension
52   static std::shared_ptr<GeomAPI_Edge> line(double theDX,
53                                             double theDY,
54                                             double theDZ);
55
56   /// Creates linear edge by GeomAPI_Lin.
57   /// \param theLin line.
58   static std::shared_ptr<GeomAPI_Edge> line(const std::shared_ptr<GeomAPI_Lin> theLin);
59
60   /// Creates edge - axis of the given cylindrical face. The result axis edge is infinite
61   static std::shared_ptr<GeomAPI_Edge> cylinderAxis(
62     std::shared_ptr<GeomAPI_Shape> theCylindricalFace);
63
64   /// Creates linear edge in a form of a circle by a point and a circle radius
65   static std::shared_ptr<GeomAPI_Edge> lineCircle(std::shared_ptr<GeomAPI_Pnt> theCenter,
66                                                     std::shared_ptr<GeomAPI_Dir> theNormal,
67                                                     double theRadius);
68
69   /// Creates linear edge in a form of a circle by GeomAPI_Circle
70   static std::shared_ptr<GeomAPI_Edge> lineCircle(std::shared_ptr<GeomAPI_Circ> theCircle);
71
72   /// Creates linear edge in a form of a circle arc by a three points
73   static std::shared_ptr<GeomAPI_Edge> lineCircleArc(std::shared_ptr<GeomAPI_Pnt> theCenter,
74                                                        std::shared_ptr<GeomAPI_Pnt> theStartPoint,
75                                                        std::shared_ptr<GeomAPI_Pnt> theEndPoint,
76                                                        std::shared_ptr<GeomAPI_Dir> theNormal);
77
78   /// Creates elliptic edge
79   static std::shared_ptr<GeomAPI_Edge> ellipse(const std::shared_ptr<GeomAPI_Pnt>& theCenter,
80                                                const std::shared_ptr<GeomAPI_Dir>& theNormal,
81                                                const std::shared_ptr<GeomAPI_Dir>& theMajorAxis,
82                                                const double                        theMajorRadius,
83                                                const double                        theMinorRadius);
84
85
86   /// Creates elliptic edge
87   static std::shared_ptr<GeomAPI_Edge> ellipticArc(
88       const std::shared_ptr<GeomAPI_Pnt>& theCenter,
89       const std::shared_ptr<GeomAPI_Dir>& theNormal,
90       const std::shared_ptr<GeomAPI_Dir>& theMajorAxis,
91       const double                        theMajorRadius,
92       const double                        theMinorRadius,
93       const std::shared_ptr<GeomAPI_Pnt>& theStart,
94       const std::shared_ptr<GeomAPI_Pnt>& theEnd);
95
96   /// Creates planar B-spline edge
97   static GeomEdgePtr bsplineOnPlane(const std::shared_ptr<GeomAPI_Pln>& thePlane,
98                                     const std::list<std::shared_ptr<GeomAPI_Pnt2d> >& thePoles,
99                                     const std::list<double>& theWeights,
100                                     const bool thePeriodic);
101
102   /// Creates planar B-spline edge
103   static GeomEdgePtr bsplineOnPlane(const std::shared_ptr<GeomAPI_Pln>& thePlane,
104                                     const std::shared_ptr<GeomAPI_BSpline2d>& theCurve);
105 };
106
107 #endif