source: rrlib_geometry/tBoundingBox.h @ 1:e3a747b66680

Last change on this file since 1:e3a747b66680 was 1:e3a747b66680, checked in by Tobias Föhst <foehst@…>, 9 years ago

Added basic geometric shape class
Added lines, line segments and Bezier curves

This library is not meant or suited to replace mcal_geometry, yet...

File size: 3.6 KB
Line 
1//
2// You received this file as part of RRLib
3// Robotics Research Library
4//
5// Copyright (C) AG Robotersysteme TU Kaiserslautern
6//
7// This program is free software; you can redistribute it and/or
8// modify it under the terms of the GNU General Public License
9// as published by the Free Software Foundation; either version 2
10// of the License, or (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
18// along with this program; if not, write to the Free Software
19// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
20//
21//----------------------------------------------------------------------
22/*!\file    tBoundingBox.h
23 *
24 * \author  Tobias Foehst
25 *
26 * \date    2009-05-27
27 *
28 * \brief   Contains tBoundingBox
29 *
30 * \b tBoundingBox
31 *
32 * A few words for tBoundingBox
33 *
34 */
35//----------------------------------------------------------------------
36#ifndef _rrlib_geometry_tBoundingBox_h_
37#define _rrlib_geometry_tBoundingBox_h_
38
39//----------------------------------------------------------------------
40// External includes (system with <>, local with "")
41//----------------------------------------------------------------------
42
43//----------------------------------------------------------------------
44// Internal includes with ""
45//----------------------------------------------------------------------
46#include "rrlib/geometry/tPoint.h"
47
48//----------------------------------------------------------------------
49// Debugging
50//----------------------------------------------------------------------
51
52//----------------------------------------------------------------------
53// Namespace declaration
54//----------------------------------------------------------------------
55namespace rrlib
56{
57namespace geometry
58{
59
60//----------------------------------------------------------------------
61// Forward declarations / typedefs / enums
62//----------------------------------------------------------------------
63
64//----------------------------------------------------------------------
65// Class declaration
66//----------------------------------------------------------------------
67//! Short description of tBoundingBox
68/*! A more detailed description of tBoundingBox, which
69    Tobias Foehst hasn't done yet !!
70*/
71template <size_t Tdimension, typename TElement>
72class tBoundingBox
73{
74
75//----------------------------------------------------------------------
76// Public methods and typedefs
77//----------------------------------------------------------------------
78public:
79
80  typedef geometry::tPoint<Tdimension, TElement> tPoint;
81
82  tBoundingBox();
83
84  inline const tPoint &Min() const
85  {
86    return this->min;
87  }
88
89  inline const tPoint &Max() const
90  {
91    return this->max;
92  }
93
94  void Reset();
95
96  void Add(const tPoint &point);
97
98  void Add(const tBoundingBox &other);
99
100  const bool Intersects(const tBoundingBox &other) const;
101
102  const tBoundingBox GetIntersection(const tBoundingBox &other) const;
103
104  const bool Contains(const tPoint &point) const;
105
106//----------------------------------------------------------------------
107// Private fields and methods
108//----------------------------------------------------------------------
109private:
110
111  tPoint min;
112  tPoint max;
113
114};
115
116
117//----------------------------------------------------------------------
118// End of namespace declaration
119//----------------------------------------------------------------------
120}
121}
122
123
124#include "rrlib/geometry/tBoundingBox.hpp"
125
126#endif
Note: See TracBrowser for help on using the repository browser.