1 -- Created on: 1991-01-28
2 -- Created by: Remi Lequette
3 -- Copyright (c) 1991-1999 Matra Datavision
4 -- Copyright (c) 1999-2014 OPEN CASCADE SAS
6 -- This file is part of Open CASCADE Technology software library.
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.
14 -- Alternatively, this file may be used under the terms of Open CASCADE
15 -- commercial license or contractual agreement.
17 -- Modified : by Maria Pumborios at fri Apr 26
18 -- add the method distance
23 ---Purpose: Describes a bounding box in 3D space.
24 -- A bounding box is parallel to the axes of the coordinates
25 -- system. If it is finite, it is defined by the three intervals:
29 -- A bounding box may be infinite (i.e. open) in one or more
30 -- directions. It is said to be:
31 -- - OpenXmin if it is infinite on the negative side of the "X Direction";
32 -- - OpenXmax if it is infinite on the positive side of the "X Direction";
33 -- - OpenYmin if it is infinite on the negative side of the "Y Direction";
34 -- - OpenYmax if it is infinite on the positive side of the "Y Direction";
35 -- - OpenZmin if it is infinite on the negative side of the "Z Direction";
36 -- - OpenZmax if it is infinite on the positive side of the "Z Direction";
37 -- - WholeSpace if it is infinite in all six directions. In this
38 -- case, any point of the space is inside the box;
39 -- - Void if it is empty. In this case, there is no point included in the box.
40 -- A bounding box is defined by:
41 -- - six bounds (Xmin, Xmax, Ymin, Ymax, Zmin and
42 -- Zmax) which limit the bounding box if it is finite,
43 -- - eight flags (OpenXmin, OpenXmax, OpenYmin,
44 -- OpenYmax, OpenZmin, OpenZmax,
45 -- WholeSpace and Void) which describe the
46 -- bounding box if it is infinite or empty, and
47 -- - a gap, which is included on both sides in any direction
48 -- when consulting the finite bounds of the box.
58 ConstructionError from Standard
62 Create returns Box from Bnd;
63 ---Purpose: Creates an empty Box.
64 -- The constructed box is qualified Void. Its gap is null.
66 SetWhole(me : in out) is static;
67 ---Purpose: Sets this bounding box so that it covers the whole of 3D space.
68 -- It is infinitely long in all directions.
70 SetVoid(me : in out) is static;
71 ---Purpose: Sets this bounding box so that it is empty. All points are outside a void box.
73 Set(me : in out; P : Pnt) is static;
74 ---Purpose: Sets this bounding box so that it bounds
75 -- - the point P. This involves first setting this bounding box
76 -- to be void and then adding the point P.
78 Set(me : in out; P : Pnt; D : Dir) is static;
79 ---Purpose: Sets this bounding box so that it bounds
80 --- the half-line defined by point P and direction D, i.e. all
81 -- points M defined by M=P+u*D, where u is greater than
82 -- or equal to 0, are inside the bounding volume. This
83 -- involves first setting this box to be void and then adding the half-line.
85 Update(me : in out; aXmin, aYmin, aZmin, aXmax, aYmax, aZmax : Real)
86 ---Purpose: Enlarges this bounding box, if required, so that it
88 -- - interval [ aXmin,aXmax ] in the "X Direction",
89 -- - interval [ aYmin,aYmax ] in the "Y Direction",
90 -- - interval [ aZmin,aZmax ] in the "Z Direction";
93 Update(me : in out; X,Y,Z : Real)
94 ---Purpose: Adds a point of coordinates (X,Y,Z) to this bounding box.
97 GetGap(me) returns Real
98 ---Purpose: Returns the gap of this bounding box.
101 SetGap(me : in out; Tol : Real)
102 ---Purpose: Set the gap of this bounding box to abs(Tol).
105 Enlarge(me : in out; Tol : Real)
106 ---Purpose: Enlarges the box with a tolerance value.
107 -- (minvalues-Abs(<tol>) and maxvalues+Abs(<tol>))
108 -- This means that the minimum values of its X, Y and Z
109 -- intervals of definition, when they are finite, are reduced by
110 -- the absolute value of Tol, while the maximum values are
111 -- increased by the same amount.
114 Get (me; theXmin, theYmin, theZmin, theXmax, theYmax, theZmax : out Real)
115 ---Purpose: Returns the bounds of this bounding box. The gap is included.
116 -- If this bounding box is infinite (i.e. "open"), returned values
117 -- may be equal to +/- Precision::Infinite().
118 -- Standard_ConstructionError exception will be thrown if the box is void.
119 raises ConstructionError -- if IsVoid()
122 CornerMin(me) returns Pnt from gp
123 ---Purpose: Returns the lower corner of this bounding box. The gap is included.
124 -- If this bounding box is infinite (i.e. "open"), returned values
125 -- may be equal to +/- Precision::Infinite().
126 -- Standard_ConstructionError exception will be thrown if the box is void.
127 raises ConstructionError -- if IsVoid()
130 CornerMax(me) returns Pnt from gp
131 ---Purpose: Returns the upper corner of this bounding box. The gap is included.
132 -- If this bounding box is infinite (i.e. "open"), returned values
133 -- may be equal to +/- Precision::Infinite().
134 -- Standard_ConstructionError exception will be thrown if the box is void.
135 raises ConstructionError -- if IsVoid()
138 OpenXmin(me : in out)
139 ---Purpose: The Box will be infinitely long in the Xmin
144 OpenXmax(me : in out)
145 ---Purpose: The Box will be infinitely long in the Xmax
150 OpenYmin(me : in out)
151 ---Purpose: The Box will be infinitely long in the Ymin
156 OpenYmax(me : in out)
157 ---Purpose: The Box will be infinitely long in the Ymax
162 OpenZmin(me : in out)
163 ---Purpose: The Box will be infinitely long in the Zmin
168 OpenZmax(me : in out)
169 ---Purpose: The Box will be infinitely long in the Zmax
174 IsOpenXmin(me) returns Boolean
175 ---Purpose: Returns true if this bounding box is open in the Xmin direction.
178 IsOpenXmax(me) returns Boolean
179 ---Purpose: Returns true if this bounding box is open in the Xmax direction.
182 IsOpenYmin(me) returns Boolean
183 ---Purpose: Returns true if this bounding box is open in the Ymix direction.
186 IsOpenYmax(me) returns Boolean
187 ---Purpose: Returns true if this bounding box is open in the Ymax direction.
190 IsOpenZmin(me) returns Boolean
191 ---Purpose: Returns true if this bounding box is open in the Zmin direction.
194 IsOpenZmax(me) returns Boolean
195 ---Purpose: Returns true if this bounding box is open in the Zmax direction.
198 IsWhole(me) returns Boolean
199 --- Purpose: Returns true if this bounding box is infinite in all 6 directions (WholeSpace flag).
202 IsVoid(me) returns Boolean
203 ---Purpose: Returns true if this bounding box is empty (Void flag).
206 IsXThin(me; tol : Real) returns Boolean
207 ---Purpose: true if xmax-xmin < tol.
211 IsYThin(me; tol : Real) returns Boolean
212 ---Purpose: true if ymax-ymin < tol.
216 IsZThin(me; tol : Real) returns Boolean
217 ---Purpose: true if zmax-zmin < tol.
221 IsThin(me; tol : Real) returns Boolean
222 ---Purpose: Returns true if IsXThin, IsYThin and IsZThin are all true,
223 -- i.e. if the box is thin in all three dimensions.
227 Transformed(me; T : Trsf from gp)
228 ---Purpose: Returns a bounding box which is the result of applying the
229 -- transformation T to this bounding box.
231 -- Applying a geometric transformation (for example, a
232 -- rotation) to a bounding box generally increases its
233 -- dimensions. This is not optimal for algorithms which use it.
237 Add(me : in out; Other : Box)
239 ---Purpose: Adds the box <Other> to <me>.
242 Add(me : in out; P : Pnt)
244 ---Purpose: Adds a Pnt to the box.
247 Add(me : in out; P : Pnt; D : Dir)
249 ---Purpose: Extends <me> from the Pnt <P> in the direction <D>.
252 Add(me : in out; D : Dir)
254 ---Purpose: Extends the Box in the given Direction, i.e. adds
255 -- an half-line. The box may become infinite in
256 -- 1,2 or 3 directions.
259 IsOut(me; P : Pnt from gp) returns Boolean
260 ---Purpose: Returns True if the Pnt is out the box.
264 IsOut(me; L : Lin from gp) returns Boolean
265 ---Purpose: Returns False if the line intersects the box.
269 IsOut(me; P : Pln from gp) returns Boolean
270 ---Purpose: Returns False if the plane intersects the box.
274 IsOut(me; Other : Box) returns Boolean
276 ---Purpose: Returns False if the <Box> intersects or is inside <me>.
279 IsOut(me; Other : Box; T : Trsf from gp) returns Boolean
281 ---Purpose: Returns False if the transformed <Box> intersects
282 -- or is inside <me>.
285 IsOut(me; T1 : Trsf from gp; Other : Box; T2 : Trsf from gp)
288 ---Purpose: Returns False if the transformed <Box> intersects
289 -- or is inside the transformed box <me>.
292 IsOut(me; P1, P2: Pnt from gp; D: Dir from gp)
295 ---Purpose: Returns False if the flat band lying between two parallel
296 -- lines represented by their reference points <P1>, <P2> and
297 -- direction <D> intersects the box.
300 Distance (me; Other : Box) returns Real is static;
301 --- Purpose : Computes the minimum distance between two boxes.
305 SquareExtent(me) returns Real;
306 --- Purpose : Computes the squared diagonal of me.
316 Flags : Integer; -- 8 flags