0028643: Coding rules - eliminate GCC compiler warnings -Wmisleading-indentation
[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>
07ef8bdf 29#include <NCollection_List.hxx>
42cf5bc1 30class Geom_Plane;
31class TopoDS_Edge;
32class TopoDS_Shape;
33class TopoDS_Solid;
34class TopoDS_Face;
35class BRepLib_Command;
36class BRepLib_MakeShape;
37class BRepLib_MakeVertex;
38class BRepLib_MakeEdge;
39class BRepLib_MakeEdge2d;
40class BRepLib_MakePolygon;
41class BRepLib_MakeFace;
42class BRepLib_MakeWire;
43class BRepLib_MakeShell;
44class BRepLib_MakeSolid;
45class BRepLib_FindSurface;
46class BRepLib_FuseEdges;
47class BRepLib_CheckCurveOnSurface;
48
49
50//! The BRepLib package provides general utilities for
51//! BRep.
52//!
53//! * FindSurface : Class to compute a surface through
54//! a set of edges.
55//!
56//! * Compute missing 3d curve on an edge.
57class BRepLib
58{
59public:
60
61 DEFINE_STANDARD_ALLOC
62
63
64
65 //! Computes the max distance between edge
66 //! and its 2d representation on the face.
67 //! Sets the default precision. The current Precision
68 //! is returned.
69 Standard_EXPORT static void Precision (const Standard_Real P);
70
71 //! Returns the default precision.
72 Standard_EXPORT static Standard_Real Precision();
73
74 //! Sets the current plane to P.
75 Standard_EXPORT static void Plane (const Handle(Geom_Plane)& P);
76
77 //! Returns the current plane.
78 Standard_EXPORT static const Handle(Geom_Plane)& Plane();
79
80 //! checks if the Edge is same range IGNORING
81 //! the same range flag of the edge
82 //! Confusion argument is to compare real numbers
83 //! idenpendently of any model space tolerance
84 Standard_EXPORT static Standard_Boolean CheckSameRange (const TopoDS_Edge& E, const Standard_Real Confusion = 1.0e-12);
85
86 //! will make all the curve representation have
87 //! the same range domain for the parameters.
88 //! This will IGNORE the same range flag value
89 //! to proceed.
90 //! If there is a 3D curve there it will the
91 //! range of that curve. If not the first curve representation
92 //! encountered in the list will give its range to
93 //! the all the other curves.
94 Standard_EXPORT static void SameRange (const TopoDS_Edge& E, const Standard_Real Tolerance = 1.0e-5);
95
96 //! Computes the 3d curve for the edge <E> if it does
97 //! not exist. Returns True if the curve was computed
98 //! or existed. Returns False if there is no planar
99 //! pcurve or the computation failed.
100 //! <MaxSegment> >= 30 in approximation
101 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);
102
103 //! Computes the 3d curves for all the edges of <S>
104 //! return False if one of the computation failed.
105 //! <MaxSegment> >= 30 in approximation
106 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);
107
108 //! Computes the 3d curves for all the edges of <S>
109 //! return False if one of the computation failed.
110 Standard_EXPORT static Standard_Boolean BuildCurves3d (const TopoDS_Shape& S);
111
112 //! Checks if the edge has a Tolerance smaller than -- --
113 //! -- -- MaxToleranceToCheck if so it will compute the
114 //! radius of -- the cylindrical pipe surface that
115 //! MinToleranceRequest is the minimum tolerance before it
116 //! is usefull to start testing. Usually it should be arround
117 //! 10e-5
118 //! contains all -- the curve represenation of the edge
119 //! returns True if the Edge tolerance had to be updated
120 Standard_EXPORT static Standard_Boolean UpdateEdgeTol (const TopoDS_Edge& E, const Standard_Real MinToleranceRequest, const Standard_Real MaxToleranceToCheck);
121
122 //! -- Checks all the edges of the shape whose -- -- --
123 //! Tolerance is smaller than MaxToleranceToCheck --
124 //! Returns True if at least one edge was updated --
125 //! MinToleranceRequest is the minimum tolerance before
126 //! -- it -- is usefull to start testing. Usually it
127 //! should be arround -- 10e-5--
128 //!
129 //! Warning :The method is very slow as it checks all.
130 //! Use only in interfaces or processing assimilate batch
131 Standard_EXPORT static Standard_Boolean UpdateEdgeTolerance (const TopoDS_Shape& S, const Standard_Real MinToleranceRequest, const Standard_Real MaxToleranceToCheck);
132
133 //! Computes new 2d curve(s) for the edge <E> to have
134 //! the same parameter as the 3d curve.
135 //! The algorithm is not done if the flag SameParameter
136 //! was True on the Edge.
137 Standard_EXPORT static void SameParameter (const TopoDS_Edge& E, const Standard_Real Tolerance = 1.0e-5);
138
139 //! Computes new 2d curve(s) for all the edges of <S>
140 //! to have the same parameter as the 3d curve.
141 //! The algorithm is not done if the flag SameParameter
142 //! was True on an Edge.
143 Standard_EXPORT static void SameParameter (const TopoDS_Shape& S, const Standard_Real Tolerance = 1.0e-5, const Standard_Boolean forced = Standard_False);
144
145 //! Replaces tolerance of FACE EDGE VERTEX by the
146 //! tolerance Max of their connected handling shapes.
147 //! It is not necessary to use this call after
148 //! SameParameter. (called in)
149 Standard_EXPORT static void UpdateTolerances (const TopoDS_Shape& S, const Standard_Boolean verifyFaceTolerance = Standard_False);
150
420f79f8 151 //! Checks tolerances of edges (including inner points) and vertices
152 //! of a shape and updates them to satisfy "SameParameter" condition
153 Standard_EXPORT static void UpdateInnerTolerances (const TopoDS_Shape& S);
154
42cf5bc1 155 //! Orients the solid forward and the shell with the
156 //! orientation to have matter in the solid. Returns
157 //! False if the solid is unOrientable (open or incoherent)
158 Standard_EXPORT static Standard_Boolean OrientClosedSolid (TopoDS_Solid& solid);
159
160 //! Encodes the Regularity of edges on a Shape.
161 //! Warning: <TolAng> is an angular tolerance, expressed in Rad.
162 //! Warning: If the edges's regularity are coded before, nothing
163 //! is done.
164 Standard_EXPORT static void EncodeRegularity (const TopoDS_Shape& S, const Standard_Real TolAng = 1.0e-10);
712879c8 165
166 //! Encodes the Regularity of edges in list <LE> on the shape <S>
167 //! Warning: <TolAng> is an angular tolerance, expressed in Rad.
168 //! Warning: If the edges's regularity are coded before, nothing
169 //! is done.
170 Standard_EXPORT static void EncodeRegularity(const TopoDS_Shape& S, const TopTools_ListOfShape& LE, const Standard_Real TolAng = 1.0e-10);
42cf5bc1 171
172 //! Encodes the Regularity beetween <F1> and <F2> by <E>
173 //! Warning: <TolAng> is an angular tolerance, expressed in Rad.
174 //! Warning: If the edge's regularity is coded before, nothing
175 //! is done.
712879c8 176 Standard_EXPORT static void EncodeRegularity (TopoDS_Edge& E, const TopoDS_Face& F1, const TopoDS_Face& F2, const Standard_Real TolAng = 1.0e-10);
42cf5bc1 177
178 //! Sorts in LF the Faces of S on the complexity of
179 //! their surfaces
180 //! (Plane,Cylinder,Cone,Sphere,Torus,other)
181 Standard_EXPORT static void SortFaces (const TopoDS_Shape& S, TopTools_ListOfShape& LF);
182
183 //! Sorts in LF the Faces of S on the reverse
184 //! complexity of their surfaces
185 //! (other,Torus,Sphere,Cone,Cylinder,Plane)
186 Standard_EXPORT static void ReverseSortFaces (const TopoDS_Shape& S, TopTools_ListOfShape& LF);
187
188 //! Corrects the normals in Poly_Triangulation of faces,
189 //! in such way that normals at nodes lying along smooth
190 //! edges have the same value on both adjacent triangulations.
191 //! Returns TRUE if any correction is done.
192 Standard_EXPORT static Standard_Boolean EnsureNormalConsistency (const TopoDS_Shape& S, const Standard_Real theAngTol = 0.001, const Standard_Boolean ForceComputeNormals = Standard_False);
193
07ef8bdf 194 //! Calculates the bounding sphere around the set of vertexes from the theLV list.
195 //! Returns the center (theNewCenter) and the radius (theNewTol) of this sphere.
196 //! This can be used to construct the new vertex which covers the given set of
197 //! other vertices.
198 Standard_EXPORT static void BoundingVertex(const NCollection_List<TopoDS_Shape>& theLV,
199 gp_Pnt& theNewCenter, Standard_Real& theNewTol);
42cf5bc1 200
201protected:
202
203
204
205
206
207private:
208
209
210
211
212friend class BRepLib_Command;
213friend class BRepLib_MakeShape;
214friend class BRepLib_MakeVertex;
215friend class BRepLib_MakeEdge;
216friend class BRepLib_MakeEdge2d;
217friend class BRepLib_MakePolygon;
218friend class BRepLib_MakeFace;
219friend class BRepLib_MakeWire;
220friend class BRepLib_MakeShell;
221friend class BRepLib_MakeSolid;
222friend class BRepLib_FindSurface;
223friend class BRepLib_FuseEdges;
224friend class BRepLib_CheckCurveOnSurface;
225
226};
227
228
229
230
231
232
233
234#endif // _BRepLib_HeaderFile