Salome HOME
Fix hang-up when displaying sphere in OCC viewer
[modules/geom.git] / src / GEOMImpl / GEOMImpl_Fillet1d.hxx
1 //  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE\r
2 //\r
3 //  This library is free software; you can redistribute it and/or\r
4 //  modify it under the terms of the GNU Lesser General Public\r
5 //  License as published by the Free Software Foundation; either\r
6 //  version 2.1 of the License.\r
7 //\r
8 //  This library is distributed in the hope that it will be useful,\r
9 //  but WITHOUT ANY WARRANTY; without even the implied warranty of\r
10 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
11 //  Lesser General Public License for more details.\r
12 //\r
13 //  You should have received a copy of the GNU Lesser General Public\r
14 //  License along with this library; if not, write to the Free Software\r
15 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA\r
16 //\r
17 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com\r
18 //\r
19 \r
20 //  File   : GEOMImpl_Fillet1d.hxx\r
21 //  Module : GEOMImpl\r
22 //\r
23 #ifndef _GEOMImpl_Fillet1d_HeaderFile\r
24 #define _GEOMImpl_Fillet1d_HeaderFile\r
25 \r
26 #include <gp_Pnt.hxx>\r
27 #include <Geom_Plane.hxx>\r
28 #include <Geom2d_Curve.hxx>\r
29 \r
30 #include <TopoDS_Edge.hxx>\r
31 #include <TColStd_ListOfReal.hxx>\r
32 #include <TColStd_SequenceOfReal.hxx>\r
33 #include <TColStd_SequenceOfInteger.hxx>\r
34 \r
35 class GEOMImpl_Fillet1dPoint;\r
36 \r
37 /**\r
38 * GEOMImpl_Fillet1d is 1D fillet algorithm on two planar edges with given radius\r
39 */\r
40 \r
41 class GEOMImpl_Fillet1d \r
42 {\r
43 public:\r
44   //! Constructor\r
45   //! The fillet 1D algorithm initialise by two edges and plane\r
46   Standard_EXPORT GEOMImpl_Fillet1d(const TopoDS_Edge& theEdge1,\r
47                                     const TopoDS_Edge& theEdge2,\r
48                                     const gp_Pln&      thePlane);\r
49   //! Makes fillet with given radius\r
50   //! @returns Standard_True, if at least one result computed\r
51   Standard_EXPORT Standard_Boolean Perform(const Standard_Real theRadius);\r
52   //! Returns result fillet edge and modified edges as out parameters\r
53   Standard_EXPORT TopoDS_Edge Result(const gp_Pnt& thePoint, TopoDS_Edge& theEdge1, TopoDS_Edge& theEdge2);\r
54 \r
55 private:\r
56   //! private methods\r
57   void fillPoint(GEOMImpl_Fillet1dPoint*);\r
58   void fillDiff(GEOMImpl_Fillet1dPoint*, Standard_Real, Standard_Boolean);\r
59   void performNewton(GEOMImpl_Fillet1dPoint*, GEOMImpl_Fillet1dPoint*);\r
60   Standard_Boolean processPoint(GEOMImpl_Fillet1dPoint*, GEOMImpl_Fillet1dPoint*, Standard_Real);\r
61 \r
62 \r
63 private:\r
64   //! private fields\r
65   TopoDS_Edge myEdge1, myEdge2;\r
66   Handle(Geom_Plane) myPlane;\r
67   Handle(Geom2d_Curve) myCurve1, myCurve2;\r
68   Standard_Real myStart1, myEnd1, myStart2, myEnd2, myRadius;\r
69   TColStd_ListOfReal myResultParams;\r
70   TColStd_SequenceOfInteger myResultOrientation;\r
71   Standard_Boolean myStartSide, myEdgesExchnged;\r
72   Standard_Integer myDegreeOfRecursion;\r
73 };\r
74 \r
75 \r
76 /**\r
77 * GEOMImpl_Fillet1dPoint is an internal class for 1D fillet algorithm\r
78 *   to store and compare computed solutions on edges\r
79 */\r
80 \r
81 class GEOMImpl_Fillet1dPoint\r
82 {\r
83 public:\r
84   //! Puiblic methods\r
85 \r
86   //! Constructor\r
87   Standard_EXPORT GEOMImpl_Fillet1dPoint(Standard_Real theParam)\r
88   {myParam = theParam;}\r
89   \r
90   //! Make copy of point\r
91   //!WARNING: Copies only field values: myParam, myV, myD, myValid\r
92   Standard_EXPORT GEOMImpl_Fillet1dPoint* Copy(); // warning: this is not the full copy! \r
93 \r
94   //! Set/Get parameter\r
95   Standard_EXPORT inline void SetParam(Standard_Real theParam)\r
96     {myParam = theParam;}\r
97   Standard_EXPORT inline Standard_Real GetParam() const\r
98     {return myParam;}\r
99   Standard_EXPORT inline void SetParam2(const Standard_Real theParam2)\r
100     {myParam2 = theParam2;}\r
101   Standard_EXPORT inline Standard_Real GetParam2()\r
102     { return myParam2 ; }\r
103 \r
104   //! Returns validity  \r
105   Standard_EXPORT inline Standard_Boolean IsValid(int theIndex)\r
106     {return (Standard_Boolean)myValid.Value(theIndex);}\r
107 \r
108   //! Get values\r
109   Standard_EXPORT inline Standard_Integer GetNBValues() {return myV.Length();}\r
110   Standard_EXPORT inline Standard_Real GetValue(Standard_Integer theIndex)\r
111     {return myV.Value(theIndex);}\r
112   Standard_EXPORT inline Standard_Real GetDiff(Standard_Integer theIndex)\r
113     {return myD.Value(theIndex);}\r
114   Standard_EXPORT inline Standard_Integer GetNear(Standard_Integer theIndex)\r
115     {return myNear.Value(theIndex);}\r
116 \r
117   //! Set/Get center point\r
118   Standard_EXPORT inline void SetCenter(const gp_Pnt2d thePoint)\r
119     {myCenter = thePoint;}\r
120   Standard_EXPORT inline const gp_Pnt2d GetCenter()\r
121     {return myCenter;}\r
122 \r
123   Standard_EXPORT void AddValue(Standard_Real theValue, Standard_Boolean theIsValid);\r
124 \r
125   //! compute difference between this and given point\r
126   Standard_EXPORT Standard_Boolean ComputeDifference(GEOMImpl_Fillet1dPoint*);\r
127   Standard_EXPORT void FilterPoints(GEOMImpl_Fillet1dPoint*);\r
128   \r
129   //! Check is point contains solution and  returns the index of them if any\r
130   Standard_EXPORT Standard_Integer HasSolution(Standard_Real theRadius); \r
131   //! Remove solution by index\r
132   void RemoveSolution(Standard_Integer theIndex);\r
133 \r
134 private:\r
135   //! Private fields\r
136   gp_Pnt2d myCenter;\r
137   Standard_Real myParam, myParam2;\r
138   TColStd_SequenceOfReal myV, myD;\r
139   TColStd_SequenceOfInteger myValid, myNear;\r
140 };\r
141 \r
142 #endif\r