42cf5bc1 |
1 | // Created on: 1993-07-22 |
2 | // Created by: Isabelle GRIGNON |
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 _BRepBndLib_HeaderFile |
18 | #define _BRepBndLib_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <Standard_Boolean.hxx> |
25 | class TopoDS_Shape; |
26 | class Bnd_Box; |
27 | |
28 | |
29 | //! This package provides the bounding boxes for curves |
30 | //! and surfaces from BRepAdaptor. |
31 | //! Functions to add a topological shape to a bounding box |
32 | class BRepBndLib |
33 | { |
34 | public: |
35 | |
36 | DEFINE_STANDARD_ALLOC |
37 | |
38 | |
39 | //! Adds the shape S to the bounding box B. |
40 | //! More precisely are successively added to B: |
41 | //! - each face of S; the triangulation of the face is used if it exists, |
42 | //! - then each edge of S which does not belong to a face, |
43 | //! the polygon of the edge is used if it exists |
44 | //! - and last each vertex of S which does not belong to an edge. |
45 | //! After each elementary operation, the bounding box B is |
46 | //! enlarged by the tolerance value of the relative sub-shape. |
47 | //! When working with the triangulation of a face this value of |
48 | //! enlargement is the sum of the triangulation deflection and |
49 | //! the face tolerance. When working with the |
50 | //! polygon of an edge this value of enlargement is |
51 | //! the sum of the polygon deflection and the edge tolerance. |
52 | //! Warning |
53 | //! - This algorithm is time consuming if triangulation has not |
54 | //! been inserted inside the data structure of the shape S. |
55 | //! - The resulting bounding box may be somewhat larger than the object. |
56 | Standard_EXPORT static void Add (const TopoDS_Shape& S, Bnd_Box& B, const Standard_Boolean useTriangulation = Standard_True); |
57 | |
58 | //! Adds the shape S to the bounding box B. |
59 | //! This is a quick algorithm but only works if the shape S is |
60 | //! composed of polygonal planar faces, as is the case if S is |
61 | //! an approached polyhedral representation of an exact |
62 | //! shape. Pay particular attention to this because this |
63 | //! condition is not checked and, if it not respected, an error |
64 | //! may occur in the algorithm for which the bounding box is built. |
65 | //! Note that the resulting bounding box is not enlarged by the |
66 | //! tolerance value of the sub-shapes as is the case with the |
67 | //! Add function. So the added part of the resulting bounding |
68 | //! box is closer to the shape S. |
69 | Standard_EXPORT static void AddClose (const TopoDS_Shape& S, Bnd_Box& B); |
70 | |
3ba87fdb |
71 | //! Adds the shape S to the bounding box B. |
72 | //! This algorith builds precise bounding box, |
73 | //! which differs from exact geometry boundaries of shape only on shape entities tolerances |
74 | //! Algorithm is the same as for method Add(..), but uses more precise methods for building boxes |
75 | //! for geometry objects. |
76 | //! If useShapeTolerance = True, bounding box is enlardged by shape tolerances and |
77 | //! these tolerances are used for numerical methods of bounding box size calculations, |
78 | //! otherwise bounding box is built according to sizes of uderlined geometrical entities, |
79 | //! numerical calculation use tolerance Precision::Confusion(). |
80 | Standard_EXPORT static void AddOptimal (const TopoDS_Shape& S, Bnd_Box& B, |
81 | const Standard_Boolean useTriangulation = Standard_True, |
82 | const Standard_Boolean useShapeTolerance = Standard_False); |
42cf5bc1 |
83 | |
84 | |
85 | |
86 | protected: |
87 | |
88 | |
89 | |
90 | |
91 | |
92 | private: |
93 | |
94 | |
95 | |
96 | |
97 | |
98 | }; |
99 | |
100 | |
101 | |
102 | |
103 | |
104 | |
105 | |
106 | #endif // _BRepBndLib_HeaderFile |