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