OpenLexocad  28.0
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 #include <vector>
24 
25 
26 
27 namespace Geom
28 {
29 class Pnt;
30 class Dir;
31 class Trsf;
32 class Lin;
33 class Pln;
34 class Vec;
35 } // namespace Geom
36 
37 
38 namespace Geom
39 {
66 class LX_GEOM_EXPORT Bnd_Box
67 {
68 public:
72  Bnd_Box(const Geom::Pnt& min, const Geom::Pnt& max);
75  void SetWhole();
77  void SetVoid();
81  void Set(const Geom::Pnt& P);
87  void Set(const Geom::Pnt& P, const Geom::Dir& D);
93  void Update(const double aXmin, const double aYmin, const double aZmin, const double aXmax, const double aYmax, const double aZmax);
95  void Update(const double X, const double Y, const double Z);
97  // Standard_EXPORT double GetGap() const;
99  void SetGap(const double Tol);
106  void Enlarge(const double Tol);
111  void Get(double& aXmin, double& aYmin, double& aZmin, double& aXmax, double& aYmax, double& aZmax) const;
112 
117  const double GetXmin() const;
122  const double GetYmin() const;
127  const double GetZmin() const;
132  const double GetXmax() const;
137  const double GetYmax() const;
142  const double GetZmax() const;
143 
148  const double GetXsize() const;
153  const double GetYsize() const;
158  const double GetZsize() const;
159 
164  const Geom::Pnt GetMin() const;
169  const Geom::Pnt GetMax() const;
173  std::vector<Geom::Pnt> GetCornerPoints() const;
178  const Geom::Pnt GetCenter() const;
183  void GetSize(double& length, double& width, double& height) const;
186  void OpenXmin();
189  void OpenXmax();
192  void OpenYmin();
195  void OpenYmax();
198  void OpenZmin();
201  void OpenZmax();
203  unsigned int IsOpenXmin() const;
205  unsigned int IsOpenXmax() const;
207  unsigned int IsOpenYmin() const;
209  unsigned int IsOpenYmax() const;
211  unsigned int IsOpenZmin() const;
213  unsigned int IsOpenZmax() const;
215  unsigned int IsWhole() const;
217  unsigned int IsVoid() const;
219  // Standard_EXPORT bool IsXThin(const double tol) const;
221  // Standard_EXPORT bool IsYThin(const double tol) const;
223  // Standard_EXPORT bool IsZThin(const double tol) const;
226  // Standard_EXPORT bool IsThin(const double tol) const;
235  void Add(const Bnd_Box& Other);
237  void Add(const Geom::Pnt& P);
239  void Add(const Geom::Pnt& P, const Geom::Dir& D);
243  void Add(const Geom::Dir& D);
245  unsigned int IsOut(const Geom::Pnt& P) const;
247  unsigned int IsOut(const Geom::Lin& L) const;
249  unsigned int IsOut(const Geom::Pln& P) const;
251  unsigned int IsOut(const Geom::Bnd_Box& Other) const;
254  unsigned int IsOut(const Geom::Bnd_Box& Other, const Geom::Trsf& T) const;
257  unsigned int IsOut(const Geom::Trsf& T1, const Geom::Bnd_Box& Other, const Geom::Trsf& T2) const;
261  unsigned int IsOut(const Geom::Pnt& P1, const Geom::Pnt& P2, const Geom::Dir& D) const;
263  // Standard_EXPORT double Distance(const Bnd_Box& Other) const;
264 
265  // Standard_EXPORT void Dump() const;
267  // double SquareExtent() const;
268 
269 
270  // Return difference between min point of two bounding boxes
272 
273 protected:
274 private:
275  double Xmin;
276  double Xmax;
277  double Ymin;
278  double Ymax;
279  double Zmin;
280  double Zmax;
281  double Gap;
282  unsigned int Flags;
283 };
284 
285 } // namespace Geom
Geom::Bnd_Box::IsOpenZmin
unsigned int IsOpenZmin() const
Returns true if this bounding box is open in the Zmin direction.
Geom::Bnd_Box::GetXsize
const double GetXsize() const
Geom::Bnd_Box
Definition: Bnd_Box.h:67
Geom::Bnd_Box::IsOut
unsigned int IsOut(const Geom::Pln &P) const
Returns False if the plane intersects the box.
Geom::Bnd_Box::GetSize
void GetSize(double &length, double &width, double &height) const
Geom::Bnd_Box::IsOpenZmax
unsigned int IsOpenZmax() const
Returns true if this bounding box is open in the Zmax direction.
Geom::Bnd_Box::IsOpenXmax
unsigned int IsOpenXmax() const
Returns true if this bounding box is open in the Xmax direction.
Geom::Bnd_Box::GetYmin
const double GetYmin() const
Geom::Bnd_Box::GetYsize
const double GetYsize() const
Geom::Bnd_Box::GetYmax
const double GetYmax() const
Geom::Lin
Definition: Lin.h:49
Geom::Vec
Defines a non-persistent vector in 3D space.
Definition: Vec.h:41
Geom::Bnd_Box::Enlarge
void Enlarge(const double Tol)
X
X
Definition: Globals.h:29
Geom::Bnd_Box::IsOpenYmax
unsigned int IsOpenYmax() const
Returns true if this bounding box is open in the Ymax direction.
Geom::Bnd_Box::Transformed
Geom::Bnd_Box Transformed(const Geom::Trsf &T) const
true if xmax-xmin < tol.
Geom::Bnd_Box::GetCornerPoints
std::vector< Geom::Pnt > GetCornerPoints() const
Geom::Bnd_Box::Set
void Set(const Geom::Pnt &P)
Geom::Dir
Definition: Dir.h:45
Geom::Bnd_Box::Update
void Update(const double aXmin, const double aYmin, const double aZmin, const double aXmax, const double aYmax, const double aZmax)
Geom::Bnd_Box::IsOut
unsigned int IsOut(const Geom::Pnt &P1, const Geom::Pnt &P2, const Geom::Dir &D) const
Geom::Bnd_Box::IsOpenYmin
unsigned int IsOpenYmin() const
Returns true if this bounding box is open in the Ymix direction.
Geom::Bnd_Box::GetXmin
const double GetXmin() const
Geom::Pln
Definition: Pln.h:52
Geom::Bnd_Box::OpenZmax
void OpenZmax()
Geom::Bnd_Box::SetWhole
void SetWhole()
Geom::Bnd_Box::Bnd_Box
Bnd_Box(const Geom::Pnt &min, const Geom::Pnt &max)
Geom::Bnd_Box::OpenXmax
void OpenXmax()
Geom::Pnt
Defines a non-persistent 3D Cartesian point.
Definition: Pnt.h:44
Geom::Bnd_Box::GetCenter
const Geom::Pnt GetCenter() const
Geom::Bnd_Box::IsOut
unsigned int IsOut(const Geom::Bnd_Box &Other, const Geom::Trsf &T) const
Geom::Bnd_Box::OpenZmin
void OpenZmin()
Geom::Bnd_Box::IsOut
unsigned int IsOut(const Geom::Pnt &P) const
Returns True if the Pnt is out the box.
Z
Z
Definition: Globals.h:31
Geom::Bnd_Box::IsOut
unsigned int IsOut(const Geom::Lin &L) const
Returns False if the line intersects the box.
Geom::Bnd_Box::Get
void Get(double &aXmin, double &aYmin, double &aZmin, double &aXmax, double &aYmax, double &aZmax) const
Geom::Bnd_Box::Add
void Add(const Bnd_Box &Other)
Adds the box <Other> to <me>.
Geom::Bnd_Box::Add
void Add(const Geom::Pnt &P)
Adds a Pnt to the box.
Geom::Bnd_Box::IsOut
unsigned int IsOut(const Geom::Bnd_Box &Other) const
Returns False if the <Box> intersects or is inside <me>.
Geom::Bnd_Box::GetZmax
const double GetZmax() const
Y
Y
Definition: Globals.h:30
Geom::Bnd_Box::GetZsize
const double GetZsize() const
Geom::Bnd_Box::IsWhole
unsigned int IsWhole() const
Returns true if this bounding box is infinite in all 6 directions (WholeSpace flag).
Geom::Bnd_Box::IsVoid
unsigned int IsVoid() const
Returns true if this bounding box is empty (Void flag).
Geom::Bnd_Box::Set
void Set(const Geom::Pnt &P, const Geom::Dir &D)
Geom::Bnd_Box::Update
void Update(const double X, const double Y, const double Z)
Adds a point of coordinates (X,Y,Z) to this bounding box.
Geom::Bnd_Box::GetXmax
const double GetXmax() const
Geom::Bnd_Box::SetGap
void SetGap(const double Tol)
Returns the gap of this bounding box.
Geom::Bnd_Box::Add
void Add(const Geom::Dir &D)
Geom::Bnd_Box::OpenYmax
void OpenYmax()
Geom::Bnd_Box::IsOut
unsigned int IsOut(const Geom::Trsf &T1, const Geom::Bnd_Box &Other, const Geom::Trsf &T2) const
Geom::Bnd_Box::OpenXmin
void OpenXmin()
Geom::Trsf
Definition: Trsf.h:58
Geom::Bnd_Box::GetMinDifference
Geom::Vec GetMinDifference(const Geom::Bnd_Box &Other) const
Computes the minimum distance between two boxes.
Geom::Bnd_Box::Bnd_Box
Bnd_Box()
Geom::Bnd_Box::Add
void Add(const Geom::Pnt &P, const Geom::Dir &D)
Extends <me> from the Pnt.
Geom::Bnd_Box::IsOpenXmin
unsigned int IsOpenXmin() const
Returns true if this bounding box is open in the Xmin direction.
Geom::Bnd_Box::SetVoid
void SetVoid()
Sets this bounding box so that it is empty. All points are outside a void box.
Geom::Bnd_Box::GetMin
const Geom::Pnt GetMin() const
Geom::Bnd_Box::GetZmin
const double GetZmin() const
Geom::Bnd_Box::GetMax
const Geom::Pnt GetMax() const
Geom::Bnd_Box::OpenYmin
void OpenYmin()
Geom
Definition: PropertyContainer.h:33