OpenLexocad  27.1
Bnd_Box.h
Go to the documentation of this file.
1 //
3 // Copyright(C) 2013-2016 OpenCascade [www.opencascade.org]
4 //
5 // This library is free software; you can redistribute it and / or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License, or (at your option) any later version.
9 //
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the GNU
13 // Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with this library; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street,
18 // Fifth Floor, Boston, MA 02110 - 1301 USA
19 //
21 
22 #pragma once
23 
24 namespace Geom
25 {
26 class Pnt;
27 class Dir;
28 class Trsf;
29 class Lin;
30 class Pln;
31 class Vec;
32 } // namespace Geom
33 
34 
35 namespace Geom
36 {
63 class LX_GEOM_EXPORT Bnd_Box
64 {
65 public:
68  Bnd_Box();
69  Bnd_Box(const Geom::Pnt& min, const Geom::Pnt& max);
72  void SetWhole();
74  void SetVoid();
78  void Set(const Geom::Pnt& P);
84  void Set(const Geom::Pnt& P, const Geom::Dir& D);
90  void Update(const double aXmin, const double aYmin, const double aZmin, const double aXmax, const double aYmax, const double aZmax);
92  void Update(const double X, const double Y, const double Z);
94  // Standard_EXPORT double GetGap() const;
96  void SetGap(const double Tol);
103  void Enlarge(const double Tol);
108  void Get(double& aXmin, double& aYmin, double& aZmin, double& aXmax, double& aYmax, double& aZmax) const;
109 
114  const double GetXmin() const;
119  const double GetYmin() const;
124  const double GetZmin() const;
129  const double GetXmax() const;
134  const double GetYmax() const;
139  const double GetZmax() const;
140 
145  const double GetXsize() const;
150  const double GetYsize() const;
155  const double GetZsize() const;
156 
161  const Geom::Pnt GetMin() const;
166  const Geom::Pnt GetMax() const;
171  const Geom::Pnt GetCenter() const;
176  void GetSize(double& length, double& width, double& height) const;
179  void OpenXmin();
182  void OpenXmax();
185  void OpenYmin();
188  void OpenYmax();
191  void OpenZmin();
194  void OpenZmax();
196  unsigned int IsOpenXmin() const;
198  unsigned int IsOpenXmax() const;
200  unsigned int IsOpenYmin() const;
202  unsigned int IsOpenYmax() const;
204  unsigned int IsOpenZmin() const;
206  unsigned int IsOpenZmax() const;
208  unsigned int IsWhole() const;
210  unsigned int IsVoid() const;
212  // Standard_EXPORT bool IsXThin(const double tol) const;
214  // Standard_EXPORT bool IsYThin(const double tol) const;
216  // Standard_EXPORT bool IsZThin(const double tol) const;
219  // Standard_EXPORT bool IsThin(const double tol) const;
226  Geom::Bnd_Box Transformed(const Geom::Trsf& T) const;
228  void Add(const Bnd_Box& Other);
230  void Add(const Geom::Pnt& P);
232  void Add(const Geom::Pnt& P, const Geom::Dir& D);
236  void Add(const Geom::Dir& D);
238  unsigned int IsOut(const Geom::Pnt& P) const;
240  unsigned int IsOut(const Geom::Lin& L) const;
242  unsigned int IsOut(const Geom::Pln& P) const;
244  unsigned int IsOut(const Geom::Bnd_Box& Other) const;
247  unsigned int IsOut(const Geom::Bnd_Box& Other, const Geom::Trsf& T) const;
250  unsigned int IsOut(const Geom::Trsf& T1, const Geom::Bnd_Box& Other, const Geom::Trsf& T2) const;
254  unsigned int IsOut(const Geom::Pnt& P1, const Geom::Pnt& P2, const Geom::Dir& D) const;
256  // Standard_EXPORT double Distance(const Bnd_Box& Other) const;
257 
258  // Standard_EXPORT void Dump() const;
260  // double SquareExtent() const;
261 
262 
263  // Return difference between min point of two bounding boxes
264  Geom::Vec GetMinDifference(const Geom::Bnd_Box& Other) const;
265 
266 protected:
267 private:
268  double Xmin;
269  double Xmax;
270  double Ymin;
271  double Ymax;
272  double Zmin;
273  double Zmax;
274  double Gap;
275  unsigned int Flags;
276 };
277 
278 } // namespace Geom
Definition: Variant.h:60
X
Definition: Globals.h:29
Definition: Pln.h:57
Defines a non-persistent 3D Cartesian point.
Definition: Pnt.h:43
Definition: Bnd_Box.h:63
Definition: Lin.h:48
Definition: Trsf.h:57
Definition: Dir.h:45
Y
Definition: Globals.h:29
Z
Definition: Globals.h:29
Defines a non-persistent vector in 3D space.
Definition: Vec.h:44