include/hpp/fcl/BV/OBB.h
Go to the documentation of this file.
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2011-2014, Willow Garage, Inc.
5  * Copyright (c) 2014-2015, Open Source Robotics Foundation
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above
15  * copyright notice, this list of conditions and the following
16  * disclaimer in the documentation and/or other materials provided
17  * with the distribution.
18  * * Neither the name of Open Source Robotics Foundation nor the names of its
19  * contributors may be used to endorse or promote products derived
20  * from this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33  * POSSIBILITY OF SUCH DAMAGE.
34  */
35 
38 #ifndef HPP_FCL_OBB_H
39 #define HPP_FCL_OBB_H
40 
41 #include <hpp/fcl/data_types.h>
42 
43 namespace hpp {
44 namespace fcl {
45 
46 struct CollisionRequest;
47 
50 
52 struct HPP_FCL_DLLAPI OBB {
59 
62 
65 
66  OBB() : axes(Matrix3f::Zero()), To(Vec3f::Zero()), extent(Vec3f::Zero()) {}
67 
69  bool operator==(const OBB& other) const {
70  return axes == other.axes && To == other.To && extent == other.extent;
71  }
72 
74  bool operator!=(const OBB& other) const { return !(*this == other); }
75 
77  bool contain(const Vec3f& p) const;
78 
81  bool overlap(const OBB& other) const;
82 
87  bool overlap(const OBB& other, const CollisionRequest& request,
88  FCL_REAL& sqrDistLowerBound) const;
89 
91  FCL_REAL distance(const OBB& other, Vec3f* P = NULL, Vec3f* Q = NULL) const;
92 
95  OBB& operator+=(const Vec3f& p);
96 
98  OBB& operator+=(const OBB& other) {
99  *this = *this + other;
100  return *this;
101  }
102 
105  OBB operator+(const OBB& other) const;
106 
108  inline FCL_REAL size() const { return extent.squaredNorm(); }
109 
111  inline const Vec3f& center() const { return To; }
112 
114  inline FCL_REAL width() const { return 2 * extent[0]; }
115 
117  inline FCL_REAL height() const { return 2 * extent[1]; }
118 
120  inline FCL_REAL depth() const { return 2 * extent[2]; }
121 
123  inline FCL_REAL volume() const { return width() * height() * depth(); }
124 };
125 
127 HPP_FCL_DLLAPI OBB translate(const OBB& bv, const Vec3f& t);
128 
131 HPP_FCL_DLLAPI bool overlap(const Matrix3f& R0, const Vec3f& T0, const OBB& b1,
132  const OBB& b2);
133 
136 HPP_FCL_DLLAPI bool overlap(const Matrix3f& R0, const Vec3f& T0, const OBB& b1,
137  const OBB& b2, const CollisionRequest& request,
138  FCL_REAL& sqrDistLowerBound);
139 
145 HPP_FCL_DLLAPI bool obbDisjoint(const Matrix3f& B, const Vec3f& T,
146  const Vec3f& a, const Vec3f& b);
147 } // namespace fcl
148 
149 } // namespace hpp
150 
151 #endif
FCL_REAL volume() const
Volume of the OBB.
Main namespace.
t
FCL_REAL height() const
Height of the OBB.
Eigen::Matrix< FCL_REAL, 3, 3 > Matrix3f
Definition: data_types.h:68
P
HPP_FCL_DLLAPI bool obbDisjoint(const Matrix3f &B, const Vec3f &T, const Vec3f &a, const Vec3f &b)
Definition: OBB.cpp:162
request to the collision algorithm
HPP_FCL_DLLAPI FCL_REAL distance(const Matrix3f &R0, const Vec3f &T0, const kIOS &b1, const kIOS &b2, Vec3f *P=NULL, Vec3f *Q=NULL)
Approximate distance between two kIOS bounding volumes.
Definition: kIOS.cpp:181
double FCL_REAL
Definition: data_types.h:65
FCL_REAL depth() const
Depth of the OBB.
OBB & operator+=(const OBB &other)
Merge the OBB and another OBB (the result is not compact).
static AABB translate(const AABB &aabb, const Vec3f &t)
translate the center of AABB by t
Definition: BV/AABB.h:226
FCL_REAL size() const
Size of the OBB (used in BV_Splitter to order two OBBs)
B
HPP_FCL_DLLAPI bool overlap(const Matrix3f &R0, const Vec3f &T0, const AABB &b1, const AABB &b2)
Check collision between two aabbs, b1 is in configuration (R0, T0) and b2 is in identity.
Definition: AABB.cpp:134
bool operator==(const OBB &other) const
Equality operator.
Vec3f To
Center of OBB.
list a
Eigen::Matrix< FCL_REAL, 3, 1 > Vec3f
Definition: data_types.h:66
const Vec3f & center() const
Center of the OBB.
FCL_REAL width() const
Width of the OBB.
Matrix3f axes
Orientation of OBB. axis[i] is the ith column of the orientation matrix for the box; it is also the i...
bool operator!=(const OBB &other) const
Difference operator.
Vec3f extent
Half dimensions of OBB.
Oriented bounding box class.


hpp-fcl
Author(s):
autogenerated on Fri Jun 2 2023 02:39:01