obb.h
Go to the documentation of this file.
1 /*********************************************************************
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2021, Open Robotics
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the following
15  * disclaimer in the documentation and/or other materials provided
16  * with the distribution.
17  * * Neither the name of Open Robotics nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  *********************************************************************/
34 
35 /* Author: Martin Pecka */
36 
37 #ifndef GEOMETRIC_SHAPES_OBB_H
38 #define GEOMETRIC_SHAPES_OBB_H
39 
40 #include <memory>
41 
42 #include <Eigen/Core>
43 #include <Eigen/Geometry>
44 
45 #include <geometric_shapes/aabb.h>
46 
47 namespace bodies
48 {
49 class OBBPrivate;
50 
52 class OBB
53 {
54 public:
55  OBB();
56  OBB(const OBB& other);
57  OBB(const Eigen::Isometry3d& pose, const Eigen::Vector3d& extents);
58  virtual ~OBB();
59 
60  OBB& operator=(const OBB& other);
61 
67  void setPoseAndExtents(const Eigen::Isometry3d& pose, const Eigen::Vector3d& extents);
68 
73  Eigen::Vector3d getExtents() const;
74 
79  void getExtents(Eigen::Vector3d& extents) const;
80 
85  Eigen::Isometry3d getPose() const;
86 
91  void getPose(Eigen::Isometry3d& pose) const;
92 
97  AABB toAABB() const;
98 
103  void toAABB(AABB& aabb) const;
104 
110  OBB* extendApprox(const OBB& box);
111 
117  bool contains(const Eigen::Vector3d& point);
118 
124  bool overlaps(const OBB& other);
125 
126 protected:
128  std::unique_ptr<OBBPrivate> obb_;
129 };
130 } // namespace bodies
131 
132 #endif // GEOMETRIC_SHAPES_OBB_H
bodies::OBB::getExtents
Eigen::Vector3d getExtents() const
Get the extents of the OBB.
Definition: obb.cpp:86
bodies::OBB::toAABB
AABB toAABB() const
Convert this OBB to an axis-aligned BB.
Definition: obb.cpp:121
bodies::OBB::~OBB
virtual ~OBB()
bodies::OBB::contains
bool contains(const Eigen::Vector3d &point)
Check if this OBB contains the given point.
Definition: obb.cpp:139
bodies::OBB::OBB
OBB()
Definition: obb.cpp:43
bodies::OBB::extendApprox
OBB * extendApprox(const OBB &box)
Add the other OBB to this one and compute an approximate enclosing OBB.
Definition: obb.cpp:133
bodies::OBB::obb_
std::unique_ptr< OBBPrivate > obb_
PIMPL pointer.
Definition: obb.h:160
bodies::OBB::overlaps
bool overlaps(const OBB &other)
Check whether this and the given OBBs have nonempty intersection.
Definition: obb.cpp:144
aabb.h
point
std::chrono::system_clock::time_point point
bodies::OBB::getPose
Eigen::Isometry3d getPose() const
Get the pose of the OBB.
Definition: obb.cpp:114
bodies
This set of classes allows quickly detecting whether a given point is inside an object or not....
Definition: aabb.h:42
bodies::OBB::setPoseAndExtents
void setPoseAndExtents(const Eigen::Isometry3d &pose, const Eigen::Vector3d &extents)
Set both the pose and extents of the OBB.
Definition: obb.cpp:64
bodies::OBB::operator=
OBB & operator=(const OBB &other)
Definition: obb.cpp:58


geometric_shapes
Author(s): Ioan Sucan , Gil Jones
autogenerated on Fri Apr 1 2022 02:40:31