xc
GeomObj2d.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 //GeomObj.h
22 
23 #ifndef GEOMOBJ2D_H
24 #define GEOMOBJ2D_H
25 
26 #include "utility/geom/GeomObj.h"
27 #include "utility/geom/coo_sys/ref_sys/PrincipalAxesOfInertia2D.h"
28 
29 class BND2d;
30 class Dir2d;
31 class Line2d;
32 class FT_matrix;
33 
35 //
37 class GeomObj2d: public GeomObj
38  {
39  public:
40  typedef PolyPos<Pos2d> list_Pos2d;
41 
42  GeomObj2d(void) {}
43  virtual ~GeomObj2d(void) {}
45  virtual GEOM_FT GetMax(unsigned short int i) const= 0;
47  virtual GEOM_FT GetMin(unsigned short int i) const= 0;
48  GEOM_FT GetXMax(void) const { return GetMax(1); }
49  GEOM_FT GetYMax(void) const { return GetMax(2); }
50  GEOM_FT GetXMin(void) const { return GetMin(1); }
51  GEOM_FT GetYMin(void) const { return GetMin(2); }
52  Pos2d getPMax(void) const;
53  Pos2d getPMin(void) const;
54  virtual Pos2d Projection(const Pos2d &) const;
55  virtual Vector2d Projection(const Vector2d &) const;
56  BND2d Bnd(void) const;
57  virtual bool In(const Pos2d &p, const double &tol= 0.0) const;
58  virtual bool Out(const Pos2d &p, const double &tol= 0.0) const;
61  virtual GEOM_FT getCenterOfMassFactor(void) const
62  { return 1.0; }
63  virtual Pos2d getCenterOfMass(void) const= 0;
64  virtual GEOM_FT getLength(void) const= 0; //?? Por que se re-declara (está en GeomObj).
65  virtual GEOM_FT getArea(void) const= 0; //?? Por que se re-declara (está en GeomObj).
67  inline virtual GEOM_FT getVolume(void) const
68  { return 0.0; }
70  virtual GEOM_FT Ix(void) const= 0;
72  virtual GEOM_FT Iy(void) const= 0;
74  virtual GEOM_FT Pxy(void) const= 0;
76  inline virtual GEOM_FT Iz(void) const
77  { return Ix()+Iy(); }
78  double Theta_p(void) const;
79  Dir2d IAxisDir_a(void) const;
80  Dir2d IAxisDir_b(void) const;
81  Line2d IAxis_a(void) const;
82  Line2d IAxis_b(void) const;
83  Ref2d2d PrincipalAxesOfInertia(void) const;
84  GEOM_FT I1(void) const;
85  GEOM_FT I2(void) const;
86  inline PrincipalAxesOfInertia2D Inertia(void)
87  { return PrincipalAxesOfInertia2D(getCenterOfMass(),Ix(),Iy(),Pxy()); }
88  GEOM_FT I( const unsigned short int &i,
89  const unsigned short int &j) const;
90  virtual inline GEOM_FT IArea(void) const
91  { return getArea(); }
92  GEOM_FT I(const Pos2d &O,const Vector2d &e) const;
93  GEOM_FT I(const Line2d &r) const;
94  GEOM_FT I( const unsigned short int i,
95  const unsigned short int j,
96  const Pos2d &o) const;
97  GEOM_FT IO(const Pos2d &o) const;
98  FT_matrix I(void) const;
99  FT_matrix I(const Pos2d &o) const;
100 
101  virtual void Move(const Vector2d &);
102  virtual void Transform(const Trf2d &trf2d)= 0;
103  };
104 
106 template <class T>
107 T getTransformed(const T &obj,const Trf2d &trf2d)
108  {
109  T retval(obj);
110  retval.Transform(trf2d);
111  return retval;
112  }
113 
114 #endif
115 
116 
117 
118 
virtual void Move(const Vector2d &)
Desplaza el objeto.
Definition: GeomObj2d.cc:196
virtual GEOM_FT GetMax(unsigned short int i) const =0
Return the maximum value of the i-th coordinate.
"boundary" en dos dimensiones.
Definition: BND2d.h:38
FT_matrix I(void) const
Return the inertia tensor with respect to the center of mass of the object.
Definition: GeomObj2d.cc:161
Dirección en dos dimensiones.
Definition: Dir2d.h:36
virtual GEOM_FT Ix(void) const =0
Moment of inertia with respect to the center of mass en local axis.
Base class for position lists.
Definition: PolyPos.h:35
virtual GEOM_FT Iy(void) const =0
Moment of inertia with respect to the center of mass en local axis.
Posición en dos dimensiones.
Definition: Pos2d.h:41
Line in a two-dimensional space.
Definition: Line2d.h:61
GEOM_FT I1(void) const
Return the moment of inertia principal mayor.
Definition: GeomObj2d.cc:112
Ref2d2d PrincipalAxesOfInertia(void) const
Return los principal axis of inertia.
Definition: GeomObj2d.cc:108
virtual GEOM_FT getLength(void) const =0
Return the length of the object.
Base class for two-dimensional transformations.
Definition: Trf2d.h:40
Line2d IAxis_a(void) const
Return un principal axis of inertia (no sabemos si el mayor o el menor.
Definition: GeomObj2d.cc:99
virtual GEOM_FT getArea(void) const =0
Return the area of the object.
Vector en dos dimensiones.
Definition: Vector2d.h:40
Two-dimensional reference system defined in a two-dimensional space.
Definition: Ref2d2d.h:39
Base class for the two-dimensional geometric objects.
Definition: GeomObj2d.h:37
Dir2d IAxisDir_a(void) const
Return the dirección de un principal axis of inertia (we don&#39;t know if it&#39;s the major or the minor ye...
Definition: GeomObj2d.cc:89
virtual GEOM_FT getCenterOfMassFactor(void) const
Return the factor used for the computation of the center of mass (1.0 by default).
Definition: GeomObj2d.h:61
GEOM_FT IO(const Pos2d &o) const
Return the polar moment of inertia with respect to the point o.
Definition: GeomObj2d.cc:192
virtual GEOM_FT Iz(void) const
Moment of inertia polar with respect to the center of mass en local axis.
Definition: GeomObj2d.h:76
Line2d IAxis_b(void) const
Return un principal axis of inertia (no sabemos si el mayor o el menor.
Definition: GeomObj2d.cc:104
virtual bool Out(const Pos2d &p, const double &tol=0.0) const
Return true if the point lies outside the object.
Definition: GeomObj2d.cc:79
Principals axes of inertia in planar geometry.
Definition: PrincipalAxesOfInertia2D.h:34
virtual GEOM_FT Pxy(void) const =0
!
virtual Pos2d Projection(const Pos2d &) const
Return the orthogonal projection onto the line.
Definition: GeomObj2d.cc:48
virtual GEOM_FT GetMin(unsigned short int i) const =0
Return the minimum value of the i-th coordinate.
BND2d Bnd(void) const
Return the bounding rectangle.
Definition: GeomObj2d.cc:67
GEOM_FT I2(void) const
Return the moment of inertia principal menor.
Definition: GeomObj2d.cc:116
double Theta_p(void) const
Return the angle of one of the principal axis of inertia.
Definition: GeomObj2d.cc:84
virtual GEOM_FT getVolume(void) const
Return the object volume.
Definition: GeomObj2d.h:67
Clase base para las entidades geométricas.
Definition: GeomObj.h:40
Matrix which components are GEOM_FT numbers.
Definition: FT_matrix.h:40
virtual bool In(const Pos2d &p, const double &tol=0.0) const
Return true if the point lies inside the object.
Definition: GeomObj2d.cc:71
Dir2d IAxisDir_b(void) const
Return the direction of the other principal axis of inertia (we don&#39;t know if it&#39;s the major or the m...
Definition: GeomObj2d.cc:94