42cf5bc1 |
1 | // Created on: 1995-07-24 |
2 | // Created by: Modelistation |
3 | // Copyright (c) 1995-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 _BndLib_AddSurface_HeaderFile |
18 | #define _BndLib_AddSurface_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
42cf5bc1 |
22 | |
42cf5bc1 |
23 | class Adaptor3d_Surface; |
24 | class Bnd_Box; |
42cf5bc1 |
25 | |
26 | //! computes the box from a surface |
27 | //! Functions to add a surface to a bounding box. |
28 | //! The surface is defined from a Geom surface. |
29 | class BndLib_AddSurface |
30 | { |
31 | public: |
32 | |
33 | DEFINE_STANDARD_ALLOC |
34 | |
35 | |
36 | //! Adds to the bounding box B the surface S |
37 | //! B is then enlarged by the tolerance value Tol. |
38 | //! Note: depending on the type of curve, one of the following |
39 | //! representations of the surface S is used to include it in the bounding box B: |
40 | //! - an exact representation if S is built from a plane, a |
41 | //! cylinder, a cone, a sphere or a torus, |
42 | //! - the poles of the surface if S is built from a Bezier |
43 | //! surface or a BSpline surface, |
44 | //! - the points of an approximation of the surface S in |
45 | //! cases other than offset surfaces; |
46 | //! - in the case of an offset surface, the basis surface is first |
47 | //! included according to the previous rules; then the |
48 | //! bounding box is enlarged by the offset value. |
49 | //! Warning |
50 | //! Do not use these functions to add a non-finite surface to |
51 | //! the bounding box B. |
52 | //! If UMin, UMax, VMin or VMax is an infinite value B will become WholeSpace. |
53 | //! S is an adapted surface, that is, an object which is an interface between: |
54 | //! - the services provided by a surface from the package Geom |
55 | //! - and those required of the surface by the computation algorithm. |
56 | //! The adapted surface is created in the following way: |
57 | //! Handle(Geom_Surface) mysurface = ... ; |
58 | //! GeomAdaptor_Surface S(mysurface); |
59 | //! The bounding box B is then enlarged by adding this surface: |
60 | //! Bnd_Box B; |
61 | //! // ... |
62 | //! Standard_Real Tol = ... ; |
63 | //! AddSurface::Add ( S, Tol, B ); |
64 | Standard_EXPORT static void Add (const Adaptor3d_Surface& S, const Standard_Real Tol, Bnd_Box& B); |
65 | |
66 | //! Adds to the bounding box B the surface S |
67 | //! the patch of the surface S limited in the u parametric |
68 | //! direction by the two parameter values UMin, UMax, and |
69 | //! in the v parametric direction by the two parameter |
70 | //! values VMin, VMax. |
71 | //! Note: depending on the type of curve, one of the following |
72 | //! representations of the surface S is used to include it in the bounding box B: |
73 | //! - an exact representation if S is built from a plane, a |
74 | //! cylinder, a cone, a sphere or a torus, |
75 | //! - the poles of the surface if S is built from a Bezier |
76 | //! surface or a BSpline surface, |
77 | //! - the points of an approximation of the surface S in |
78 | //! cases other than offset surfaces; |
79 | //! - in the case of an offset surface, the basis surface is first |
80 | //! included according to the previous rules; then the |
81 | //! bounding box is enlarged by the offset value. |
82 | //! Warning |
83 | //! Do not use these functions to add a non-finite surface to |
84 | //! the bounding box B. |
85 | //! If UMin, UMax, VMin or VMax is an infinite value B will become WholeSpace. |
86 | //! S is an adapted surface, that is, an object which is an interface between: |
87 | //! - the services provided by a surface from the package Geom |
88 | //! - and those required of the surface by the computation algorithm. |
89 | //! The adapted surface is created in the following way: |
90 | //! Handle(Geom_Surface) mysurface = ... ; |
91 | //! GeomAdaptor_Surface S(mysurface); |
92 | //! The bounding box B is then enlarged by adding this surface: |
93 | //! Bnd_Box B; |
94 | //! // ... |
95 | //! Standard_Real Tol = ... ; |
96 | //! AddSurface::Add ( S, Tol, B ); |
97 | Standard_EXPORT static void Add (const Adaptor3d_Surface& S, const Standard_Real UMin, const Standard_Real UMax, const Standard_Real VMin, const Standard_Real VMax, const Standard_Real Tol, Bnd_Box& B); |
98 | |
3ba87fdb |
99 | //! Adds the surface S to the bounding box B. |
21c7c457 |
100 | //! This algorithm builds precise bounding box |
42cf5bc1 |
101 | |
3ba87fdb |
102 | Standard_EXPORT static void AddOptimal (const Adaptor3d_Surface& S, const Standard_Real Tol, Bnd_Box& B); |
42cf5bc1 |
103 | |
3ba87fdb |
104 | Standard_EXPORT static void AddOptimal (const Adaptor3d_Surface& S, |
105 | const Standard_Real UMin, const Standard_Real UMax, |
106 | const Standard_Real VMin, const Standard_Real VMax, |
107 | const Standard_Real Tol, Bnd_Box& B); |
42cf5bc1 |
108 | |
42cf5bc1 |
109 | |
3ba87fdb |
110 | //! Adds to the bounding box B the surface S |
111 | //! using numerical minimization algorithms |
112 | //! This method is used in AddOptimal for not analytical surfaces and torus. |
113 | //! if Tol < Precision::Confusion(), Precision::Confusion is used as computation tolerance |
114 | Standard_EXPORT static void AddGenSurf(const Adaptor3d_Surface& S, |
115 | const Standard_Real UMin, |
116 | const Standard_Real UMax, |
117 | const Standard_Real VMin, |
118 | const Standard_Real VMax, |
119 | const Standard_Real Tol, |
120 | Bnd_Box& B); |
42cf5bc1 |
121 | |
3ba87fdb |
122 | protected: |
42cf5bc1 |
123 | |
124 | |
125 | |
42cf5bc1 |
126 | |
127 | |
3ba87fdb |
128 | private: |
42cf5bc1 |
129 | |
130 | |
131 | |
132 | }; |
133 | |
134 | |
135 | |
136 | |
137 | |
138 | |
139 | |
140 | #endif // _BndLib_AddSurface_HeaderFile |