0031939: Coding - correction of spelling errors in comments
[occt.git] / src / BRepTools / BRepTools.hxx
CommitLineData
42cf5bc1 1// Created on: 1992-08-28
2// Created by: Remi LEQUETTE
3// Copyright (c) 1992-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 _BRepTools_HeaderFile
18#define _BRepTools_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 <TopTools_IndexedMapOfShape.hxx>
27#include <Standard_OStream.hxx>
28#include <Standard_IStream.hxx>
29#include <Standard_CString.hxx>
7e785937 30#include <Message_ProgressRange.hxx>
e8862cf4 31
42cf5bc1 32class TopoDS_Face;
33class TopoDS_Wire;
34class TopoDS_Edge;
35class Bnd_Box2d;
36class TopoDS_Vertex;
37class TopoDS_Shell;
38class TopoDS_Solid;
39class TopoDS_CompSolid;
40class TopoDS_Compound;
41class TopoDS_Shape;
42cf5bc1 42class BRep_Builder;
43class BRepTools_WireExplorer;
44class BRepTools_Modification;
45class BRepTools_Modifier;
46class BRepTools_TrsfModification;
47class BRepTools_NurbsConvertModification;
48class BRepTools_GTrsfModification;
49class BRepTools_Substitution;
50class BRepTools_Quilt;
51class BRepTools_ShapeSet;
52class BRepTools_ReShape;
2651bfde 53class Geom_Curve;
54class Geom2d_Curve;
55class Geom_Surface;
42cf5bc1 56
57
58//! The BRepTools package provides utilities for BRep
59//! data structures.
60//!
61//! * WireExplorer : A tool to explore the topology of
62//! a wire in the order of the edges.
63//!
64//! * ShapeSet : Tools used for dumping, writing and
65//! reading.
66//!
67//! * UVBounds : Methods to compute the limits of the
68//! boundary of a face, a wire or an edge in the
69//! parametric space of a face.
70//!
71//! * Update : Methods to call when a topology has
72//! been created to compute all missing data.
73//!
e50ebf1f 74//! * UpdateFaceUVPoints: Method to update the UV points
75//! stored with the edges on a face.
42cf5bc1 76//!
77//! * Compare : Method to compare two vertices.
78//!
79//! * Compare : Method to compare two edges.
80//!
81//! * OuterWire : A method to find the outer wire of a
82//! face.
83//!
84//! * Map3DEdges : A method to map all the 3D Edges of
85//! a Shape.
86//!
87//! * Dump : A method to dump a BRep object.
88class BRepTools
89{
90public:
91
92 DEFINE_STANDARD_ALLOC
93
94
95 //! Returns in UMin, UMax, VMin, VMax the bounding
96 //! values in the parametric space of F.
97 Standard_EXPORT static void UVBounds (const TopoDS_Face& F, Standard_Real& UMin, Standard_Real& UMax, Standard_Real& VMin, Standard_Real& VMax);
98
99 //! Returns in UMin, UMax, VMin, VMax the bounding
100 //! values of the wire in the parametric space of F.
101 Standard_EXPORT static void UVBounds (const TopoDS_Face& F, const TopoDS_Wire& W, Standard_Real& UMin, Standard_Real& UMax, Standard_Real& VMin, Standard_Real& VMax);
102
103 //! Returns in UMin, UMax, VMin, VMax the bounding
104 //! values of the edge in the parametric space of F.
105 Standard_EXPORT static void UVBounds (const TopoDS_Face& F, const TopoDS_Edge& E, Standard_Real& UMin, Standard_Real& UMax, Standard_Real& VMin, Standard_Real& VMax);
106
107 //! Adds to the box <B> the bounding values in the
108 //! parametric space of F.
109 Standard_EXPORT static void AddUVBounds (const TopoDS_Face& F, Bnd_Box2d& B);
110
111 //! Adds to the box <B> the bounding values of the
112 //! wire in the parametric space of F.
113 Standard_EXPORT static void AddUVBounds (const TopoDS_Face& F, const TopoDS_Wire& W, Bnd_Box2d& B);
114
115 //! Adds to the box <B> the bounding values of the
116 //! edge in the parametric space of F.
117 Standard_EXPORT static void AddUVBounds (const TopoDS_Face& F, const TopoDS_Edge& E, Bnd_Box2d& B);
118
119 //! Update a vertex (nothing is done)
120 Standard_EXPORT static void Update (const TopoDS_Vertex& V);
121
122 //! Update an edge, compute 2d bounding boxes.
123 Standard_EXPORT static void Update (const TopoDS_Edge& E);
124
125 //! Update a wire (nothing is done)
126 Standard_EXPORT static void Update (const TopoDS_Wire& W);
127
128 //! Update a Face, update UV points.
129 Standard_EXPORT static void Update (const TopoDS_Face& F);
130
131 //! Update a shell (nothing is done)
132 Standard_EXPORT static void Update (const TopoDS_Shell& S);
133
134 //! Update a solid (nothing is done)
135 Standard_EXPORT static void Update (const TopoDS_Solid& S);
136
137 //! Update a composite solid (nothing is done)
138 Standard_EXPORT static void Update (const TopoDS_CompSolid& C);
139
140 //! Update a compound (nothing is done)
141 Standard_EXPORT static void Update (const TopoDS_Compound& C);
142
143 //! Update a shape, call the corect update.
144 Standard_EXPORT static void Update (const TopoDS_Shape& S);
145
e50ebf1f 146 //! For each edge of the face <F> reset the UV points
147 //! to the bounding points of the parametric curve of the
148 //! edge on the face.
149 Standard_EXPORT static void UpdateFaceUVPoints (const TopoDS_Face& theF);
42cf5bc1 150
21c7c457 151 //! Removes all cached polygonal representation of the shape,
128654b6 152 //! i.e. the triangulations of the faces of <S> and polygons on
153 //! triangulations and polygons 3d of the edges.
154 //! In case polygonal representation is the only available representation
155 //! for the shape (shape does not have geometry) it is not removed.
42cf5bc1 156 Standard_EXPORT static void Clean (const TopoDS_Shape& S);
157
4b114473 158 //! Removes geometry (curves and surfaces) from all edges and faces of the shape
159 Standard_EXPORT static void CleanGeometry(const TopoDS_Shape& theShape);
160
42cf5bc1 161 //! Removes all the pcurves of the edges of <S> that
162 //! refer to surfaces not belonging to any face of <S>
163 Standard_EXPORT static void RemoveUnusedPCurves (const TopoDS_Shape& S);
164
29263c94 165 //! Verifies that each Face from the shape has got a triangulation with a deflection smaller or equal to specified one
166 //! and the Edges a discretization on this triangulation.
167 //! @param theShape [in] shape to verify
168 //! @param theLinDefl [in] maximum allowed linear deflection
169 //! @param theToCheckFreeEdges [in] if TRUE, then free Edges are required to have 3D polygon
170 //! @return FALSE if input Shape contains Faces without triangulation,
171 //! or that triangulation has worse (greater) deflection than specified one,
172 //! or Edges in Shape lack polygons on triangulation
173 //! or free Edges in Shape lack 3D polygons
174 Standard_EXPORT static Standard_Boolean Triangulation (const TopoDS_Shape& theShape,
175 const Standard_Real theLinDefl,
176 const Standard_Boolean theToCheckFreeEdges = Standard_False);
42cf5bc1 177
178 //! Returns True if the distance between the two
179 //! vertices is lower than their tolerance.
180 Standard_EXPORT static Standard_Boolean Compare (const TopoDS_Vertex& V1, const TopoDS_Vertex& V2);
181
182 //! Returns True if the distance between the two
183 //! edges is lower than their tolerance.
184 Standard_EXPORT static Standard_Boolean Compare (const TopoDS_Edge& E1, const TopoDS_Edge& E2);
185
186 //! Returns the outer most wire of <F>. Returns a Null
187 //! wire if <F> has no wires.
188 Standard_EXPORT static TopoDS_Wire OuterWire (const TopoDS_Face& F);
189
190 //! Stores in the map <M> all the 3D topology edges
191 //! of <S>.
192 Standard_EXPORT static void Map3DEdges (const TopoDS_Shape& S, TopTools_IndexedMapOfShape& M);
193
194 //! Verifies that the edge <E> is found two times on
195 //! the face <F> before calling BRep_Tool::IsClosed.
196 Standard_EXPORT static Standard_Boolean IsReallyClosed (const TopoDS_Edge& E, const TopoDS_Face& F);
197
11af6cdd 198 //! Detect closedness of face in U and V directions
199 Standard_EXPORT static void DetectClosedness (const TopoDS_Face& theFace,
200 Standard_Boolean& theUclosed,
201 Standard_Boolean& theVclosed);
202
42cf5bc1 203 //! Dumps the topological structure and the geometry
204 //! of <Sh> on the stream <S>.
205 Standard_EXPORT static void Dump (const TopoDS_Shape& Sh, Standard_OStream& S);
206
207 //! Writes <Sh> on <S> in an ASCII format.
6d8f9f4a 208 Standard_EXPORT static void Write (const TopoDS_Shape& Sh, Standard_OStream& S,
7e785937 209 const Message_ProgressRange& theProgress = Message_ProgressRange());
42cf5bc1 210
211 //! Reads a Shape from <S> in returns it in <Sh>.
212 //! <B> is used to build the shape.
6d8f9f4a 213 Standard_EXPORT static void Read (TopoDS_Shape& Sh, Standard_IStream& S, const BRep_Builder& B,
7e785937 214 const Message_ProgressRange& theProgress = Message_ProgressRange());
42cf5bc1 215
216 //! Writes <Sh> in <File>.
7e785937 217 Standard_EXPORT static Standard_Boolean Write (const TopoDS_Shape& Sh, const Standard_CString File,
218 const Message_ProgressRange& theProgress = Message_ProgressRange());
42cf5bc1 219
220 //! Reads a Shape from <File>, returns it in <Sh>.
221 //! <B> is used to build the shape.
7e785937 222 Standard_EXPORT static Standard_Boolean Read (TopoDS_Shape& Sh, const Standard_CString File,
223 const BRep_Builder& B,
224 const Message_ProgressRange& theProgress = Message_ProgressRange());
42cf5bc1 225
2651bfde 226 //! Evals real tolerance of edge <theE>.
227 //! <theC3d>, <theC2d>, <theS>, <theF>, <theL> are
228 //! correspondently 3d curve of edge, 2d curve on surface <theS> and
229 //! rang of edge
230 //! If calculated tolerance is more then current edge tolerance, edge is updated.
231 //! Method returns actual tolerance of edge
232 Standard_EXPORT static Standard_Real EvalAndUpdateTol(const TopoDS_Edge& theE,
233 const Handle(Geom_Curve)& theC3d,
234 const Handle(Geom2d_Curve) theC2d,
235 const Handle(Geom_Surface)& theS,
236 const Standard_Real theF,
237 const Standard_Real theL);
42cf5bc1 238
eff3eff9 239 //! returns the cumul of the orientation of <Edge>
240 //! and thc containing wire in <Face>
241 Standard_EXPORT static TopAbs_Orientation OriEdgeInFace(const TopoDS_Edge& theEdge,
242 const TopoDS_Face& theFace);
42cf5bc1 243
09543c2d 244 //! Removes internal sub-shapes from the shape.
245 //! The check on internal status is based on orientation of sub-shapes,
246 //! classification is not performed.
247 //! Before removal of internal sub-shapes the algorithm checks if such
248 //! removal is not going to break topological connectivity between sub-shapes.
249 //! The flag <theForce> if set to true disables the connectivity check and clears
250 //! the given shape from all sub-shapes with internal orientation.
251 Standard_EXPORT static void RemoveInternals (TopoDS_Shape& theS,
252 const Standard_Boolean theForce = Standard_False);
253
7e785937 254
255protected:
256
257
258
259
260
42cf5bc1 261private:
262
7e785937 263
264
265
42cf5bc1 266friend class BRepTools_WireExplorer;
267friend class BRepTools_Modification;
268friend class BRepTools_Modifier;
269friend class BRepTools_TrsfModification;
270friend class BRepTools_NurbsConvertModification;
271friend class BRepTools_GTrsfModification;
272friend class BRepTools_Substitution;
273friend class BRepTools_Quilt;
274friend class BRepTools_ShapeSet;
275friend class BRepTools_ReShape;
276
277};
278
42cf5bc1 279#endif // _BRepTools_HeaderFile