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