42cf5bc1 |
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 <BOPCol_ListOfShape.hxx> |
25 | #include <Standard_Integer.hxx> |
26 | class TopoDS_Edge; |
27 | class TopoDS_Face; |
28 | class gp_Vec; |
29 | class Geom2d_Curve; |
30 | class Geom_Curve; |
31 | class BRepAdaptor_Surface; |
32 | class ProjLib_ProjectedCurve; |
33 | class IntTools_Context; |
34 | |
35 | |
36 | |
37 | //! The class contains handy static functions |
38 | //! dealing with the topology |
39 | //! This is the copy of the BOPTools_AlgoTools2D.cdl |
40 | class BOPTools_AlgoTools2D |
41 | { |
42 | public: |
43 | |
44 | DEFINE_STANDARD_ALLOC |
45 | |
46 | |
47 | |
48 | //! Compute P-Curve for the edge <aE> on the face <aF> |
49 | //! Raises exception Standard_ConstructionError if projection algorithm fails |
50 | Standard_EXPORT static void BuildPCurveForEdgeOnFace (const TopoDS_Edge& aE, const TopoDS_Face& aF); |
51 | |
52 | |
53 | //! Compute tangent for the edge <aE> [in 3D] at parameter <aT> |
54 | Standard_EXPORT static Standard_Boolean EdgeTangent (const TopoDS_Edge& anE, const Standard_Real aT, gp_Vec& Tau); |
55 | |
56 | |
57 | //! Compute surface parameters <U,V> of the face <aF> |
58 | //! for the point from the edge <aE> at parameter <aT>. |
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 |
62 | Standard_EXPORT static void PointOnSurface (const TopoDS_Edge& aE, const TopoDS_Face& aF, const Standard_Real aT, Standard_Real& U, Standard_Real& V); |
63 | |
64 | |
65 | //! Get P-Curve <aC> for the edge <aE> on surface <aF> . |
66 | //! If the P-Curve does not exist, build it using Make2D(). |
67 | //! [aToler] - reached tolerance |
68 | //! Raises exception Standard_ConstructionError if algorithm Make2D() fails |
69 | Standard_EXPORT static void CurveOnSurface (const TopoDS_Edge& aE, const TopoDS_Face& aF, Handle(Geom2d_Curve)& aC, Standard_Real& aToler); |
70 | |
71 | |
72 | //! Get P-Curve <aC> for the edge <aE> on surface <aF> . |
73 | //! If the P-Curve does not exist, build it using Make2D(). |
74 | //! [aFirst, aLast] - range of the P-Curve |
75 | //! [aToler] - reached tolerance |
76 | //! Raises exception Standard_ConstructionError if algorithm Make2D() fails |
77 | Standard_EXPORT static void CurveOnSurface (const TopoDS_Edge& aE, const TopoDS_Face& aF, Handle(Geom2d_Curve)& aC, Standard_Real& aFirst, Standard_Real& aLast, Standard_Real& aToler); |
78 | |
79 | |
80 | //! Returns TRUE if the edge <aE> has P-Curve <aC> |
81 | //! on surface <aF> . |
82 | //! [aFirst, aLast] - range of the P-Curve |
83 | //! [aToler] - reached tolerance |
84 | //! If the P-Curve does not exist, aC.IsNull()=TRUE. |
85 | Standard_EXPORT static Standard_Boolean HasCurveOnSurface (const TopoDS_Edge& aE, const TopoDS_Face& aF, Handle(Geom2d_Curve)& aC, Standard_Real& aFirst, Standard_Real& aLast, Standard_Real& aToler); |
86 | |
87 | |
88 | //! Returns TRUE if the edge <aE> has P-Curve <aC> |
89 | //! on surface <aF> . |
90 | //! If the P-Curve does not exist, aC.IsNull()=TRUE. |
91 | Standard_EXPORT static Standard_Boolean HasCurveOnSurface (const TopoDS_Edge& aE, const TopoDS_Face& aF); |
92 | |
93 | |
94 | //! Adjust P-Curve <aC2D> (3D-curve <C3D>) on surface <aF> . |
95 | Standard_EXPORT static void AdjustPCurveOnFace (const TopoDS_Face& aF, const Handle(Geom_Curve)& C3D, const Handle(Geom2d_Curve)& aC2D, Handle(Geom2d_Curve)& aC2DA); |
96 | |
97 | |
98 | //! Adjust P-Curve <aC2D> (3D-curve <C3D>) on surface <aF> . |
99 | //! [aT1, aT2] - range to adjust |
100 | Standard_EXPORT static void AdjustPCurveOnFace (const TopoDS_Face& aF, const Standard_Real aT1, const Standard_Real aT2, const Handle(Geom2d_Curve)& aC2D, Handle(Geom2d_Curve)& aC2DA); |
101 | |
102 | |
103 | //! Adjust P-Curve <aC2D> (3D-curve <C3D>) on surface <aF> . |
104 | //! [aT1, aT2] - range to adjust |
105 | Standard_EXPORT static void AdjustPCurveOnFace (const BRepAdaptor_Surface& aF, const Standard_Real aT1, const Standard_Real aT2, const Handle(Geom2d_Curve)& aC2D, Handle(Geom2d_Curve)& aC2DA); |
106 | |
107 | |
108 | //! Compute intermediate value in between [aFirst, aLast] . |
109 | Standard_EXPORT static Standard_Real IntermediatePoint (const Standard_Real aFirst, const Standard_Real aLast); |
110 | |
111 | |
112 | //! Compute intermediate value of parameter for the edge <anE>. |
113 | Standard_EXPORT static Standard_Real IntermediatePoint (const TopoDS_Edge& anE); |
114 | |
115 | Standard_EXPORT static void BuildPCurveForEdgeOnPlane (const TopoDS_Edge& theE, const TopoDS_Face& theF); |
116 | |
117 | Standard_EXPORT static void BuildPCurveForEdgesOnPlane (const BOPCol_ListOfShape& theLE, const TopoDS_Face& theF); |
118 | |
119 | |
120 | //! Make P-Curve <aC> for the edge <aE> on surface <aF> . |
121 | //! [aFirst, aLast] - range of the P-Curve |
122 | //! [aToler] - reached tolerance |
123 | //! Raises exception Standard_ConstructionError if algorithm fails |
124 | Standard_EXPORT static void Make2D (const TopoDS_Edge& aE, const TopoDS_Face& aF, Handle(Geom2d_Curve)& aC, Standard_Real& aFirst, Standard_Real& aLast, Standard_Real& aToler); |
125 | |
126 | |
127 | //! Make P-Curve <aC> for the 3D-curve <C3D> on surface <aF> . |
128 | //! [aToler] - reached tolerance |
129 | //! Raises exception Standard_ConstructionError if projection algorithm fails |
130 | Standard_EXPORT static void MakePCurveOnFace (const TopoDS_Face& aF, const Handle(Geom_Curve)& C3D, Handle(Geom2d_Curve)& aC, Standard_Real& aToler); |
131 | |
132 | |
133 | //! Make P-Curve <aC> for the 3D-curve <C3D> on surface <aF> . |
134 | //! [aT1, aT2] - range to build |
135 | //! [aToler] - reached tolerance |
136 | //! Raises exception Standard_ConstructionError if projection algorithm fails |
137 | Standard_EXPORT static void MakePCurveOnFace (const TopoDS_Face& aF, const Handle(Geom_Curve)& C3D, const Standard_Real aT1, const Standard_Real aT2, Handle(Geom2d_Curve)& aC, Standard_Real& aToler); |
138 | |
139 | |
140 | //! Make empty P-Curve <aC> of relevant to <PC> type |
141 | Standard_EXPORT static void MakePCurveOfType (const ProjLib_ProjectedCurve& PC, Handle(Geom2d_Curve)& aC); |
142 | |
143 | |
144 | //! Attach P-Curve from the edge <aEold> on surface <aF> |
145 | //! to the edge <aEnew> |
146 | //! Returns 0 in case of success |
147 | Standard_EXPORT static Standard_Integer AttachExistingPCurve (const TopoDS_Edge& aEold, const TopoDS_Edge& aEnew, const TopoDS_Face& aF, const Handle(IntTools_Context)& aCtx); |
148 | |
149 | |
150 | |
151 | |
152 | protected: |
153 | |
154 | |
155 | |
156 | |
157 | |
158 | private: |
159 | |
160 | |
161 | |
162 | |
163 | |
164 | }; |
165 | |
166 | |
167 | |
168 | |
169 | |
170 | |
171 | |
172 | #endif // _BOPTools_AlgoTools2D_HeaderFile |