xc
Point2d.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 //Point2d.h
22 
23 #ifndef POINT2D_H
24 #define POINT2D_H
25 
26 #include "../d2/GeomObj2d.h"
27 #include "../pos_vec/Pos2d.h"
28 
30 //
32 class Point2d : public GeomObj2d
33  {
34  Pos2d org;
35  public:
36  Point2d(void) : GeomObj2d() {}
37  explicit Point2d(const Pos2d &p): GeomObj2d(), org(p) {}
38  Point2d(GEOM_FT x,GEOM_FT y) : GeomObj2d(), org(x,y)
39  {}
40  operator const Pos2d &()
41  { return org; }
43  inline Pos2d getPos(void) const
44  { return org; }
45  virtual GeomObj2d *getCopy(void) const
46  { return new Point2d(*this); }
47  virtual Pos2d getCenterOfMass(void) const
48  { return org; }
49  inline virtual unsigned short int Dimension(void) const
50  { return 0; }
52  virtual GEOM_FT getLength(void) const
53  { return 0.0; }
55  virtual GEOM_FT getArea(void) const
56  { return 0.0; }
58  virtual GEOM_FT getVolume(void) const
59  { return 0.0; }
60  virtual GEOM_FT Ix(void) const
61  { return 0.0; }
62  virtual GEOM_FT Iy(void) const
63  { return 0.0; }
64  virtual GEOM_FT Pxy(void) const
65  { return 0.0; }
66  virtual GEOM_FT Iz(void) const
67  { return 0.0; }
68  inline bool domina_a(const Point2d &b) const
69  { return org.domina_a(b.org); }
70  inline virtual GEOM_FT GetMax(unsigned short int i) const
71  { return org(i); }
72  inline virtual GEOM_FT GetMin(unsigned short int i) const
73  { return org(i); }
74 
75  void Transform(const Trf2d &trf2d);
76 
77  friend int operator ==(const Point2d &a,const Point2d &b)
78  { return ( a.org == b.org ); };
79 
80  void Print(std::ostream &os) const;
81  void Plot(Plotter &psos) const;
82  };
83 #endif
84 
85 
86 
virtual unsigned short int Dimension(void) const
Return the dimension of the object 0, 1, 2 or 3.
Definition: Point2d.h:49
virtual GEOM_FT getLength(void) const
Return object length (zero in this case).
Definition: Point2d.h:52
virtual GEOM_FT GetMin(unsigned short int i) const
Return the minimum value of the i-th coordinate.
Definition: Point2d.h:72
Pos2d getPos(void) const
Return the position in the global coordinates.
Definition: Point2d.h:43
Point in 2D.
Definition: Point2d.h:32
Posición en dos dimensiones.
Definition: Pos2d.h:41
Base class for two-dimensional transformations.
Definition: Trf2d.h:40
virtual GEOM_FT Iy(void) const
Moment of inertia with respect to the center of mass en local axis.
Definition: Point2d.h:62
virtual GEOM_FT Iz(void) const
Moment of inertia polar with respect to the center of mass en local axis.
Definition: Point2d.h:66
virtual GEOM_FT getVolume(void) const
Return the object volume.
Definition: Point2d.h:58
Base class for the two-dimensional geometric objects.
Definition: GeomObj2d.h:37
void Transform(const Trf2d &trf2d)
Aplica al objeto la transformación que se pasa como parámetro.
Definition: Point2d.cc:36
virtual GEOM_FT Ix(void) const
Moment of inertia with respect to the center of mass en local axis.
Definition: Point2d.h:60
virtual GEOM_FT getArea(void) const
Return the object area.
Definition: Point2d.h:55
virtual GEOM_FT GetMax(unsigned short int i) const
Return the maximum value of the i-th coordinate.
Definition: Point2d.h:70
virtual GEOM_FT Pxy(void) const
!
Definition: Point2d.h:64