0030675: Visualization - remove redundant proxy classes in hierarchy of PrsMgr_Presen...
[occt.git] / src / BOPTools / BOPTools_AlgoTools2D.hxx
1 // Created by: Peter KURNEV
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 //
4 // This file is part of Open CASCADE Technology software library.
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License version 2.1 as published
8 // by the Free Software Foundation, with special exception defined in the file
9 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10 // distribution for complete text of the license and disclaimer of any warranty.
11 //
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
14
15 #ifndef _BOPTools_AlgoTools2D_HeaderFile
16 #define _BOPTools_AlgoTools2D_HeaderFile
17
18 #include <Standard.hxx>
19 #include <Standard_DefineAlloc.hxx>
20 #include <Standard_Handle.hxx>
21
22 #include <Standard_Boolean.hxx>
23 #include <Standard_Real.hxx>
24 #include <Standard_Integer.hxx>
25 class TopoDS_Edge;
26 class TopoDS_Face;
27 class gp_Vec;
28 class Geom2d_Curve;
29 class Geom_Curve;
30 class BRepAdaptor_Surface;
31 class ProjLib_ProjectedCurve;
32 class IntTools_Context;
33
34
35
36 //! The class contains handy static functions
37 //! dealing with the topology
38 //! This is the copy of the BOPTools_AlgoTools2D.cdl
39 class BOPTools_AlgoTools2D 
40 {
41 public:
42
43   DEFINE_STANDARD_ALLOC
44
45   //! Compute P-Curve for the edge <aE> on the face <aF>.<br>
46   //! Raises exception Standard_ConstructionError if projection algorithm fails.<br>
47   //! <theContext> - storage for caching the geometrical tools
48   Standard_EXPORT static void BuildPCurveForEdgeOnFace(const TopoDS_Edge& aE,
49                                                        const TopoDS_Face& aF,
50                                                        const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
51
52   //! Compute tangent for the edge  <aE> [in 3D]  at parameter <aT>
53   Standard_EXPORT static Standard_Boolean EdgeTangent(const TopoDS_Edge& anE,
54                                                       const Standard_Real aT,
55                                                       gp_Vec& Tau);
56
57   //! Compute surface parameters <U,V> of the face <aF>
58   //! for  the point from the edge <aE> at parameter <aT>.<br>
59   //! If <aE> has't pcurve on surface, algorithm tries to get it by
60   //! projection and can
61   //! raise exception Standard_ConstructionError if projection algorithm fails.<br>
62   //! <theContext> - storage for caching the geometrical tools
63   Standard_EXPORT static void PointOnSurface(const TopoDS_Edge& aE,
64                                              const TopoDS_Face& aF,
65                                              const Standard_Real aT,
66                                              Standard_Real& U,
67                                              Standard_Real& V,
68                                              const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
69
70   //! Get P-Curve <aC>  for the edge <aE> on surface <aF> .<br>
71   //! If the P-Curve does not exist, build  it using Make2D().<br>
72   //! [aToler] - reached tolerance
73   //! Raises exception Standard_ConstructionError if algorithm Make2D() fails.<br>
74   //! <theContext> - storage for caching the geometrical tools
75   Standard_EXPORT static void CurveOnSurface(const TopoDS_Edge& aE,
76                                              const TopoDS_Face& aF,
77                                              Handle(Geom2d_Curve)& aC,
78                                              Standard_Real& aToler,
79                                              const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
80
81   //! Get P-Curve <aC>  for the edge <aE> on surface <aF> .<br>
82   //! If the P-Curve does not exist, build  it using Make2D().<br>
83   //! [aFirst, aLast] - range of the P-Curve<br>
84   //! [aToler] - reached tolerance<br>
85   //! Raises exception Standard_ConstructionError if algorithm Make2D() fails.<br>
86   //! <theContext> - storage for caching the geometrical tools
87   Standard_EXPORT static void CurveOnSurface(const TopoDS_Edge& aE,
88                                              const TopoDS_Face& aF,
89                                              Handle(Geom2d_Curve)& aC,
90                                              Standard_Real& aFirst,
91                                              Standard_Real& aLast,
92                                              Standard_Real& aToler,
93                                              const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
94
95   //! Returns TRUE if the edge <aE>  has  P-Curve <aC>
96   //! on surface <aF> .
97   //! [aFirst, aLast] - range of the P-Curve
98   //! [aToler] - reached tolerance
99   //! If the P-Curve does not exist, aC.IsNull()=TRUE.
100   Standard_EXPORT static Standard_Boolean HasCurveOnSurface(const TopoDS_Edge& aE,
101                                                             const TopoDS_Face& aF,
102                                                             Handle(Geom2d_Curve)& aC,
103                                                             Standard_Real& aFirst,
104                                                             Standard_Real& aLast,
105                                                             Standard_Real& aToler);
106
107   //! Returns TRUE if the edge <aE>  has  P-Curve <aC>
108   //! on surface <aF> .
109   //! If the P-Curve does not exist, aC.IsNull()=TRUE.
110   Standard_EXPORT static Standard_Boolean HasCurveOnSurface(const TopoDS_Edge& aE,
111                                                             const TopoDS_Face& aF);
112
113   //! Adjust P-Curve <theC2D> (3D-curve <theC3D>) on surface of the face <theF>.<br>
114   //! <theContext> - storage for caching the geometrical tools
115   Standard_EXPORT static void AdjustPCurveOnFace(const TopoDS_Face& theF,
116                                                  const Handle(Geom_Curve)& theC3D,
117                                                  const Handle(Geom2d_Curve)& theC2D,
118                                                  Handle(Geom2d_Curve)& theC2DA,
119                                                  const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
120
121   //! Adjust P-Curve <aC2D> (3D-curve <C3D>) on surface <aF> .<br>
122   //! [aT1,  aT2] - range to adjust<br>
123   //! <theContext> - storage for caching the geometrical tools
124   Standard_EXPORT static void AdjustPCurveOnFace(const TopoDS_Face& theF,
125                                                  const Standard_Real theFirst,
126                                                  const Standard_Real theLast,
127                                                  const Handle(Geom2d_Curve)& theC2D,
128                                                  Handle(Geom2d_Curve)& theC2DA,
129                                                  const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
130
131   //! Adjust P-Curve <aC2D> (3D-curve <C3D>) on surface <aF> .
132   //! [aT1,  aT2] - range to adjust
133   Standard_EXPORT static void AdjustPCurveOnSurf(const BRepAdaptor_Surface& aF,
134                                                  const Standard_Real aT1,
135                                                  const Standard_Real aT2,
136                                                  const Handle(Geom2d_Curve)& aC2D,
137                                                  Handle(Geom2d_Curve)& aC2DA);
138
139   //! Compute intermediate  value in  between [aFirst, aLast] .
140   Standard_EXPORT static Standard_Real IntermediatePoint(const Standard_Real aFirst,
141                                                          const Standard_Real aLast);
142
143   //! Compute intermediate value of parameter for the edge <anE>.
144   Standard_EXPORT static Standard_Real IntermediatePoint(const TopoDS_Edge& anE);
145
146   //! Make P-Curve <aC> for the edge <aE> on surface <aF> .<br>
147   //! [aFirst, aLast] - range of the P-Curve<br>
148   //! [aToler] - reached tolerance<br>
149   //! Raises exception Standard_ConstructionError if algorithm fails.<br>
150   //! <theContext> - storage for caching the geometrical tools
151   Standard_EXPORT static void Make2D(const TopoDS_Edge& aE,
152                                      const TopoDS_Face& aF,
153                                      Handle(Geom2d_Curve)& aC,
154                                      Standard_Real& aFirst,
155                                      Standard_Real& aLast,
156                                      Standard_Real& aToler,
157                                      const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
158
159   //! Make P-Curve <aC> for the 3D-curve <C3D> on surface <aF> .<br>
160   //! [aToler] - reached tolerance<br>
161   //! Raises exception Standard_ConstructionError if projection algorithm fails.<br>
162   //! <theContext> - storage for caching the geometrical tools
163   Standard_EXPORT static void MakePCurveOnFace(const TopoDS_Face& aF,
164                                                const Handle(Geom_Curve)& C3D,
165                                                Handle(Geom2d_Curve)& aC,
166                                                Standard_Real& aToler,
167                                                const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
168
169   //! Make P-Curve <aC> for the 3D-curve <C3D> on surface <aF> .<br>
170   //! [aT1,  aT2] - range to build<br>
171   //! [aToler] - reached tolerance<br>
172   //! Raises exception Standard_ConstructionError if projection algorithm fails.<br>
173   //! <theContext> - storage for caching the geometrical tools
174   Standard_EXPORT static void MakePCurveOnFace(const TopoDS_Face& aF,
175                                                const Handle(Geom_Curve)& C3D,
176                                                const Standard_Real aT1,
177                                                const Standard_Real aT2,
178                                                Handle(Geom2d_Curve)& aC,
179                                                Standard_Real& aToler,
180                                                const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
181
182   //! Attach P-Curve from the edge <aEold> on surface <aF>
183   //! to the edge <aEnew>
184   //! Returns 0 in case of success
185   Standard_EXPORT static Standard_Integer AttachExistingPCurve(const TopoDS_Edge& aEold,
186                                                                const TopoDS_Edge& aEnew,
187                                                                const TopoDS_Face& aF,
188                                                                const Handle(IntTools_Context)& aCtx);
189
190   //! Checks if CurveOnSurface of theE on theF matches with isoline of theF surface.
191   //! Sets corresponding values for isTheUIso and isTheVIso variables.
192   //! ATTENTION!!!
193   //!     This method is based on comparation between direction of
194   //!   surface (which theF is based on) iso-lines and the direction
195   //!   of the edge p-curve (on theF) in middle-point of the p-curve.
196   //!     This method should be used carefully
197   //!   (e.g. BRep_Tool::IsClosed(...) together) in order to
198   //!   avoid false classification some p-curves as isoline (e.g. circle
199   //!   on a plane).
200   Standard_EXPORT static void IsEdgeIsoline(const TopoDS_Edge& theE,
201                                             const TopoDS_Face& theF,
202                                             Standard_Boolean& isTheUIso,
203                                             Standard_Boolean& isTheVIso);
204
205 };
206
207 #endif // _BOPTools_AlgoTools2D_HeaderFile