42cf5bc1 |
1 | // Created on: 1993-07-08 |
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 _BndLib_HeaderFile |
18 | #define _BndLib_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <Standard_Real.hxx> |
25 | class gp_Lin; |
26 | class Bnd_Box; |
27 | class gp_Lin2d; |
28 | class Bnd_Box2d; |
29 | class gp_Circ; |
30 | class gp_Circ2d; |
31 | class gp_Elips; |
32 | class gp_Elips2d; |
33 | class gp_Parab; |
34 | class gp_Parab2d; |
35 | class gp_Hypr; |
36 | class gp_Hypr2d; |
37 | class gp_Cylinder; |
38 | class gp_Cone; |
39 | class gp_Sphere; |
40 | class gp_Torus; |
41 | class BndLib_Add3dCurve; |
42 | class BndLib_Add2dCurve; |
43 | class BndLib_AddSurface; |
44 | |
45 | |
46 | //! The BndLib package provides functions to add a geometric primitive to a bounding box. |
47 | //! Note: these functions work with gp objects, optionally |
48 | //! limited by parameter values. If the curves and surfaces |
49 | //! provided by the gp package are not explicitly |
50 | //! parameterized, they still have an implicit parameterization, |
51 | //! similar to that which they infer for the equivalent Geom or Geom2d objects. |
52 | //! Add : Package to compute the bounding boxes for elementary |
53 | //! objects from gp in 2d and 3d . |
54 | //! |
55 | //! AddCurve2d : A class to compute the bounding box for a curve |
56 | //! in 2d dimensions ;the curve is defined by a tool |
57 | //! |
58 | //! AddCurve : A class to compute the bounding box for a curve |
59 | //! in 3d dimensions ;the curve is defined by a tool |
60 | //! |
61 | //! AddSurface : A class to compute the bounding box for a surface. |
62 | //! The surface is defined by a tool for the geometry and another |
63 | //! tool for the topology (only the edges in 2d dimensions) |
64 | class BndLib |
65 | { |
66 | public: |
67 | |
68 | DEFINE_STANDARD_ALLOC |
69 | |
70 | |
71 | //! Bounding box for a surface trimmed or not |
72 | //! Adds the segment of the line L limited by the two |
73 | //! parameter values P1 and P2, to the bounding box B, and |
74 | //! then enlarges B by the tolerance value Tol. |
75 | //! Tol is the tolerance value to enlarge the minimun and maximum dimension |
76 | //! P1 and P2 may represent infinite values. |
77 | //! Exceptions |
78 | //! Standard_Failure if P1 and P2 are either two negative |
79 | //! infinite real numbers, or two positive infinite real numbers. |
80 | Standard_EXPORT static void Add (const gp_Lin& L, const Standard_Real P1, const Standard_Real P2, const Standard_Real Tol, Bnd_Box& B); |
81 | |
82 | Standard_EXPORT static void Add (const gp_Lin2d& L, const Standard_Real P1, const Standard_Real P2, const Standard_Real Tol, Bnd_Box2d& B); |
83 | |
84 | Standard_EXPORT static void Add (const gp_Circ& C, const Standard_Real Tol, Bnd_Box& B); |
85 | |
86 | //! P2-P1 can be in [0,2*pi] |
87 | Standard_EXPORT static void Add (const gp_Circ& C, const Standard_Real P1, const Standard_Real P2, const Standard_Real Tol, Bnd_Box& B); |
88 | |
89 | Standard_EXPORT static void Add (const gp_Circ2d& C, const Standard_Real Tol, Bnd_Box2d& B); |
90 | |
91 | //! Adds the circle C, or the arc of the circle C |
92 | //! limited by the two parameter values P1 and P2, |
93 | //! to the bounding box B, and then enlarges B by the tolerance value Tol. |
94 | //! P2-P1 can be in [0,2*pi] |
95 | Standard_EXPORT static void Add (const gp_Circ2d& C, const Standard_Real P1, const Standard_Real P2, const Standard_Real Tol, Bnd_Box2d& B); |
96 | |
97 | Standard_EXPORT static void Add (const gp_Elips& C, const Standard_Real Tol, Bnd_Box& B); |
98 | |
99 | //! P2-P1 can be in [0,2*pi] |
100 | Standard_EXPORT static void Add (const gp_Elips& C, const Standard_Real P1, const Standard_Real P2, const Standard_Real Tol, Bnd_Box& B); |
101 | |
102 | Standard_EXPORT static void Add (const gp_Elips2d& C, const Standard_Real Tol, Bnd_Box2d& B); |
103 | |
104 | //! Adds the ellipse E, or the arc of the ellipse E |
105 | //! limited by the two parameter values P1 and P2, |
106 | //! to the bounding box B, and then enlarges B by the tolerance value Tol. |
107 | //! P2-P1 can be in [0,2*pi] |
108 | Standard_EXPORT static void Add (const gp_Elips2d& C, const Standard_Real P1, const Standard_Real P2, const Standard_Real Tol, Bnd_Box2d& B); |
109 | |
110 | Standard_EXPORT static void Add (const gp_Parab& P, const Standard_Real P1, const Standard_Real P2, const Standard_Real Tol, Bnd_Box& B); |
111 | |
112 | //! Adds the arc of the parabola P limited by the two |
113 | //! parameter values P1 and P2, to the bounding box B, and |
114 | //! then enlarges B by the tolerance value Tol. |
115 | //! P1 and P2 may represent infinite values. |
116 | //! Exceptions |
117 | //! Standard_Failure if P1 and P2 are either two negative |
118 | //! infinite real numbers, or two positive infinite real numbers. |
119 | Standard_EXPORT static void Add (const gp_Parab2d& P, const Standard_Real P1, const Standard_Real P2, const Standard_Real Tol, Bnd_Box2d& B); |
120 | |
121 | Standard_EXPORT static void Add (const gp_Hypr& H, const Standard_Real P1, const Standard_Real P2, const Standard_Real Tol, Bnd_Box& B); |
122 | |
123 | //! Adds the arc of the branch of hyperbola H limited by the |
124 | //! two parameter values P1 and P2, to the bounding box B, |
125 | //! and then enlarges B by the tolerance value Tol. |
126 | //! P1 and P2 may represent infinite values. |
127 | //! Exceptions |
128 | //! Standard_Failure if P1 and P2 are either two negative |
129 | //! infinite real numbers, or two positive infinite real numbers. |
130 | Standard_EXPORT static void Add (const gp_Hypr2d& H, const Standard_Real P1, const Standard_Real P2, const Standard_Real Tol, Bnd_Box2d& B); |
131 | |
132 | //! UMax -UMin can be in [0,2*pi] |
133 | Standard_EXPORT static void Add (const gp_Cylinder& S, const Standard_Real UMin, const Standard_Real UMax, const Standard_Real VMin, const Standard_Real VMax, const Standard_Real Tol, Bnd_Box& B); |
134 | |
135 | //! Adds to the bounding box B, the patch of the cylinder S limited |
136 | //! - in the v parametric direction, by the two parameter |
137 | //! values VMin and VMax |
138 | //! - and optionally in the u parametric direction, by the two |
139 | //! parameter values UMin and UMax. |
140 | //! B is then enlarged by the tolerance value Tol. |
141 | //! VMin and VMax may represent infinite values. |
142 | //! Exceptions |
143 | //! Standard_Failure if VMin and VMax are either two |
144 | //! negative infinite real numbers, or two positive infinite real numbers. |
145 | Standard_EXPORT static void Add (const gp_Cylinder& S, const Standard_Real VMin, const Standard_Real VMax, const Standard_Real Tol, Bnd_Box& B); |
146 | |
147 | //! UMax-UMin can be in [0,2*pi] |
148 | Standard_EXPORT static void Add (const gp_Cone& S, const Standard_Real UMin, const Standard_Real UMax, const Standard_Real VMin, const Standard_Real VMax, const Standard_Real Tol, Bnd_Box& B); |
149 | |
150 | //! Adds to the bounding box B, the patch of the cone S limited |
151 | //! - in the v parametric direction, by the two parameter |
152 | //! values VMin and VMax |
153 | //! - and optionally in the u parametric direction, by the two |
154 | //! parameter values UMin and UMax, |
155 | //! B is then enlarged by the tolerance value Tol. |
156 | //! VMin and VMax may represent infinite values. |
157 | //! Exceptions |
158 | //! Standard_Failure if VMin and VMax are either two |
159 | //! negative infinite real numbers, or two positive infinite real numbers. |
160 | Standard_EXPORT static void Add (const gp_Cone& S, const Standard_Real VMin, const Standard_Real VMax, const Standard_Real Tol, Bnd_Box& B); |
161 | |
162 | Standard_EXPORT static void Add (const gp_Sphere& S, const Standard_Real Tol, Bnd_Box& B); |
163 | |
164 | //! Adds to the bounding box B the sphere S, or |
165 | //! - the patch of the sphere S, limited in the u parametric |
166 | //! direction, by the two parameter values UMin and UMax, |
167 | //! and in the v parametric direction, by the two parameter |
168 | //! values VMin and VMax. |
169 | //! B is then enlarged by the tolerance value Tol. |
170 | //! UMax-UMin can be in [0,2*pi] |
171 | //! VMin,VMax can be [-pi/2,pi/2] |
172 | Standard_EXPORT static void Add (const gp_Sphere& S, const Standard_Real UMin, const Standard_Real UMax, const Standard_Real VMin, const Standard_Real VMax, const Standard_Real Tol, Bnd_Box& B); |
173 | |
174 | Standard_EXPORT static void Add (const gp_Torus& P, const Standard_Real Tol, Bnd_Box& B); |
175 | |
176 | //! Adds to the bounding box B |
177 | //! - the torus S, or |
178 | //! - the patch of the torus S, limited in the u parametric |
179 | //! direction, by the two parameter values UMin and UMax, |
180 | //! and in the v parametric direction, by the two parameter |
181 | //! values VMin and VMax. |
182 | //! B is then enlarged by the tolerance value Tol. |
183 | //! UMax-UMin can be in [0,2*pi], |
184 | //! VMin,VMax can be [-pi/2,pi/2] |
185 | Standard_EXPORT static void Add (const gp_Torus& P, const Standard_Real UMin, const Standard_Real UMax, const Standard_Real VMin, const Standard_Real VMax, const Standard_Real Tol, Bnd_Box& B); |
186 | |
187 | |
188 | |
189 | |
190 | protected: |
191 | |
192 | |
193 | |
194 | |
195 | |
196 | private: |
197 | |
198 | |
199 | |
200 | |
201 | friend class BndLib_Add3dCurve; |
202 | friend class BndLib_Add2dCurve; |
203 | friend class BndLib_AddSurface; |
204 | |
205 | }; |
206 | |
207 | |
208 | |
209 | |
210 | |
211 | |
212 | |
213 | #endif // _BndLib_HeaderFile |