source: rrlib_geometry/tShape.h @ 60:a22756932ab5

Last change on this file since 60:a22756932ab5 was 60:a22756932ab5, checked in by Tobias Föhst <foehst@…>, 6 years ago

Added and updated license information

File size: 4.3 KB
Line 
1//
2// You received this file as part of RRLib
3// Robotics Research Library
4//
5// Copyright (C) Finroc GbR (finroc.org)
6//
7// This program 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 2 of the License, or
10// (at your option) any later version.
11//
12// This program is distributed in the hope that it will be useful,
13// but 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 along
18// with this program; if not, write to the Free Software Foundation, Inc.,
19// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20//
21//----------------------------------------------------------------------
22/*!\file    tShape.h
23 *
24 * \author  Tobias Foehst
25 *
26 * \date    2010-12-27
27 *
28 * \brief   Contains tShape
29 *
30 * \b tShape
31 *
32 * A few words for tShape
33 *
34 */
35//----------------------------------------------------------------------
36#ifndef __rrlib__geometry__tShape_h__
37#define __rrlib__geometry__tShape_h__
38
39//----------------------------------------------------------------------
40// External includes (system with <>, local with "")
41//----------------------------------------------------------------------
42#include "rrlib/math/tVector.h"
43#include "rrlib/math/tMatrix.h"
44
45//----------------------------------------------------------------------
46// Internal includes with ""
47//----------------------------------------------------------------------
48#include "rrlib/geometry/tPoint.h"
49#include "rrlib/geometry/tBoundingBox.h"
50
51//----------------------------------------------------------------------
52// Debugging
53//----------------------------------------------------------------------
54
55//----------------------------------------------------------------------
56// Namespace declaration
57//----------------------------------------------------------------------
58namespace rrlib
59{
60namespace geometry
61{
62
63//----------------------------------------------------------------------
64// Forward declarations / typedefs / enums
65//----------------------------------------------------------------------
66
67//----------------------------------------------------------------------
68// Class declaration
69//----------------------------------------------------------------------
70//! Short description of tShape
71/*! A more detailed description of tShape, which
72    Tobias Foehst hasn't done yet !!
73*/
74template <size_t Tdimension, typename TElement>
75class tShape
76{
77
78//----------------------------------------------------------------------
79// Public methods and typedefs
80//----------------------------------------------------------------------
81public:
82
83  static inline const size_t Dimension()
84  {
85    return Tdimension;
86  }
87
88  typedef geometry::tPoint<Tdimension, TElement> tPoint;
89  typedef geometry::tBoundingBox<Tdimension, TElement> tBoundingBox;
90
91  tShape();
92
93  virtual ~tShape() = 0;
94
95  const tBoundingBox &BoundingBox() const;
96  const tPoint &CenterOfGravity() const;
97
98  virtual tShape &Translate(const math::tVector<Tdimension, TElement> &translation) = 0;
99  virtual tShape &Rotate(const math::tMatrix<Tdimension, Tdimension, TElement> &rotation) = 0;
100  virtual tShape &Transform(const math::tMatrix < Tdimension + 1, Tdimension + 1, TElement > &transformation) = 0;
101
102//----------------------------------------------------------------------
103// Protected methods
104//----------------------------------------------------------------------
105protected:
106
107  virtual void SetChanged();
108
109//----------------------------------------------------------------------
110// Private fields and methods
111//----------------------------------------------------------------------
112private:
113
114  mutable bool changed;
115  mutable tBoundingBox *bounding_box;
116  mutable tPoint *center_of_gravity;
117
118  void ResetMetaInformation() const;
119
120  virtual void UpdateBoundingBox(tBoundingBox &bounding_box) const = 0;
121  virtual void UpdateCenterOfGravity(tPoint &center_of_gravity) const = 0;
122
123};
124
125
126//----------------------------------------------------------------------
127// End of namespace declaration
128//----------------------------------------------------------------------
129}
130}
131
132
133#include "rrlib/geometry/tShape.hpp"
134
135#endif
Note: See TracBrowser for help on using the repository browser.