0027035: General fuse algorithm loses face
[occt.git] / src / BOPTools / BOPTools_AlgoTools2D.hxx
CommitLineData
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>
26class TopoDS_Edge;
27class TopoDS_Face;
28class gp_Vec;
29class Geom2d_Curve;
30class Geom_Curve;
31class BRepAdaptor_Surface;
32class ProjLib_ProjectedCurve;
33class 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
40class BOPTools_AlgoTools2D
41{
42public:
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
2078dfc7 115 //! Build pcurve of edge on face if the surface is plane, and update the edge.
42cf5bc1 116 Standard_EXPORT static void BuildPCurveForEdgeOnPlane (const TopoDS_Edge& theE, const TopoDS_Face& theF);
117
2078dfc7 118 //! Build pcurve of edge on face if the surface is plane, but do not update the edge.
119 //! The output are the pcurve and the flag telling that pcurve was built.
120 Standard_EXPORT static void BuildPCurveForEdgeOnPlane (const TopoDS_Edge& theE, const TopoDS_Face& theF,
121 Handle(Geom2d_Curve)& aC2D, Standard_Boolean& bToUpdate);
122
42cf5bc1 123 Standard_EXPORT static void BuildPCurveForEdgesOnPlane (const BOPCol_ListOfShape& theLE, const TopoDS_Face& theF);
124
125
126 //! Make P-Curve <aC> for the edge <aE> on surface <aF> .
127 //! [aFirst, aLast] - range of the P-Curve
128 //! [aToler] - reached tolerance
129 //! Raises exception Standard_ConstructionError if algorithm fails
130 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);
131
132
133 //! Make P-Curve <aC> for the 3D-curve <C3D> on surface <aF> .
134 //! [aToler] - reached tolerance
135 //! Raises exception Standard_ConstructionError if projection algorithm fails
136 Standard_EXPORT static void MakePCurveOnFace (const TopoDS_Face& aF, const Handle(Geom_Curve)& C3D, Handle(Geom2d_Curve)& aC, Standard_Real& aToler);
137
138
139 //! Make P-Curve <aC> for the 3D-curve <C3D> on surface <aF> .
140 //! [aT1, aT2] - range to build
141 //! [aToler] - reached tolerance
142 //! Raises exception Standard_ConstructionError if projection algorithm fails
143 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);
144
145
146 //! Make empty P-Curve <aC> of relevant to <PC> type
147 Standard_EXPORT static void MakePCurveOfType (const ProjLib_ProjectedCurve& PC, Handle(Geom2d_Curve)& aC);
148
149
150 //! Attach P-Curve from the edge <aEold> on surface <aF>
151 //! to the edge <aEnew>
152 //! Returns 0 in case of success
153 Standard_EXPORT static Standard_Integer AttachExistingPCurve (const TopoDS_Edge& aEold, const TopoDS_Edge& aEnew, const TopoDS_Face& aF, const Handle(IntTools_Context)& aCtx);
154
39067947 155 //! Checks if CurveOnSurface of theE on theF matches with isoline of theF surface.
156 //! Sets corresponding values for isTheUIso and isTheVIso variables.
157 //! ATTENTION!!!
158 //! This method is based on comparation between direction of
159 //! surface (which theF is based on) iso-lines and the direction
160 //! of the edge p-curve (on theF) in middle-point of the p-curve.
161 //! This method should be used carefully
162 //! (e.g. BRep_Tool::IsClosed(...) together) in order to
163 //! avoid false classification some p-curves as isoline (e.g. circle
164 //! on a plane).
165 Standard_EXPORT static void IsEdgeIsoline(const TopoDS_Edge& theE,
166 const TopoDS_Face& theF,
167 Standard_Boolean& isTheUIso,
168 Standard_Boolean& isTheVIso);
42cf5bc1 169
170
171protected:
172
173
174
175
176
177private:
178
179
180
181
182
183};
184
185
186
187
188
189
190
191#endif // _BOPTools_AlgoTools2D_HeaderFile