BoundingBox.hpp
Go to the documentation of this file.
1 
28 /*
29  * BoundingBox.hpp
30  *
31  * @date 22.10.2008
32  * @author Thomas Wiemann (twiemann@uos.de)
33  */
34 
35 #pragma once
36 
37 #include <cmath>
38 #include <ostream>
39 
40 #include "lvr2/io/LineReader.hpp"
41 
42 namespace lvr2
43 {
44 
48 template<typename BaseVecT>
50 {
51 public:
52 
53  using VectorType = BaseVecT;
57  BoundingBox();
58 
66  template<typename T>
67  BoundingBox(T v1, T v2);
68 
69 
76  BoundingBox(std::string plyPath);
77 
84  template<typename T>
85  inline void expand(T v);
86 
93  inline void expand(const BoundingBox<BaseVecT>& bb);
94 
100  typename BaseVecT::CoordType getRadius() const;
101 
106  bool isValid() const;
107 
111  BaseVecT getCentroid() const;
112 
119  bool overlap(const BoundingBox<BaseVecT>& bb);
120 
124  typename BaseVecT::CoordType getLongestSide() const;
125 
129  typename BaseVecT::CoordType getXSize() const;
130 
134  typename BaseVecT::CoordType getYSize() const;
135 
139  typename BaseVecT::CoordType getZSize() const;
140 
145  typename BaseVecT::CoordType getVolume() const;
146 
150  BaseVecT getMax() const;
151 
155  BaseVecT getMin() const;
156 
157 private:
159  BaseVecT m_min;
160 
162  BaseVecT m_max;
163 
165  BaseVecT m_centroid;
166 };
167 
168 template<typename BaseVecT>
169 inline std::ostream& operator<<(std::ostream& os, const BoundingBox<BaseVecT>& bb)
170 {
171  os << "Bounding Box[min: " << bb.getMin() << " max: " << bb.getMax();
172  os << " dimension: " << bb.getXSize() << ", " << bb.getYSize() << ", "
173  << bb.getZSize() << "]" << std::endl;
174  return os;
175 }
176 
177 } // namespace lvr2
178 
179 #include "lvr2/geometry/BoundingBox.tcc"
180 
bool isValid() const
Returns true if the bounding box has been expanded before or was initialized with a preset size...
BaseVecT::CoordType getLongestSide() const
Returns the longest side of the bounding box.
void expand(T v)
Expands the bounding box if the given Vector v} is outside the current volume.
BaseVecT getMin() const
Returns the lower left coordinates.
BaseVecT::CoordType getZSize() const
Returns the z-size of the bounding box.
BaseVecT::CoordType getYSize() const
Returns the y-size of the bounding box.
A dynamic bounding box class.
Definition: BoundingBox.hpp:49
BaseVecT getCentroid() const
Returns the center Vector of the bounding box.
BaseVecT m_centroid
The center Vector of the bounding box.
BaseVecT m_max
The upper right Vector of the bounding box.
BaseVecT getMax() const
Returns the upper right coordinates.
BoundingBox()
Default constructor.
BaseVecT m_min
The lower left Vector of the bounding box.
BaseVecT::CoordType getXSize() const
Returns the x-size of the bounding box.
BaseVecT::CoordType getRadius() const
Returns the radius of the current volume, i.e. the distance between the centroid and the most distant...
BaseVecT::CoordType getVolume() const
Returns the volume of the bounding box.
bool overlap(const BoundingBox< BaseVecT > &bb)
check if current volume overlap with a given bounding box


lvr2
Author(s): Thomas Wiemann , Sebastian Pütz , Alexander Mock , Lars Kiesow , Lukas Kalbertodt , Tristan Igelbrink , Johan M. von Behren , Dominik Feldschnieders , Alexander Löhr
autogenerated on Mon Feb 28 2022 22:46:06