Euclid
Geometry Processing and Shape Analysis in C++
OBB.h
1 #pragma once
2 
3 #include <array>
4 #include <vector>
5 
6 #include <Eigen/Core>
7 
8 namespace Euclid
9 {
16 template<typename Kernel>
17 class OBB
18 {
19 public:
20  using Point_3 = typename Kernel::Point_3;
21  using Vector_3 = typename Kernel::Vector_3;
22  using FT = typename Kernel::FT;
23 
24 public:
28  void build(const std::vector<FT>& positions);
29 
33  template<typename ForwardIterator, typename VPMap>
34  void build(ForwardIterator first, ForwardIterator beyond, VPMap vpmap);
35 
39  template<typename Derived>
40  void build(const Eigen::MatrixBase<Derived>& v);
41 
45  Point_3 center() const;
46 
53  Vector_3 axis(int n) const;
54 
60  FT length(int n) const;
61 
62 private:
63  template<typename Derived>
64  void _build(const Eigen::MatrixBase<Derived>& points);
65 
66 private:
67  Point_3 _center;
68  std::array<Vector_3, 3> _directions;
69 };
70 
72 } // namespace Euclid
73 
74 #include "src/OBB.cpp"
Vector_3 axis(int n) const
Return the unit-length axis.
Definition: OBB.cpp:61
Point_3 center() const
Return the center of the box.
Definition: OBB.cpp:55
Definition: AABB.h:6
void build(const std::vector< FT > &positions)
Build OBB for a set of raw positions.
Definition: OBB.cpp:12
FT length(int n) const
Return the length of an axis.
Definition: OBB.cpp:70
Object oriented bounding box.
Definition: OBB.h:17