OBBRSS-inl.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-2016, 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 FCL_BV_OBBRSS_INL_H
39 #define FCL_BV_OBBRSS_INL_H
40 
41 #include "fcl/math/bv/OBBRSS.h"
42 
43 namespace fcl
44 {
45 
46 //==============================================================================
47 extern template
48 class FCL_EXPORT OBBRSS<double>;
49 
50 //==============================================================================
51 extern template
52 OBBRSS<double> translate(const OBBRSS<double>& bv, const Vector3<double>& t);
53 
54 //==============================================================================
55 template <typename S>
56 bool OBBRSS<S>::overlap(const OBBRSS<S>& other) const
57 {
58  return obb.overlap(other.obb);
59 }
60 
61 //==============================================================================
62 template <typename S>
63 bool OBBRSS<S>::overlap(const OBBRSS<S>& other,
64  OBBRSS<S>& /*overlap_part*/) const
65 {
66  return overlap(other);
67 }
68 
69 //==============================================================================
70 template <typename S>
71 bool OBBRSS<S>::contain(const Vector3<S>& p) const
72 {
73  return obb.contain(p);
74 }
75 
76 //==============================================================================
77 template <typename S>
79 {
80  obb += p;
81  rss += p;
82  return *this;
83 }
84 
85 //==============================================================================
86 template <typename S>
88 {
89  *this = *this + other;
90  return *this;
91 }
92 
93 //==============================================================================
94 template <typename S>
96 {
97  OBBRSS<S> result;
98  result.obb = obb + other.obb;
99  result.rss = rss + other.rss;
100  return result;
101 }
102 
103 //==============================================================================
104 template <typename S>
106 {
107  return obb.width();
108 }
109 
110 //==============================================================================
111 template <typename S>
113 {
114  return obb.height();
115 }
116 
117 //==============================================================================
118 template <typename S>
120 {
121  return obb.depth();
122 }
123 
124 //==============================================================================
125 template <typename S>
127 {
128  return obb.volume();
129 }
130 
131 //==============================================================================
132 template <typename S>
134 {
135  return obb.size();
136 }
137 
138 //==============================================================================
139 template <typename S>
141 {
142  return obb.center();
143 }
144 
145 //==============================================================================
146 template <typename S>
148  Vector3<S>* P, Vector3<S>* Q) const
149 {
150  return rss.distance(other.rss, P, Q);
151 }
152 
153 //==============================================================================
154 template <typename S, typename DerivedA, typename DerivedB>
155 bool overlap(const Eigen::MatrixBase<DerivedA>& R0,
156  const Eigen::MatrixBase<DerivedB>& T0,
157  const OBBRSS<S>& b1, const OBBRSS<S>& b2)
158 {
159  return overlap(R0, T0, b1.obb, b2.obb);
160 }
161 
162 //==============================================================================
163 template <typename S, typename DerivedA, typename DerivedB>
165  const Eigen::MatrixBase<DerivedA>& R0,
166  const Eigen::MatrixBase<DerivedB>& T0,
167  const OBBRSS<S>& b1, const OBBRSS<S>& b2,
168  Vector3<S>* P, Vector3<S>* Q)
169 {
170  return distance(R0, T0, b1.rss, b2.rss, P, Q);
171 }
172 
173 //==============================================================================
174 template <typename S>
176 {
177  OBBRSS<S> res(bv);
178  res.obb.To += t;
179  res.rss.To += t;
180  return res;
181 }
182 
183 } // namespace fcl
184 
185 #endif
fcl::OBBRSS::height
S height() const
Height of the OBBRSS.
Definition: OBBRSS-inl.h:112
fcl::translate
OBBRSS< S > translate(const OBBRSS< S > &bv, const Vector3< S > &t)
Translate the OBBRSS bv.
Definition: OBBRSS-inl.h:175
fcl::OBBRSS::overlap
bool overlap(const OBBRSS< S > &other) const
Check collision between two OBBRSS.
Definition: OBBRSS-inl.h:56
fcl::OBBRSS::center
const Vector3< S > center() const
Center of the OBBRSS.
Definition: OBBRSS-inl.h:140
fcl::translate
AABB< S > translate(const AABB< S > &aabb, const Eigen::MatrixBase< Derived > &t)
translate the center of AABB by t
Definition: AABB-inl.h:345
fcl::OBBRSS::width
S width() const
Width of the OBRSS.
Definition: OBBRSS-inl.h:105
fcl::OBBRSS::volume
S volume() const
Volume of the OBBRSS.
Definition: OBBRSS-inl.h:126
fcl::RSS::To
Vector3< S > To
Origin of frame T in frame F.
Definition: RSS.h:76
fcl::Vector3
Eigen::Matrix< S, 3, 1 > Vector3
Definition: types.h:70
fcl::OBBRSS< Shape::S >::S
Shape::S S
Definition: OBBRSS.h:54
fcl::overlap
bool overlap(const Eigen::MatrixBase< DerivedA > &R0, const Eigen::MatrixBase< DerivedB > &T0, const OBBRSS< S > &b1, const OBBRSS< S > &b2)
Check collision between two OBBRSS, b1 is in configuration (R0, T0) and b2 is in indentity.
Definition: OBBRSS-inl.h:155
fcl::OBBRSS::obb
OBB< S > obb
OBB member, for rotation.
Definition: OBBRSS.h:57
fcl::distance
S distance(const Eigen::MatrixBase< DerivedA > &R0, const Eigen::MatrixBase< DerivedB > &T0, const OBBRSS< S > &b1, const OBBRSS< S > &b2, Vector3< S > *P, Vector3< S > *Q)
Computate distance between two OBBRSS, b1 is in configuation (R0, T0) and b2 is in indentity; P and Q...
Definition: OBBRSS-inl.h:164
fcl::OBBRSS::depth
S depth() const
Depth of the OBBRSS.
Definition: OBBRSS-inl.h:119
fcl::OBBRSS< S >
fcl::OBBRSS::rss
RSS< S > rss
RSS member, for distance.
Definition: OBBRSS.h:60
OBBRSS.h
fcl::OBBRSS< double >
template class FCL_EXPORT OBBRSS< double >
fcl::OBBRSS::size
S size() const
Size of the OBBRSS (used in BV_Splitter to order two OBBRSS)
Definition: OBBRSS-inl.h:133
fcl::OBBRSS::contain
bool contain(const Vector3< S > &p) const
Check whether the OBBRSS contains a point.
Definition: OBBRSS-inl.h:71
fcl::OBBRSS::overlap
bool overlap(const OBBRSS< S > &other, OBBRSS< S > &overlap_part) const
Check collision between two OBBRSS and return the overlap part.
Definition: OBBRSS-inl.h:63
fcl
Main namespace.
Definition: broadphase_bruteforce-inl.h:45
fcl::OBB::To
Vector3< S > To
Center of OBB.
Definition: OBB.h:65
fcl::operator+
template TMatrix3< double > operator+(const Matrix3< double > &m1, const TMatrix3< double > &m2)


fcl
Author(s):
autogenerated on Tue Dec 5 2023 03:40:48