BV/OBBRSS.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_OBBRSS_H
39 #define HPP_FCL_OBBRSS_H
40 
41 #include <hpp/fcl/BV/OBB.h>
42 #include <hpp/fcl/BV/RSS.h>
43 
44 namespace hpp {
45 namespace fcl {
46 
47 struct CollisionRequest;
48 
51 
54 struct HPP_FCL_DLLAPI OBBRSS {
57 
60 
62  bool operator==(const OBBRSS& other) const {
63  return obb == other.obb && rss == other.rss;
64  }
65 
67  bool operator!=(const OBBRSS& other) const { return !(*this == other); }
68 
70  inline bool contain(const Vec3f& p) const { return obb.contain(p); }
71 
73  bool overlap(const OBBRSS& other) const { return obb.overlap(other.obb); }
74 
78  bool overlap(const OBBRSS& other, const CollisionRequest& request,
79  FCL_REAL& sqrDistLowerBound) const {
80  return obb.overlap(other.obb, request, sqrDistLowerBound);
81  }
82 
85  FCL_REAL distance(const OBBRSS& other, Vec3f* P = NULL,
86  Vec3f* Q = NULL) const {
87  return rss.distance(other.rss, P, Q);
88  }
89 
91  OBBRSS& operator+=(const Vec3f& p) {
92  obb += p;
93  rss += p;
94  return *this;
95  }
96 
98  OBBRSS& operator+=(const OBBRSS& other) {
99  *this = *this + other;
100  return *this;
101  }
102 
104  OBBRSS operator+(const OBBRSS& other) const {
105  OBBRSS result;
106  result.obb = obb + other.obb;
107  result.rss = rss + other.rss;
108  return result;
109  }
110 
112  inline FCL_REAL size() const { return obb.size(); }
113 
115  inline const Vec3f& center() const { return obb.center(); }
116 
118  inline FCL_REAL width() const { return obb.width(); }
119 
121  inline FCL_REAL height() const { return obb.height(); }
122 
124  inline FCL_REAL depth() const { return obb.depth(); }
125 
127  inline FCL_REAL volume() const { return obb.volume(); }
128 };
129 
132 inline bool overlap(const Matrix3f& R0, const Vec3f& T0, const OBBRSS& b1,
133  const OBBRSS& b2) {
134  return overlap(R0, T0, b1.obb, b2.obb);
135 }
136 
143 inline bool overlap(const Matrix3f& R0, const Vec3f& T0, const OBBRSS& b1,
144  const OBBRSS& b2, const CollisionRequest& request,
145  FCL_REAL& sqrDistLowerBound) {
146  return overlap(R0, T0, b1.obb, b2.obb, request, sqrDistLowerBound);
147 }
148 
151 inline FCL_REAL distance(const Matrix3f& R0, const Vec3f& T0, const OBBRSS& b1,
152  const OBBRSS& b2, Vec3f* P = NULL, Vec3f* Q = NULL) {
153  return distance(R0, T0, b1.rss, b2.rss, P, Q);
154 }
155 
156 } // namespace fcl
157 
158 } // namespace hpp
159 
160 #endif
bool overlap(const OBBRSS &other, const CollisionRequest &request, FCL_REAL &sqrDistLowerBound) const
Definition: BV/OBBRSS.h:78
FCL_REAL width() const
Width of the OBRSS.
Definition: BV/OBBRSS.h:118
OBB obb
OBB member, for rotation.
Definition: BV/OBBRSS.h:56
FCL_REAL volume() const
Volume of the OBB.
Main namespace.
bool operator!=(const OBBRSS &other) const
Difference operator.
Definition: BV/OBBRSS.h:67
OBBRSS & operator+=(const Vec3f &p)
Merge the OBBRSS and a point.
Definition: BV/OBBRSS.h:91
OBBRSS operator+(const OBBRSS &other) const
Merge two OBBRSS.
Definition: BV/OBBRSS.h:104
FCL_REAL height() const
Height of the OBB.
Eigen::Matrix< FCL_REAL, 3, 3 > Matrix3f
Definition: data_types.h:68
FCL_REAL volume() const
Volume of the OBBRSS.
Definition: BV/OBBRSS.h:127
bool overlap(const OBB &other) const
Definition: OBB.cpp:394
P
const Vec3f & center() const
Center of the OBBRSS.
Definition: BV/OBBRSS.h:115
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
bool contain(const Vec3f &p) const
Check whether the OBBRSS contains a point.
Definition: BV/OBBRSS.h:70
bool operator==(const OBBRSS &other) const
Equality operator.
Definition: BV/OBBRSS.h:62
double FCL_REAL
Definition: data_types.h:65
RSS rss
RSS member, for distance.
Definition: BV/OBBRSS.h:59
FCL_REAL depth() const
Depth of the OBB.
A class for rectangle sphere-swept bounding volume.
Definition: BV/RSS.h:53
bool overlap(const OBBRSS &other) const
Check collision between two OBBRSS.
Definition: BV/OBBRSS.h:73
FCL_REAL distance(const OBBRSS &other, Vec3f *P=NULL, Vec3f *Q=NULL) const
Distance between two OBBRSS; P and Q , is not NULL, returns the nearest points.
Definition: BV/OBBRSS.h:85
FCL_REAL distance(const RSS &other, Vec3f *P=NULL, Vec3f *Q=NULL) const
the distance between two RSS; P and Q, if not NULL, return the nearest points
Definition: RSS.cpp:983
FCL_REAL size() const
Size of the OBB (used in BV_Splitter to order two OBBs)
bool contain(const Vec3f &p) const
Check whether the OBB contains a point.
Definition: OBB.cpp:424
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
FCL_REAL height() const
Height of the OBBRSS.
Definition: BV/OBBRSS.h:121
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.
FCL_REAL depth() const
Depth of the OBBRSS.
Definition: BV/OBBRSS.h:124
Class merging the OBB and RSS, can handle collision and distance simultaneously.
Definition: BV/OBBRSS.h:54
FCL_REAL size() const
Size of the OBBRSS (used in BV_Splitter to order two OBBRSS)
Definition: BV/OBBRSS.h:112
Oriented bounding box class.
OBBRSS & operator+=(const OBBRSS &other)
Merge two OBBRSS.
Definition: BV/OBBRSS.h:98


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