0027448: BOPTools_AlgoTools::IsMicroEdge does not correspond to shape validity criteria
[occt.git] / src / BRepLib / BRepLib.hxx
CommitLineData
42cf5bc1 1// Created on: 1993-12-15
2// Created by: Remi LEQUETTE
3// Copyright (c) 1993-1999 Matra Datavision
4// Copyright (c) 1999-2014 OPEN CASCADE SAS
5//
6// This file is part of Open CASCADE Technology software library.
7//
8// This library is free software; you can redistribute it and/or modify it under
9// the terms of the GNU Lesser General Public License version 2.1 as published
10// by the Free Software Foundation, with special exception defined in the file
11// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12// distribution for complete text of the license and disclaimer of any warranty.
13//
14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
16
17#ifndef _BRepLib_HeaderFile
18#define _BRepLib_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_DefineAlloc.hxx>
22#include <Standard_Handle.hxx>
23
24#include <Standard_Real.hxx>
25#include <Standard_Boolean.hxx>
26#include <GeomAbs_Shape.hxx>
27#include <Standard_Integer.hxx>
28#include <TopTools_ListOfShape.hxx>
29class Geom_Plane;
30class TopoDS_Edge;
31class TopoDS_Shape;
32class TopoDS_Solid;
33class TopoDS_Face;
34class BRepLib_Command;
35class BRepLib_MakeShape;
36class BRepLib_MakeVertex;
37class BRepLib_MakeEdge;
38class BRepLib_MakeEdge2d;
39class BRepLib_MakePolygon;
40class BRepLib_MakeFace;
41class BRepLib_MakeWire;
42class BRepLib_MakeShell;
43class BRepLib_MakeSolid;
44class BRepLib_FindSurface;
45class BRepLib_FuseEdges;
46class BRepLib_CheckCurveOnSurface;
47
48
49//! The BRepLib package provides general utilities for
50//! BRep.
51//!
52//! * FindSurface : Class to compute a surface through
53//! a set of edges.
54//!
55//! * Compute missing 3d curve on an edge.
56class BRepLib
57{
58public:
59
60 DEFINE_STANDARD_ALLOC
61
62
63
64 //! Computes the max distance between edge
65 //! and its 2d representation on the face.
66 //! Sets the default precision. The current Precision
67 //! is returned.
68 Standard_EXPORT static void Precision (const Standard_Real P);
69
70 //! Returns the default precision.
71 Standard_EXPORT static Standard_Real Precision();
72
73 //! Sets the current plane to P.
74 Standard_EXPORT static void Plane (const Handle(Geom_Plane)& P);
75
76 //! Returns the current plane.
77 Standard_EXPORT static const Handle(Geom_Plane)& Plane();
78
79 //! checks if the Edge is same range IGNORING
80 //! the same range flag of the edge
81 //! Confusion argument is to compare real numbers
82 //! idenpendently of any model space tolerance
83 Standard_EXPORT static Standard_Boolean CheckSameRange (const TopoDS_Edge& E, const Standard_Real Confusion = 1.0e-12);
84
85 //! will make all the curve representation have
86 //! the same range domain for the parameters.
87 //! This will IGNORE the same range flag value
88 //! to proceed.
89 //! If there is a 3D curve there it will the
90 //! range of that curve. If not the first curve representation
91 //! encountered in the list will give its range to
92 //! the all the other curves.
93 Standard_EXPORT static void SameRange (const TopoDS_Edge& E, const Standard_Real Tolerance = 1.0e-5);
94
95 //! Computes the 3d curve for the edge <E> if it does
96 //! not exist. Returns True if the curve was computed
97 //! or existed. Returns False if there is no planar
98 //! pcurve or the computation failed.
99 //! <MaxSegment> >= 30 in approximation
100 Standard_EXPORT static Standard_Boolean BuildCurve3d (const TopoDS_Edge& E, const Standard_Real Tolerance = 1.0e-5, const GeomAbs_Shape Continuity = GeomAbs_C1, const Standard_Integer MaxDegree = 14, const Standard_Integer MaxSegment = 0);
101
102 //! Computes the 3d curves for all the edges of <S>
103 //! return False if one of the computation failed.
104 //! <MaxSegment> >= 30 in approximation
105 Standard_EXPORT static Standard_Boolean BuildCurves3d (const TopoDS_Shape& S, const Standard_Real Tolerance, const GeomAbs_Shape Continuity = GeomAbs_C1, const Standard_Integer MaxDegree = 14, const Standard_Integer MaxSegment = 0);
106
107 //! Computes the 3d curves for all the edges of <S>
108 //! return False if one of the computation failed.
109 Standard_EXPORT static Standard_Boolean BuildCurves3d (const TopoDS_Shape& S);
110
111 //! Checks if the edge has a Tolerance smaller than -- --
112 //! -- -- MaxToleranceToCheck if so it will compute the
113 //! radius of -- the cylindrical pipe surface that
114 //! MinToleranceRequest is the minimum tolerance before it
115 //! is usefull to start testing. Usually it should be arround
116 //! 10e-5
117 //! contains all -- the curve represenation of the edge
118 //! returns True if the Edge tolerance had to be updated
119 Standard_EXPORT static Standard_Boolean UpdateEdgeTol (const TopoDS_Edge& E, const Standard_Real MinToleranceRequest, const Standard_Real MaxToleranceToCheck);
120
121 //! -- Checks all the edges of the shape whose -- -- --
122 //! Tolerance is smaller than MaxToleranceToCheck --
123 //! Returns True if at least one edge was updated --
124 //! MinToleranceRequest is the minimum tolerance before
125 //! -- it -- is usefull to start testing. Usually it
126 //! should be arround -- 10e-5--
127 //!
128 //! Warning :The method is very slow as it checks all.
129 //! Use only in interfaces or processing assimilate batch
130 Standard_EXPORT static Standard_Boolean UpdateEdgeTolerance (const TopoDS_Shape& S, const Standard_Real MinToleranceRequest, const Standard_Real MaxToleranceToCheck);
131
132 //! Computes new 2d curve(s) for the edge <E> to have
133 //! the same parameter as the 3d curve.
134 //! The algorithm is not done if the flag SameParameter
135 //! was True on the Edge.
136 Standard_EXPORT static void SameParameter (const TopoDS_Edge& E, const Standard_Real Tolerance = 1.0e-5);
137
138 //! Computes new 2d curve(s) for all the edges of <S>
139 //! to have the same parameter as the 3d curve.
140 //! The algorithm is not done if the flag SameParameter
141 //! was True on an Edge.
142 Standard_EXPORT static void SameParameter (const TopoDS_Shape& S, const Standard_Real Tolerance = 1.0e-5, const Standard_Boolean forced = Standard_False);
143
144 //! Replaces tolerance of FACE EDGE VERTEX by the
145 //! tolerance Max of their connected handling shapes.
146 //! It is not necessary to use this call after
147 //! SameParameter. (called in)
148 Standard_EXPORT static void UpdateTolerances (const TopoDS_Shape& S, const Standard_Boolean verifyFaceTolerance = Standard_False);
149
420f79f8 150 //! Checks tolerances of edges (including inner points) and vertices
151 //! of a shape and updates them to satisfy "SameParameter" condition
152 Standard_EXPORT static void UpdateInnerTolerances (const TopoDS_Shape& S);
153
42cf5bc1 154 //! Orients the solid forward and the shell with the
155 //! orientation to have matter in the solid. Returns
156 //! False if the solid is unOrientable (open or incoherent)
157 Standard_EXPORT static Standard_Boolean OrientClosedSolid (TopoDS_Solid& solid);
158
159 //! Encodes the Regularity of edges on a Shape.
160 //! Warning: <TolAng> is an angular tolerance, expressed in Rad.
161 //! Warning: If the edges's regularity are coded before, nothing
162 //! is done.
163 Standard_EXPORT static void EncodeRegularity (const TopoDS_Shape& S, const Standard_Real TolAng = 1.0e-10);
164
165 //! Encodes the Regularity beetween <F1> and <F2> by <E>
166 //! Warning: <TolAng> is an angular tolerance, expressed in Rad.
167 //! Warning: If the edge's regularity is coded before, nothing
168 //! is done.
169 Standard_EXPORT static void EncodeRegularity (TopoDS_Edge& S, const TopoDS_Face& F1, const TopoDS_Face& F2, const Standard_Real TolAng = 1.0e-10);
170
171 //! Sorts in LF the Faces of S on the complexity of
172 //! their surfaces
173 //! (Plane,Cylinder,Cone,Sphere,Torus,other)
174 Standard_EXPORT static void SortFaces (const TopoDS_Shape& S, TopTools_ListOfShape& LF);
175
176 //! Sorts in LF the Faces of S on the reverse
177 //! complexity of their surfaces
178 //! (other,Torus,Sphere,Cone,Cylinder,Plane)
179 Standard_EXPORT static void ReverseSortFaces (const TopoDS_Shape& S, TopTools_ListOfShape& LF);
180
181 //! Corrects the normals in Poly_Triangulation of faces,
182 //! in such way that normals at nodes lying along smooth
183 //! edges have the same value on both adjacent triangulations.
184 //! Returns TRUE if any correction is done.
185 Standard_EXPORT static Standard_Boolean EnsureNormalConsistency (const TopoDS_Shape& S, const Standard_Real theAngTol = 0.001, const Standard_Boolean ForceComputeNormals = Standard_False);
186
187
188
189
190protected:
191
192
193
194
195
196private:
197
198
199
200
201friend class BRepLib_Command;
202friend class BRepLib_MakeShape;
203friend class BRepLib_MakeVertex;
204friend class BRepLib_MakeEdge;
205friend class BRepLib_MakeEdge2d;
206friend class BRepLib_MakePolygon;
207friend class BRepLib_MakeFace;
208friend class BRepLib_MakeWire;
209friend class BRepLib_MakeShell;
210friend class BRepLib_MakeSolid;
211friend class BRepLib_FindSurface;
212friend class BRepLib_FuseEdges;
213friend class BRepLib_CheckCurveOnSurface;
214
215};
216
217
218
219
220
221
222
223#endif // _BRepLib_HeaderFile