2 -- Created: Mon Jan 28 11:51:08 1991
3 -- Author: Remi Lequette
5 -- Modified : by Maria Pumborios at fri Apr 26
6 -- add the method distance
7 ---Copyright: Matra Datavision 1991, 1992
12 ---Purpose: Describes a bounding box in 3D space.
13 -- A bounding box is parallel to the axes of the coordinates
14 -- system. If it is finite, it is defined by the three intervals:
18 -- A bounding box may be infinite (i.e. open) in one or more
19 -- directions. It is said to be:
20 -- - OpenXmin if it is infinite on the negative side of the "X Direction";
21 -- - OpenXmax if it is infinite on the positive side of the "X Direction";
22 -- - OpenYmin if it is infinite on the negative side of the "Y Direction";
23 -- - OpenYmax if it is infinite on the positive side of the "Y Direction";
24 -- - OpenZmin if it is infinite on the negative side of the "Z Direction";
25 -- - OpenZmax if it is infinite on the positive side of the "Z Direction";
26 -- - WholeSpace if it is infinite in all six directions. In this
27 -- case, any point of the space is inside the box;
28 -- - Void if it is empty. In this case, there is no point included in the box.
29 -- A bounding box is defined by:
30 -- - six bounds (Xmin, Xmax, Ymin, Ymax, Zmin and
31 -- Zmax) which limit the bounding box if it is finite,
32 -- - eight flags (OpenXmin, OpenXmax, OpenYmin,
33 -- OpenYmax, OpenZmin, OpenZmax,
34 -- WholeSpace and Void) which describe the
35 -- bounding box if it is infinite or empty, and
36 -- - a gap, which is included on both sides in any direction
37 -- when consulting the finite bounds of the box.
47 ConstructionError from Standard
51 Create returns Box from Bnd;
52 ---Purpose: Creates an empty Box.
53 -- The constructed box is qualified Void. Its gap is null.
55 SetWhole(me : in out) is static;
56 ---Purpose: Sets this bounding box so that it covers the whole of 3D space.
57 -- It is infinitely long in all directions.
59 SetVoid(me : in out) is static;
60 ---Purpose: Sets this bounding box so that it is empty. All points are outside a void box.
62 Set(me : in out; P : Pnt) is static;
63 ---Purpose: Sets this bounding box so that it bounds
64 -- - the point P. This involves first setting this bounding box
65 -- to be void and then adding the point P.
67 Set(me : in out; P : Pnt; D : Dir) is static;
68 ---Purpose: Sets this bounding box so that it bounds
69 --- the half-line defined by point P and direction D, i.e. all
70 -- points M defined by M=P+u*D, where u is greater than
71 -- or equal to 0, are inside the bounding volume. This
72 -- involves first setting this box to be void and then adding the half-line.
74 Update(me : in out; aXmin, aYmin, aZmin, aXmax, aYmax, aZmax : Real)
75 ---Purpose: Enlarges this bounding box, if required, so that it
77 -- - interval [ aXmin,aXmax ] in the "X Direction",
78 -- - interval [ aYmin,aYmax ] in the "Y Direction",
79 -- - interval [ aZmin,aZmax ] in the "Z Direction";
82 Update(me : in out; X,Y,Z : Real)
83 ---Purpose: Adds a point of coordinates (X,Y,Z) to this bounding box.
86 GetGap(me) returns Real
87 ---Purpose: Returns the gap of this bounding box.
90 SetGap(me : in out; Tol : Real)
91 ---Purpose: Set the gap of this bounding box to abs(Tol).
94 Enlarge(me : in out; Tol : Real)
95 ---Purpose: Enlarges the box with a tolerance value.
96 -- (minvalues-Abs(<tol>) and maxvalues+Abs(<tol>))
97 -- This means that the minimum values of its X, Y and Z
98 -- intervals of definition, when they are finite, are reduced by
99 -- the absolute value of Tol, while the maximum values are
100 -- increased by the same amount.
103 Get(me; aXmin, aYmin, aZmin, aXmax, aYmax, aZmax : out Real)
104 ---Purpose: Returns the bounds of this bounding box. The gap is included.
105 -- If this bounding box is infinite (i.e. "open"), returned values
106 -- may be equal to +/- Precision::Infinite().
107 raises ConstructionError -- if IsVoid()
110 OpenXmin(me : in out)
111 ---Purpose: The Box will be infinitely long in the Xmin
116 OpenXmax(me : in out)
117 ---Purpose: The Box will be infinitely long in the Xmax
122 OpenYmin(me : in out)
123 ---Purpose: The Box will be infinitely long in the Ymin
128 OpenYmax(me : in out)
129 ---Purpose: The Box will be infinitely long in the Ymax
134 OpenZmin(me : in out)
135 ---Purpose: The Box will be infinitely long in the Zmin
140 OpenZmax(me : in out)
141 ---Purpose: The Box will be infinitely long in the Zmax
146 IsOpenXmin(me) returns Boolean
147 ---Purpose: Returns true if this bounding box is open in the Xmin direction.
150 IsOpenXmax(me) returns Boolean
151 ---Purpose: Returns true if this bounding box is open in the Xmax direction.
154 IsOpenYmin(me) returns Boolean
155 ---Purpose: Returns true if this bounding box is open in the Ymix direction.
158 IsOpenYmax(me) returns Boolean
159 ---Purpose: Returns true if this bounding box is open in the Ymax direction.
162 IsOpenZmin(me) returns Boolean
163 ---Purpose: Returns true if this bounding box is open in the Zmin direction.
166 IsOpenZmax(me) returns Boolean
167 ---Purpose: Returns true if this bounding box is open in the Zmax direction.
170 IsWhole(me) returns Boolean
171 --- Purpose: Returns true if this bounding box is infinite in all 6 directions (WholeSpace flag).
174 IsVoid(me) returns Boolean
175 ---Purpose: Returns true if this bounding box is empty (Void flag).
178 IsXThin(me; tol : Real) returns Boolean
179 ---Purpose: true if xmax-xmin < tol.
183 IsYThin(me; tol : Real) returns Boolean
184 ---Purpose: true if ymax-ymin < tol.
188 IsZThin(me; tol : Real) returns Boolean
189 ---Purpose: true if zmax-zmin < tol.
193 IsThin(me; tol : Real) returns Boolean
194 ---Purpose: Returns true if IsXThin, IsYThin and IsZThin are all true,
195 -- i.e. if the box is thin in all three dimensions.
199 Transformed(me; T : Trsf from gp)
200 ---Purpose: Returns a bounding box which is the result of applying the
201 -- transformation T to this bounding box.
203 -- Applying a geometric transformation (for example, a
204 -- rotation) to a bounding box generally increases its
205 -- dimensions. This is not optimal for algorithms which use it.
209 Add(me : in out; Other : Box)
211 ---Purpose: Adds the box <Other> to <me>.
214 Add(me : in out; P : Pnt)
216 ---Purpose: Adds a Pnt to the box.
219 Add(me : in out; P : Pnt; D : Dir)
221 ---Purpose: Extends <me> from the Pnt <P> in the direction <D>.
224 Add(me : in out; D : Dir)
226 ---Purpose: Extends the Box in the given Direction, i.e. adds
227 -- an half-line. The box may become infinite in
228 -- 1,2 or 3 directions.
231 IsOut(me; P : Pnt from gp) returns Boolean
232 ---Purpose: Returns True if the Pnt is out the box.
236 IsOut(me; L : Lin from gp) returns Boolean
237 ---Purpose: Returns False if the line intersects the box.
241 IsOut(me; P : Pln from gp) returns Boolean
242 ---Purpose: Returns False if the plane intersects the box.
246 IsOut(me; Other : Box) returns Boolean
248 ---Purpose: Returns False if the <Box> intersects or is inside <me>.
251 IsOut(me; Other : Box; T : Trsf from gp) returns Boolean
253 ---Purpose: Returns False if the transformed <Box> intersects
254 -- or is inside <me>.
257 IsOut(me; T1 : Trsf from gp; Other : Box; T2 : Trsf from gp)
260 ---Purpose: Returns False if the transformed <Box> intersects
261 -- or is inside the transformed box <me>.
264 IsOut(me; P1, P2: Pnt from gp; D: Dir from gp)
267 ---Purpose: Returns False if the flat band lying between two parallel
268 -- lines represented by their reference points <P1>, <P2> and
269 -- direction <D> intersects the box.
272 Distance (me; Other : Box) returns Real is static;
273 --- Purpose : Computes the minimum distance between two boxes.
277 SquareExtent(me) returns Real;
278 --- Purpose : Computes the squared diagonal of me.
288 Flags : Integer; -- 8 flags