xc
GeomObj3d.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 //GeomObj3d.h
22 
23 #ifndef GEOMOBJ3D_H
24 #define GEOMOBJ3D_H
25 
26 #include "../GeomObj.h"
27 
28 #include "../lists/PolyPos.h"
29 
30 class SoGroup;
31 class Pos3d;
32 class Vector3d;
33 class Line3d;
34 class BND3d;
35 class Ref3d3d;
36 class FT_matrix;
37 class HalfSpace3d;
38 
39 
41 //
43 class GeomObj3d: public GeomObj
44  {
45  protected:
46  //std::deque<HalfSpace3d> interpretaHalfSpaces3d(const std::string &str);
47  public:
48  typedef PolyPos<Pos3d> list_Pos3d;
49 
50  GeomObj3d(void) {}
51  virtual ~GeomObj3d(void) {}
52  virtual GeomObj *getCopy(void) const=0;
54  virtual GEOM_FT GetMax(unsigned short int i) const= 0;
56  virtual GEOM_FT GetMin(unsigned short int i) const= 0;
57  GEOM_FT GetXMax(void) const { return GetMax(1); }
58  GEOM_FT GetYMax(void) const { return GetMax(2); }
59  GEOM_FT GetZMax(void) const { return GetMax(3); }
60  GEOM_FT GetXMin(void) const { return GetMin(1); }
61  GEOM_FT GetYMin(void) const { return GetMin(2); }
62  GEOM_FT GetZMin(void) const { return GetMin(3); }
63  virtual void XProjection(void) {}
64  virtual void YProjection(void) {}
65  virtual void ZProjection(void) {}
66  virtual Pos3d Projection(const Pos3d &) const;
67  virtual Vector3d Projection(const Vector3d &) const;
68  Pos3d getPMax(void) const;
69  Pos3d getPMin(void) const;
70  BND3d Bnd(void) const;
71  virtual bool In(const Pos3d &p, const double &tol= 0.0) const;
72  virtual bool Out(const Pos3d &p, const double &tol= 0.0) const;
75  virtual GEOM_FT getCenterOfMassFactor(void) const
76  { return 1.0; }
77  virtual Pos3d getCenterOfMass(void) const= 0;
79  virtual GEOM_FT getLength(void) const= 0;
81  virtual GEOM_FT getArea(void) const= 0;
83  virtual GEOM_FT getVolume(void) const= 0;
84  virtual GEOM_FT Ix(void) const= 0;
85  virtual GEOM_FT Iy(void) const= 0;
86  virtual GEOM_FT Iz(void) const= 0;
87 
88  //product of inertia with respect to the center of mass in local coordinates.
89  //Suponemos orthonormal axis.
90  inline virtual GEOM_FT Pxy(void) const
91  { return Ix()+Iy()-Iz(); }
92  //product of inertia with respect to the center of mass in local coordinates.
93  //Suponemos orthonormal axis.
94  inline virtual GEOM_FT Pxz(void) const
95  { return Ix()+Iz()-Iy(); }
96  //product of inertia with respect to the center of mass in local coordinates.
97  //Suponemos orthonormal axis.
98  inline virtual GEOM_FT Pyz(void) const
99  { return Iy()+Iz()-Ix(); }
100  inline GEOM_FT I( const unsigned short int &i,
101  const unsigned short int &j) const;
102  //Return el area que se emplea para calcular el moment of inertia
103  virtual inline GEOM_FT IArea(void) const
104  { return 0.0; }
105  GEOM_FT I(const Pos3d &O,const Vector3d &e) const;
106  GEOM_FT I(const Line3d &r) const;
107  GEOM_FT I( const unsigned short int i,
108  const unsigned short int j,
109  const Pos3d &o) const;
110  GEOM_FT IO(const Pos3d &o) const;
111  FT_matrix I(void) const;
112  FT_matrix I(const Pos3d &o) const;
113 
114  };
115 
116 #endif
117 
118 
119 
120 
virtual GEOM_FT getVolume(void) const =0
Return the object volume.
Base class for position lists.
Definition: PolyPos.h:35
virtual bool Out(const Pos3d &p, const double &tol=0.0) const
Return true if the point lies outside the object.
Definition: GeomObj3d.cc:94
virtual GEOM_FT getLength(void) const =0
Return the object length.
virtual GEOM_FT getArea(void) const =0
Return the object area.
virtual GEOM_FT GetMin(unsigned short int i) const =0
Return the minimum value of the i-th coordinate.
GEOM_FT IO(const Pos3d &o) const
Return the polar moment of inertia with respect to the point o.
Definition: GeomObj3d.cc:176
"boundary" en tres dimensiones.
Definition: BND3d.h:34
virtual Pos3d Projection(const Pos3d &) const
Return the orthogonal projection onto the line.
Definition: GeomObj3d.cc:52
virtual bool In(const Pos3d &p, const double &tol=0.0) const
Return true if point lies inside the object.
Definition: GeomObj3d.cc:86
Posición en tres dimensiones.
Definition: Pos3d.h:44
Line in a three-dimensional space.
Definition: Line3d.h:62
FT_matrix I(void) const
Return the inertia tensor with respect to the center of mass of the object.
Definition: GeomObj3d.cc:157
BND3d Bnd(void) const
Return the boundary of the object.
Definition: GeomObj3d.cc:82
virtual GEOM_FT GetMax(unsigned short int i) const =0
Return the maximum value of the i-th coordinate.
The points of the half space are those that line at the back of the plane, this being understood as t...
Definition: HalfSpace3d.h:42
Clase base para las entidades geométricas.
Definition: GeomObj.h:40
Matrix which components are GEOM_FT numbers.
Definition: FT_matrix.h:40
virtual GEOM_FT getCenterOfMassFactor(void) const
Return the factor used for the computation of the center of mass (1.0 by default).
Definition: GeomObj3d.h:75
Vector en tres dimensiones.
Definition: Vector3d.h:39
Three-dimensional reference system defined in a three-dimensional space.
Definition: Ref3d3d.h:39
Clase base para los objetos en tres dimensiones.
Definition: GeomObj3d.h:43