xc
Rectangle2d.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 //Rectangle2d.h
22 
23 #ifndef RECTANGLE2D_H
24 #define RECTANGLE2D_H
25 
26 #include "Quadrilateral2d.h"
27 
29 //
32  {
33  public:
34  Rectangle2d(const double &b=1.0,const double &h=1.0): Quadrilateral2d()
35  {
36  push_back(Pos2d(0,0));
37  push_back(Pos2d(b,0));
38  push_back(Pos2d(b,h));
39  push_back(Pos2d(0,h));
40  }
41  Rectangle2d(const Pos2d &o,const double &b=1.0,const double &h=1.0): Quadrilateral2d()
42  {
43  push_back(o+Vector2d(0,0));
44  push_back(o+Vector2d(b,0));
45  push_back(o+Vector2d(b,h));
46  push_back(o+Vector2d(0,h));
47  }
48  //Rectangle2d(const Ref2d &ref, const double &b=1.0,const double &h=1.0) : Quadrilateral2d(ref,b),height(h) {}
49 
50  virtual GeomObj *getCopy(void) const
51  { return new Rectangle2d(*this); }
52 /* inline const double &Base(void) const */
53 /* { return lado; } */
54 /* inline double &Base(void) */
55 /* { return lado; } */
56 /* inline const double &getHeight(void) const */
57 /* { return height; } */
58 /* inline double &getHeight(void) */
59 /* { return height; } */
60  };
61 
62 #endif
63 
64 
65 
66 
67 
Quadrilateral2d(void)
Default constructor.
Definition: Quadrilateral2d.cc:38
Posición en dos dimensiones.
Definition: Pos2d.h:41
Vector en dos dimensiones.
Definition: Vector2d.h:40
Rectangle in a two dimensional space.
Definition: Rectangle2d.h:31
Quadrilateral on a bi-dimensional space.
Definition: Quadrilateral2d.h:44
virtual GeomObj * getCopy(void) const
Constructor virtual.
Definition: Rectangle2d.h:50
void push_back(const Pos2d &)
Back inserter.
Definition: Quadrilateral2d.cc:57
Clase base para las entidades geométricas.
Definition: GeomObj.h:40