hpp-fcl: include/hpp/fcl/BV/OBBRSS.h Source File

hpp-fcl 1.7.2 HPP fork of FCL -- The Flexible Collision Library

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
42 #include <hpp/fcl/BV/OBB.h>
43 #include <hpp/fcl/BV/RSS.h>
44
45 namespace hpp
46 {
47 namespace fcl
48 {
49
50 struct CollisionRequest;
51
54
56 struct HPP_FCL_DLLAPI OBBRSS
57 {
58
60 OBB obb;
61
63 RSS rss;
64
66 bool operator==(const OBBRSS & other) const
67 {
68 return
69 obb == other.obb
70 && rss == other.rss;
71 }
72
74 bool operator!=(const OBBRSS & other) const
75 {
76 return !(*this == other);
77 }
78
80 inline bool contain(const Vec3f& p) const
81 {
82 return obb.contain(p);
83 }
84
86 bool overlap(const OBBRSS& other) const
87 {
88 return obb.overlap(other.obb);
89 }
90
94 bool overlap(const OBBRSS& other, const CollisionRequest& request,
95 FCL_REAL& sqrDistLowerBound) const
96 {
97 return obb.overlap(other.obb, request, sqrDistLowerBound);
98 }
99
101 FCL_REAL distance(const OBBRSS& other, Vec3f* P = NULL, Vec3f* Q = NULL) const
102 {
103 return rss.distance(other.rss, P, Q);
104 }
105
107 OBBRSS& operator += (const Vec3f& p)
108 {
109 obb += p;
110 rss += p;
111 return *this;
112 }
113
115 OBBRSS& operator += (const OBBRSS& other)
116 {
117 *this = *this + other;
118 return *this;
119 }
120
122 OBBRSS operator + (const OBBRSS& other) const
123 {
124 OBBRSS result;
125 result.obb = obb + other.obb;
126 result.rss = rss + other.rss;
127 return result;
128 }
129
131 inline FCL_REAL size() const
132 {
133 return obb.size();
134 }
135
137 inline const Vec3f& center() const
138 {
139 return obb.center();
140 }
141
143 inline FCL_REAL width() const
144 {
145 return obb.width();
146 }
147
149 inline FCL_REAL height() const
150 {
151 return obb.height();
152 }
153
155 inline FCL_REAL depth() const
156 {
157 return obb.depth();
158 }
159
161 inline FCL_REAL volume() const
162 {
163 return obb.volume();
164 }
165 };
166
168 inline bool overlap(const Matrix3f& R0, const Vec3f& T0, const OBBRSS& b1, const OBBRSS& b2)
169 {
170 return overlap(R0, T0, b1.obb, b2.obb);
171 }
172
178 inline bool overlap(const Matrix3f& R0, const Vec3f& T0, const OBBRSS& b1,
179 const OBBRSS& b2, const CollisionRequest& request,
180 FCL_REAL& sqrDistLowerBound)
181 {
182 return overlap(R0, T0, b1.obb, b2.obb, request, sqrDistLowerBound);
183 }
184
186 inline FCL_REAL distance(const Matrix3f& R0, const Vec3f& T0, const OBBRSS& b1, const OBBRSS& b2, Vec3f* P = NULL, Vec3f* Q = NULL)
187 {
188 return distance(R0, T0, b1.rss, b2.rss, P, Q);
189 }
190
191 }
192
193
194 } // namespace hpp
195
196 #endif
RSS.h
hpp::fcl::OBBRSS::center
const Vec3f & center() const
Center of the OBBRSS.
Definition: OBBRSS.h:137
hpp::fcl::OBB::height
FCL_REAL height() const
Height of the OBB.
Definition: OBB.h:136
hpp::fcl::OBBRSS::distance
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: OBBRSS.h:101
hpp::fcl::OBBRSS::overlap
bool overlap(const OBBRSS &other) const
Check collision between two OBBRSS.
Definition: OBBRSS.h:86
hpp::fcl::OBBRSS::depth
FCL_REAL depth() const
Depth of the OBBRSS.
Definition: OBBRSS.h:155
hpp::fcl::OBBRSS::obb
OBB obb
OBB member, for rotation.
Definition: OBBRSS.h:60
hpp::fcl::RSS::distance
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
hpp::fcl::distance
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.
hpp::fcl::OBBRSS::contain
bool contain(const Vec3f &p) const
Check whether the OBBRSS contains a point.
Definition: OBBRSS.h:80
hpp::fcl::OBB::overlap
bool overlap(const OBB &other) const
hpp::fcl::OBBRSS::width
FCL_REAL width() const
Width of the OBRSS.
Definition: OBBRSS.h:143
hpp::fcl::OBBRSS::volume
FCL_REAL volume() const
Volume of the OBBRSS.
Definition: OBBRSS.h:161
hpp::fcl::OBBRSS::overlap
bool overlap(const OBBRSS &other, const CollisionRequest &request, FCL_REAL &sqrDistLowerBound) const
Definition: OBBRSS.h:94
hpp::fcl::OBB::depth
FCL_REAL depth() const
Depth of the OBB.
Definition: OBB.h:142
hpp::fcl::overlap
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.
hpp::fcl::OBBRSS::rss
RSS rss
RSS member, for distance.
Definition: OBBRSS.h:63
hpp::fcl::OBB::volume
FCL_REAL volume() const
Volume of the OBB.
Definition: OBB.h:148
hpp::fcl::OBB::width
FCL_REAL width() const
Width of the OBB.
Definition: OBB.h:130
hpp::fcl::OBBRSS::operator==
bool operator==(const OBBRSS &other) const
Equality operator.
Definition: OBBRSS.h:66
hpp::fcl::OBBRSS::height
FCL_REAL height() const
Height of the OBBRSS.
Definition: OBBRSS.h:149
hpp::fcl::OBB::contain
bool contain(const Vec3f &p) const
Check whether the OBB contains a point.
hpp::fcl::OBBRSS::size
FCL_REAL size() const
Size of the OBBRSS (used in BV_Splitter to order two OBBRSS)
Definition: OBBRSS.h:131
hpp::fcl::OBB::center
const Vec3f & center() const
Center of the OBB.
Definition: OBB.h:124
hpp::fcl::OBB::size
FCL_REAL size() const
Size of the OBB (used in BV_Splitter to order two OBBs)
Definition: OBB.h:118
hpp::fcl::OBBRSS::operator!=
bool operator!=(const OBBRSS &other) const
Difference operator.
Definition: OBBRSS.h:74
OBB.h
hpp::fcl::Matrix3f
Eigen::Matrix< FCL_REAL, 3, 3 > Matrix3f
Definition: data_types.h:68
hpp::fcl::Vec3f
Eigen::Matrix< FCL_REAL, 3, 1 > Vec3f
Definition: data_types.h:67
hpp::fcl::FCL_REAL
double FCL_REAL
Definition: data_types.h:66
hpp
Main namespace.
Definition: AABB.h:44
hpp::fcl::CollisionRequest
request to the collision algorithm
Definition: collision_data.h:209
hpp::fcl::OBB
Oriented bounding box class.
Definition: OBB.h:55
hpp::fcl::OBBRSS
Class merging the OBB and RSS, can handle collision and distance simultaneously.
Definition: OBBRSS.h:57
hpp::fcl::RSS
A class for rectangle sphere-swept bounding volume.
Definition: RSS.h:56