kIOS.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_KIOS_H
39 #define FCL_BV_KIOS_H
40 
41 #include "fcl/math/bv/OBB.h"
42 
43 namespace fcl
44 {
45 
47 template <typename S_>
48 class FCL_EXPORT kIOS
49 {
51  struct kIOS_Sphere
52  {
54  S_ r;
55  };
56 
58  static kIOS_Sphere encloseSphere(
59  const kIOS_Sphere& s0, const kIOS_Sphere& s1);
60 
61 public:
62 
63  using S = S_;
64 
66  kIOS_Sphere spheres[5];
67 
69  unsigned int num_spheres;
70 
73 
75  bool overlap(const kIOS<S>& other) const;
76 
82  bool overlap(const kIOS<S>& other, kIOS<S>& overlap_part) const;
83 
85  bool contain(const Vector3<S>& p) const;
86 
88  kIOS<S>& operator += (const Vector3<S>& p);
89 
91  kIOS<S>& operator += (const kIOS<S>& other);
92 
94  kIOS<S> operator + (const kIOS<S>& other) const;
95 
97  const Vector3<S>& center() const;
98 
100  S width() const;
101 
103  S height() const;
104 
106  S depth() const;
107 
109  S volume() const;
110 
112  S size() const;
113 
115  S distance(
116  const kIOS<S>& other,
117  Vector3<S>* P = nullptr, Vector3<S>* Q = nullptr) const;
118 
119  static constexpr S ratio() { return 1.5; }
120  static constexpr S invSinA() { return 2; }
121  static S cosA() { return std::sqrt(3.0) / 2.0; }
122 };
123 
126 
128 template <typename S, typename Derived>
129 FCL_EXPORT
131  const kIOS<S>& bv, const Eigen::MatrixBase<Derived>& t);
132 
136 template <typename S, typename DerivedA, typename DerivedB>
137 FCL_EXPORT
138 bool overlap(
139  const Eigen::MatrixBase<DerivedA>& R0,
140  const Eigen::MatrixBase<DerivedB>& T0,
141  const kIOS<S>& b1, const kIOS<S>& b2);
142 
146 template <typename S>
147 FCL_EXPORT
148 bool overlap(
149  const Transform3<S>& tf,
150  const kIOS<S>& b1,
151  const kIOS<S>& b2);
152 
155 template <typename S, typename DerivedA, typename DerivedB>
156 FCL_EXPORT
157 S distance(
158  const Eigen::MatrixBase<DerivedA>& R0,
159  const Eigen::MatrixBase<DerivedB>& T0,
160  const kIOS<S>& b1,
161  const kIOS<S>& b2,
162  Vector3<S>* P = nullptr,
163  Vector3<S>* Q = nullptr);
164 
167 template <typename S>
168 FCL_EXPORT
169 S distance(
170  const Transform3<S>& tf,
171  const kIOS<S>& b1,
172  const kIOS<S>& b2,
173  Vector3<S>* P = nullptr,
174  Vector3<S>* Q = nullptr);
175 
176 } // namespace fcl
177 
178 #include "fcl/math/bv/kIOS-inl.h"
179 
180 #endif
fcl::Transform3
Eigen::Transform< S, 3, Eigen::Isometry > Transform3
Definition: types.h:91
fcl::kIOS::invSinA
static constexpr S invSinA()
Definition: kIOS.h:120
fcl::kIOS
A class describing the kIOS collision structure, which is a set of spheres.
Definition: kIOS.h:48
kIOS-inl.h
fcl::distance
S distance(const Eigen::MatrixBase< DerivedA > &R0, const Eigen::MatrixBase< DerivedB > &T0, const kIOS< S > &b1, const kIOS< S > &b2, Vector3< S > *P, Vector3< S > *Q)
Approximate distance between two kIOS bounding volumes.
Definition: kIOS-inl.h:266
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::overlap
bool overlap(const Eigen::MatrixBase< DerivedA > &R0, const Eigen::MatrixBase< DerivedB > &T0, const kIOS< S > &b1, const kIOS< S > &b2)
Check collision between two kIOSs, b1 is in configuration (R0, T0) and b2 is in identity.
Definition: kIOS-inl.h:249
fcl::kIOS::kIOS_Sphere
One sphere in kIOS.
Definition: kIOS.h:51
fcl::Vector3
Eigen::Matrix< S, 3, 1 > Vector3
Definition: types.h:70
fcl::kIOS::ratio
static constexpr S ratio()
Definition: kIOS.h:119
fcl::kIOS::cosA
static S cosA()
Definition: kIOS.h:121
fcl::OBB< S >
fcl::kIOS< Shape::S >::S
Shape::S S
Definition: kIOS.h:63
fcl::kIOS::obb
OBB< S > obb
OBB related with kIOS.
Definition: kIOS.h:72
fcl::kIOS::num_spheres
unsigned int num_spheres
The number of spheres, no larger than 5.
Definition: kIOS.h:69
fcl::kIOS::kIOS_Sphere::r
S_ r
Definition: kIOS.h:54
OBB.h
fcl
Main namespace.
Definition: broadphase_bruteforce-inl.h:45
fcl::kIOS::kIOS_Sphere::o
Vector3< S_ > o
Definition: kIOS.h:53
fcl::operator+
template TMatrix3< double > operator+(const Matrix3< double > &m1, const TMatrix3< double > &m2)


fcl
Author(s):
autogenerated on Tue Jun 22 2021 07:27:51