1 // Created by: Peter KURNEV
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 // This file is part of Open CASCADE Technology software library.
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.
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
15 #ifndef _BOPTools_AlgoTools2D_HeaderFile
16 #define _BOPTools_AlgoTools2D_HeaderFile
18 #include <Standard.hxx>
19 #include <Standard_DefineAlloc.hxx>
20 #include <Standard_Handle.hxx>
22 #include <Standard_Boolean.hxx>
23 #include <Standard_Real.hxx>
24 #include <BOPCol_ListOfShape.hxx>
25 #include <Standard_Integer.hxx>
31 class BRepAdaptor_Surface;
32 class ProjLib_ProjectedCurve;
33 class IntTools_Context;
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
48 //! Compute P-Curve for the edge <aE> on the face <aF>.<br>
49 //! Raises exception Standard_ConstructionError if projection algorithm fails.<br>
50 //! <theContext> - storage for caching the geometrical tools
51 Standard_EXPORT static void BuildPCurveForEdgeOnFace (const TopoDS_Edge& aE,
52 const TopoDS_Face& aF,
53 const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
56 //! Compute tangent for the edge <aE> [in 3D] at parameter <aT>
57 Standard_EXPORT static Standard_Boolean EdgeTangent (const TopoDS_Edge& anE, const Standard_Real aT, gp_Vec& Tau);
60 //! Compute surface parameters <U,V> of the face <aF>
61 //! for the point from the edge <aE> at parameter <aT>.<br>
62 //! If <aE> has't pcurve on surface, algorithm tries to get it by
63 //! projection and can
64 //! raise exception Standard_ConstructionError if projection algorithm fails.<br>
65 //! <theContext> - storage for caching the geometrical tools
66 Standard_EXPORT static void PointOnSurface (const TopoDS_Edge& aE,
67 const TopoDS_Face& aF,
68 const Standard_Real aT,
71 const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
74 //! Get P-Curve <aC> for the edge <aE> on surface <aF> .<br>
75 //! If the P-Curve does not exist, build it using Make2D().<br>
76 //! [aToler] - reached tolerance
77 //! Raises exception Standard_ConstructionError if algorithm Make2D() fails.<br>
78 //! <theContext> - storage for caching the geometrical tools
79 Standard_EXPORT static void CurveOnSurface (const TopoDS_Edge& aE,
80 const TopoDS_Face& aF,
81 Handle(Geom2d_Curve)& aC,
82 Standard_Real& aToler,
83 const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
85 //! Get P-Curve <aC> for the edge <aE> on surface <aF> .<br>
86 //! If the P-Curve does not exist, build it using Make2D().<br>
87 //! [aFirst, aLast] - range of the P-Curve<br>
88 //! [aToler] - reached tolerance<br>
89 //! Raises exception Standard_ConstructionError if algorithm Make2D() fails.<br>
90 //! <theContext> - storage for caching the geometrical tools
91 Standard_EXPORT static void CurveOnSurface (const TopoDS_Edge& aE,
92 const TopoDS_Face& aF,
93 Handle(Geom2d_Curve)& aC,
94 Standard_Real& aFirst,
96 Standard_Real& aToler,
97 const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
100 //! Returns TRUE if the edge <aE> has P-Curve <aC>
101 //! on surface <aF> .
102 //! [aFirst, aLast] - range of the P-Curve
103 //! [aToler] - reached tolerance
104 //! If the P-Curve does not exist, aC.IsNull()=TRUE.
105 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);
108 //! Returns TRUE if the edge <aE> has P-Curve <aC>
109 //! on surface <aF> .
110 //! If the P-Curve does not exist, aC.IsNull()=TRUE.
111 Standard_EXPORT static Standard_Boolean HasCurveOnSurface (const TopoDS_Edge& aE, const TopoDS_Face& aF);
114 //! Adjust P-Curve <theC2D> (3D-curve <theC3D>) on surface of the face <theF>.<br>
115 //! <theContext> - storage for caching the geometrical tools
116 Standard_EXPORT static void AdjustPCurveOnFace (const TopoDS_Face& theF,
117 const Handle(Geom_Curve)& theC3D,
118 const Handle(Geom2d_Curve)& theC2D,
119 Handle(Geom2d_Curve)& theC2DA,
120 const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
123 //! Adjust P-Curve <aC2D> (3D-curve <C3D>) on surface <aF> .<br>
124 //! [aT1, aT2] - range to adjust<br>
125 //! <theContext> - storage for caching the geometrical tools
126 Standard_EXPORT static void AdjustPCurveOnFace (const TopoDS_Face& theF,
127 const Standard_Real theFirst,
128 const Standard_Real theLast,
129 const Handle(Geom2d_Curve)& theC2D,
130 Handle(Geom2d_Curve)& theC2DA,
131 const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
133 //! Adjust P-Curve <aC2D> (3D-curve <C3D>) on surface <aF> .
134 //! [aT1, aT2] - range to adjust
135 Standard_EXPORT static void AdjustPCurveOnSurf (const BRepAdaptor_Surface& aF, const Standard_Real aT1, const Standard_Real aT2, const Handle(Geom2d_Curve)& aC2D, Handle(Geom2d_Curve)& aC2DA);
138 //! Compute intermediate value in between [aFirst, aLast] .
139 Standard_EXPORT static Standard_Real IntermediatePoint (const Standard_Real aFirst, const Standard_Real aLast);
142 //! Compute intermediate value of parameter for the edge <anE>.
143 Standard_EXPORT static Standard_Real IntermediatePoint (const TopoDS_Edge& anE);
145 //! Make P-Curve <aC> for the edge <aE> on surface <aF> .<br>
146 //! [aFirst, aLast] - range of the P-Curve<br>
147 //! [aToler] - reached tolerance<br>
148 //! Raises exception Standard_ConstructionError if algorithm fails.<br>
149 //! <theContext> - storage for caching the geometrical tools
150 Standard_EXPORT static void Make2D (const TopoDS_Edge& aE,
151 const TopoDS_Face& aF,
152 Handle(Geom2d_Curve)& aC,
153 Standard_Real& aFirst,
154 Standard_Real& aLast,
155 Standard_Real& aToler,
156 const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
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)());
170 //! Make P-Curve <aC> for the 3D-curve <C3D> on surface <aF> .<br>
171 //! [aT1, aT2] - range to build<br>
172 //! [aToler] - reached tolerance<br>
173 //! Raises exception Standard_ConstructionError if projection algorithm fails.<br>
174 //! <theContext> - storage for caching the geometrical tools
175 Standard_EXPORT static void MakePCurveOnFace (const TopoDS_Face& aF,
176 const Handle(Geom_Curve)& C3D,
177 const Standard_Real aT1,
178 const Standard_Real aT2,
179 Handle(Geom2d_Curve)& aC,
180 Standard_Real& aToler,
181 const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
183 //! Attach P-Curve from the edge <aEold> on surface <aF>
184 //! to the edge <aEnew>
185 //! Returns 0 in case of success
186 Standard_EXPORT static Standard_Integer AttachExistingPCurve (const TopoDS_Edge& aEold, const TopoDS_Edge& aEnew, const TopoDS_Face& aF, const Handle(IntTools_Context)& aCtx);
188 //! Checks if CurveOnSurface of theE on theF matches with isoline of theF surface.
189 //! Sets corresponding values for isTheUIso and isTheVIso variables.
191 //! This method is based on comparation between direction of
192 //! surface (which theF is based on) iso-lines and the direction
193 //! of the edge p-curve (on theF) in middle-point of the p-curve.
194 //! This method should be used carefully
195 //! (e.g. BRep_Tool::IsClosed(...) together) in order to
196 //! avoid false classification some p-curves as isoline (e.g. circle
198 Standard_EXPORT static void IsEdgeIsoline(const TopoDS_Edge& theE,
199 const TopoDS_Face& theF,
200 Standard_Boolean& isTheUIso,
201 Standard_Boolean& isTheVIso);
224 #endif // _BOPTools_AlgoTools2D_HeaderFile