xc
BND3d.h
1 // -*-c++-*-
2 //----------------------------------------------------------------------------
3 // xc utils library; general purpose classes and functions.
4 //
5 // Copyright (C) Luis C. Pérez Tato
6 //
7 // XC utils is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation, either version 3 of the License, or
10 // (at your option) any later version.
11 //
12 // This software is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program.
19 // If not, see <http://www.gnu.org/licenses/>.
20 //----------------------------------------------------------------------------
21 //BND3D.h
22 
23 #ifndef BND3D_H
24 #define BND3D_H
25 
26 #include <iostream>
27 #include "GeomObj3d.h"
28 #include "../cgal_types.h"
29 
30 
32 //
34 class BND3d: public GeomObj3d
35  {
36  CGIsoCuboid_3 cgisocub;
37  bool undefined;
38  protected:
39  bool LBClipTest(const GEOM_FT &p,const GEOM_FT &q,GEOM_FT &u1,GEOM_FT &u2) const;
40  bool LBClipLine(const Pos3d &p1,const Pos3d &p2) const;
41  public:
42  BND3d(void);
43  BND3d(const Pos3d &p_min,const Pos3d &p_max);
44  virtual GeomObj *getCopy(void) const
45  { return new BND3d(*this); }
47  inline virtual unsigned short int Dimension(void) const
48  { return 3; }
50  inline virtual GEOM_FT getLength(void) const
51  { return GetXMax()-GetXMin(); }
53  inline GEOM_FT getWidth(void) const
54  { return GetYMax()-GetYMin(); }
56  inline GEOM_FT getHeight(void) const
57  { return GetZMax()-GetZMin(); }
58  Vector3d Diagonal(void) const;
59  GEOM_FT getAreaXYFace(void) const;
60  GEOM_FT getAreaXZFace(void) const;
61  GEOM_FT getAreaYZFace(void) const;
62  virtual GEOM_FT getArea(void) const;
64  inline virtual GEOM_FT getVolume(void) const
65  { return cgisocub.volume(); }
66  virtual GEOM_FT Ix(void) const;
67  virtual GEOM_FT Iy(void) const;
68  virtual GEOM_FT Iz(void) const;
69  void Update(const Pos3d &);
70  void PutPMax(const Pos3d &);
71  void PutPMin(const Pos3d &);
72  void PutPMinMax(const Pos3d &,const Pos3d &);
73  Pos3d getPMax(void) const;
74  Pos3d getPMin(void) const;
75  inline GEOM_FT GetMax(unsigned short int i) const
76  { return cgisocub.max_coord(i-1); }
77  inline GEOM_FT GetMin(unsigned short int i) const
78  { return cgisocub.min_coord(i-1); }
79  int GetNumCaras(void) const
80  { return 6; }
81  CGBbox_3 GetCGALBbox_3(void) const;
82  Pos3d getCenterOfMass(void) const;
83  Pos3d Vertice(unsigned int i) const;
84  const GeomObj::list_Pos3d &getVertexList(void) const;
85  boost::python::list getVertexListPy(void) const;
86  unsigned short int RegionCode(const Pos3d &,const double &tol= 0.0) const;
87  bool In(const Pos3d &p,const double &tol= 0.0) const;
88  bool ClipLine(const Pos3d &p1,const Pos3d &p2) const;
89  BND3d offset(const GEOM_FT &o) const;
90  BND3d &operator +=(const Pos3d &p);
91  BND3d &operator +=(const BND3d &a);
92  friend BND3d operator +(const BND3d &a, const BND3d &b);
93  friend bool operator ==(const BND3d &a,const BND3d &b);
94  void Print(std::ostream &stream) const;
95  };
96 
97 #endif
const GeomObj::list_Pos3d & getVertexList(void) const
Return a list with the object vertices.
Definition: BND3d.cc:281
virtual GEOM_FT getArea(void) const
Return the object area.
Definition: BND3d.cc:65
Base class for position lists.
Definition: PolyPos.h:35
GEOM_FT getHeight(void) const
Return object height (z axis).
Definition: BND3d.h:56
bool In(const Pos3d &p, const double &tol=0.0) const
Return true if point lies inside the object.
Definition: BND3d.cc:321
BND3d(void)
Constructor.
Definition: BND3d.cc:33
virtual GEOM_FT getLength(void) const
Return object length (x axis).
Definition: BND3d.h:50
GEOM_FT getAreaXYFace(void) const
Area of the face parallel to XY plane.
Definition: BND3d.cc:42
virtual GEOM_FT getVolume(void) const
Return the object volume.
Definition: BND3d.h:64
bool LBClipTest(const GEOM_FT &p, const GEOM_FT &q, GEOM_FT &u1, GEOM_FT &u2) const
This functions is part of the line clipping algorithm of Liang-Barsky (page 231 of the book Computer ...
Definition: BND3d.cc:189
BND3d offset(const GEOM_FT &o) const
Grows the boundary in the specified amount.
Definition: BND3d.cc:356
GEOM_FT getAreaXZFace(void) const
Area of the face parallel to XZ plane.
Definition: BND3d.cc:50
"boundary" en tres dimensiones.
Definition: BND3d.h:34
GEOM_FT GetMin(unsigned short int i) const
Return the minimum value of the i-th coordinate.
Definition: BND3d.h:77
Posición en tres dimensiones.
Definition: Pos3d.h:44
GEOM_FT GetMax(unsigned short int i) const
Return the maximum value of the i-th coordinate.
Definition: BND3d.h:75
virtual unsigned short int Dimension(void) const
Return the dimension of the object 0, 1, 2 or 3.
Definition: BND3d.h:47
Clase base para las entidades geométricas.
Definition: GeomObj.h:40
boost::python::list getVertexListPy(void) const
Return a Python list with the object vertices.
Definition: BND3d.cc:294
void Update(const Pos3d &)
Updates (enlarges) the boundary with the point.
Definition: BND3d.cc:89
Vector en tres dimensiones.
Definition: Vector3d.h:39
GEOM_FT getWidth(void) const
Return object width (y axis).
Definition: BND3d.h:53
GEOM_FT getAreaYZFace(void) const
Area of the face parallel to YZ plane.
Definition: BND3d.cc:58
Clase base para los objetos en tres dimensiones.
Definition: GeomObj3d.h:43