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 
lvr2::BoundingBox::isValid
bool isValid() const
Returns true if the bounding box has been expanded before or was initialized with a preset size.
lvr2::BaseVector< float >
lvr2::BoundingBox::m_max
BaseVecT m_max
The upper right Vector of the bounding box.
Definition: BoundingBox.hpp:162
lvr2::BoundingBox::m_centroid
BaseVecT m_centroid
The center Vector of the bounding box.
Definition: BoundingBox.hpp:165
lvr2::BoundingBox::getMax
BaseVecT getMax() const
Returns the upper right coordinates.
lvr2::BoundingBox::BoundingBox
BoundingBox()
Default constructor.
lvr2::operator<<
std::ostream & operator<<(std::ostream &os, const BaseVector< T > &v)
Definition: BaseVector.hpp:227
lvr2::BoundingBox::getXSize
BaseVecT::CoordType getXSize() const
Returns the x-size of the bounding box.
lvr2::BoundingBox::m_min
BaseVecT m_min
The lower left Vector of the bounding box.
Definition: BoundingBox.hpp:159
lvr2::BoundingBox::getYSize
BaseVecT::CoordType getYSize() const
Returns the y-size of the bounding box.
lvr2::BoundingBox::overlap
bool overlap(const BoundingBox< BaseVecT > &bb)
check if current volume overlap with a given bounding box
LineReader.hpp
lvr2::BoundingBox
A dynamic bounding box class.
Definition: BoundingBox.hpp:49
lvr2::BoundingBox::getRadius
BaseVecT::CoordType getRadius() const
Returns the radius of the current volume, i.e. the distance between the centroid and the most distant...
lvr2::BoundingBox::getCentroid
BaseVecT getCentroid() const
Returns the center Vector of the bounding box.
lvr2::BoundingBox::expand
void expand(T v)
Expands the bounding box if the given Vector v} is outside the current volume.
lvr2::BoundingBox::getZSize
BaseVecT::CoordType getZSize() const
Returns the z-size of the bounding box.
lvr2
Definition: BaseBufferManipulators.hpp:39
lvr2::BoundingBox::getVolume
BaseVecT::CoordType getVolume() const
Returns the volume of the bounding box.
lvr2::BoundingBox::getMin
BaseVecT getMin() const
Returns the lower left coordinates.
lvr2::BoundingBox::getLongestSide
BaseVecT::CoordType getLongestSide() const
Returns the longest side of the 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 Wed Mar 2 2022 00:37:22