]> SALOME platform Git repositories - modules/geom.git/blob - src/GEOMImpl/GEOMImpl_Fillet1d.hxx
Salome HOME
0021684: EDF 2221 : Display the arguments and the name of the operations
[modules/geom.git] / src / GEOMImpl / GEOMImpl_Fillet1d.hxx
1 // Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
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.
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 //  File   : GEOMImpl_Fillet1d.hxx
21 //  Module : GEOMImpl
22
23 #ifndef _GEOMImpl_Fillet1d_HeaderFile
24 #define _GEOMImpl_Fillet1d_HeaderFile
25
26 #include <TopoDS_Edge.hxx>
27
28 #include <Geom_Plane.hxx>
29 #include <Geom2d_Curve.hxx>
30
31 #include <gp_Pnt.hxx>
32
33 #include <TColStd_ListOfReal.hxx>
34 #include <TColStd_SequenceOfReal.hxx>
35 #include <TColStd_SequenceOfInteger.hxx>
36
37 class GEOMImpl_Fillet1dPoint;
38
39 /**
40 * GEOMImpl_Fillet1d is 1D fillet algorithm on two planar edges with given radius
41 */
42
43 class GEOMImpl_Fillet1d
44 {
45 public:
46   //! Constructor
47   //! The fillet 1D algorithm is initialised by two edges and plane
48   Standard_EXPORT GEOMImpl_Fillet1d(const TopoDS_Edge& theEdge1,
49                                     const TopoDS_Edge& theEdge2,
50                                     const gp_Pln&      thePlane);
51   //! Makes fillet with given radius
52   //! @returns Standard_True, if at least one result computed
53   Standard_EXPORT Standard_Boolean Perform(const Standard_Real theRadius);
54
55   //! Returns result fillet edge and modified edges as out parameters
56   Standard_EXPORT TopoDS_Edge Result(const gp_Pnt& thePoint, TopoDS_Edge& theEdge1, TopoDS_Edge& theEdge2);
57
58 private:
59   //! private methods
60   void fillPoint(GEOMImpl_Fillet1dPoint*);
61   void fillDiff(GEOMImpl_Fillet1dPoint*, Standard_Real, Standard_Boolean);
62   void performNewton(GEOMImpl_Fillet1dPoint*, GEOMImpl_Fillet1dPoint*);
63   Standard_Boolean processPoint(GEOMImpl_Fillet1dPoint*, GEOMImpl_Fillet1dPoint*, Standard_Real);
64
65 private:
66   //! private fields
67   TopoDS_Edge myEdge1, myEdge2;
68   Handle(Geom_Plane) myPlane;
69   Handle(Geom2d_Curve) myCurve1, myCurve2;
70   Standard_Real myStart1, myEnd1, myStart2, myEnd2, myRadius;
71   TColStd_ListOfReal myResultParams;
72   TColStd_SequenceOfInteger myResultOrientation;
73   Standard_Boolean myStartSide, myEdgesExchnged;
74   Standard_Integer myDegreeOfRecursion;
75 };
76
77
78 /**
79 * GEOMImpl_Fillet1dPoint is an internal class for 1D fillet algorithm
80 *   to store and compare computed solutions on edges
81 */
82
83 class GEOMImpl_Fillet1dPoint
84 {
85 public:
86   //! Puiblic methods
87
88   //! Constructor
89   Standard_EXPORT GEOMImpl_Fillet1dPoint(Standard_Real theParam)
90   {myParam = theParam;}
91
92   //! Make copy of point
93   //!WARNING: Copies only field values: myParam, myV, myD, myValid
94   Standard_EXPORT GEOMImpl_Fillet1dPoint* Copy(); // warning: this is not the full copy!
95
96   //! Set/Get parameter
97   Standard_EXPORT inline void SetParam(Standard_Real theParam)
98     {myParam = theParam;}
99   Standard_EXPORT inline Standard_Real GetParam() const
100     {return myParam;}
101   Standard_EXPORT inline void SetParam2(const Standard_Real theParam2)
102     {myParam2 = theParam2;}
103   Standard_EXPORT inline Standard_Real GetParam2()
104     { return myParam2 ; }
105
106   //! Returns validity
107   Standard_EXPORT inline Standard_Boolean IsValid(int theIndex)
108     {return (Standard_Boolean)myValid.Value(theIndex);}
109
110   //! Get values
111   Standard_EXPORT inline Standard_Integer GetNBValues() {return myV.Length();}
112   Standard_EXPORT inline Standard_Real GetValue(Standard_Integer theIndex)
113     {return myV.Value(theIndex);}
114   Standard_EXPORT inline Standard_Real GetDiff(Standard_Integer theIndex)
115     {return myD.Value(theIndex);}
116   Standard_EXPORT inline Standard_Integer GetNear(Standard_Integer theIndex)
117     {return myNear.Value(theIndex);}
118
119   //! Set/Get center point
120   Standard_EXPORT inline void SetCenter(const gp_Pnt2d thePoint)
121     {myCenter = thePoint;}
122   Standard_EXPORT inline const gp_Pnt2d GetCenter()
123     {return myCenter;}
124
125   Standard_EXPORT void AddValue(Standard_Real theValue, Standard_Boolean theIsValid);
126
127   //! compute difference between this and given point
128   Standard_EXPORT Standard_Boolean ComputeDifference(GEOMImpl_Fillet1dPoint*);
129   Standard_EXPORT void FilterPoints(GEOMImpl_Fillet1dPoint*);
130
131   //! Checks if point contains solution and returns the index of it if any
132   Standard_EXPORT Standard_Integer HasSolution(Standard_Real theRadius);
133   //! Remove solution by index
134   void RemoveSolution(Standard_Integer theIndex);
135
136 private:
137   //! Private fields
138   gp_Pnt2d myCenter;
139   Standard_Real myParam, myParam2;
140   TColStd_SequenceOfReal myV, myD;
141   TColStd_SequenceOfInteger myValid, myNear;
142 };
143
144 #endif