xc
Point3d.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 //Point3d.h
22 
23 #ifndef POINT3D_H
24 #define POINT3D_H
25 
26 #include "../d3/GeomObj3d.h"
27 #include "../pos_vec/Pos3d.h"
28 
30 //
32 class Point3d : public GeomObj3d
33  {
34  Pos3d org;
35  public:
36  Point3d(void) : GeomObj3d() {}
37  Point3d(GEOM_FT x,GEOM_FT y,GEOM_FT z=0)
38  : GeomObj3d(), org(Pos3d(x,y,z)) {}
39  Point3d &operator=(const Point3d &p)
40  {
42  org= p.org;
43  return *this;
44  }
45  Point3d &operator=(const Pos3d &p)
46  {
47  org= p;
48  return *this;
49  }
50  operator const Pos3d &(void)
51  { return org; }
53  inline Pos3d getPos(void) const
54  { return org; }
55  virtual GeomObj3d *getCopy(void) const
56  { return new Point3d(*this); }
57  virtual Pos3d getCenterOfMass(void) const
58  { return org; }
59  inline virtual unsigned short int Dimension(void) const
60  { return 0; }
62  virtual GEOM_FT getLength(void) const
63  { return 0.0; }
65  virtual GEOM_FT getArea(void) const
66  { return 0.0; }
68  virtual GEOM_FT getVolume(void) const
69  { return 0.0; }
70  virtual GEOM_FT Ix(void) const
71  { return 0.0; }
72  virtual GEOM_FT Iy(void) const
73  { return 0.0; }
74  virtual GEOM_FT Iz(void) const
75  { return 0.0; }
76  inline bool domina_a(const Point3d &b) const
77  { return org.domina_a(b.org); }
78  inline virtual GEOM_FT GetMax(unsigned short int i) const
79  { return org(i); }
80  inline virtual GEOM_FT GetMin(unsigned short int i) const
81  { return org(i); }
82  friend int operator ==(const Point3d &a,const Point3d &b)
83  { return ( a.org == b.org ); };
84  inline void Print(std::ostream &os) const
85  { os << org; }
86  };
87 #endif
88 
89 
90 
virtual GEOM_FT getLength(void) const
Return object length (zero in this case).
Definition: Point3d.h:62
virtual GEOM_FT GetMax(unsigned short int i) const
Return the maximum value of the i-th coordinate.
Definition: Point3d.h:78
EntityWithOwner & operator=(const EntityWithOwner &)
Assignment operator.
Definition: EntityWithOwner.cc:53
virtual GEOM_FT GetMin(unsigned short int i) const
Return the minimum value of the i-th coordinate.
Definition: Point3d.h:80
virtual GEOM_FT getArea(void) const
Return the object area.
Definition: Point3d.h:65
virtual GEOM_FT getVolume(void) const
Return the object volume.
Definition: Point3d.h:68
Point in 3D.
Definition: Point3d.h:32
Posición en tres dimensiones.
Definition: Pos3d.h:44
Pos3d getPos(void) const
Return the position of the point in global coordinates.
Definition: Point3d.h:53
virtual unsigned short int Dimension(void) const
Return the dimension of the object 0, 1, 2 or 3.
Definition: Point3d.h:59
Clase base para los objetos en tres dimensiones.
Definition: GeomObj3d.h:43