coal/narrowphase/minkowski_difference.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  * Copyright (c) 2021-2024, INRIA
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  *
13  * * Redistributions of source code must retain the above copyright
14  * notice, this list of conditions and the following disclaimer.
15  * * Redistributions in binary form must reproduce the above
16  * copyright notice, this list of conditions and the following
17  * disclaimer in the documentation and/or other materials provided
18  * with the distribution.
19  * * Neither the name of Open Source Robotics Foundation nor the names of its
20  * contributors may be used to endorse or promote products derived
21  * from this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34  * POSSIBILITY OF SUCH DAMAGE.
35  */
36 
39 #ifndef COAL_MINKOWSKI_DIFFERENCE_H
40 #define COAL_MINKOWSKI_DIFFERENCE_H
41 
43 #include "coal/math/transform.h"
45 
46 namespace coal {
47 
48 namespace details {
49 
53 struct COAL_DLLAPI MinkowskiDiff {
54  typedef Eigen::Array<CoalScalar, 1, 2> Array2d;
55 
57  const ShapeBase* shapes[2];
58 
62 
66 
70 
75 
80 
81  typedef void (*GetSupportFunction)(const MinkowskiDiff& minkowskiDiff,
82  const Vec3s& dir, Vec3s& support0,
83  Vec3s& support1,
86  GetSupportFunction getSupportFunc;
87 
88  MinkowskiDiff() : normalize_support_direction(false), getSupportFunc(NULL) {}
89 
116  template <int _SupportOptions = SupportOptions::NoSweptSphere>
117  void set(const ShapeBase* shape0, const ShapeBase* shape1);
118 
128  template <int _SupportOptions = SupportOptions::NoSweptSphere>
129  void set(const ShapeBase* shape0, const ShapeBase* shape1,
130  const Transform3s& tf0, const Transform3s& tf1);
131 
141  template <int _SupportOptions = SupportOptions::NoSweptSphere>
142  inline Vec3s support0(const Vec3s& dir, int& hint) const {
143  return getSupport<_SupportOptions>(shapes[0], dir, hint);
144  }
145 
158  template <int _SupportOptions = SupportOptions::NoSweptSphere>
159  inline Vec3s support1(const Vec3s& dir, int& hint) const {
160  // clang-format off
161  return oR1 * getSupport<_SupportOptions>(shapes[1], oR1.transpose() * dir, hint) + ot1;
162  // clang-format on
163  }
164 
174  inline void support(const Vec3s& dir, Vec3s& supp0, Vec3s& supp1,
175  support_func_guess_t& hint) const {
176  assert(getSupportFunc != NULL);
177  getSupportFunc(*this, dir, supp0, supp1, hint,
178  const_cast<ShapeSupportData*>(data));
179  }
180 };
181 
182 } // namespace details
183 
184 } // namespace coal
185 
186 #endif // COAL_MINKOWSKI_DIFFERENCE_H
coal::Vec3s
Eigen::Matrix< CoalScalar, 3, 1 > Vec3s
Definition: coal/data_types.h:77
coal::details::MinkowskiDiff::normalize_support_direction
bool normalize_support_direction
Wether or not to use the normalize heuristic in the GJK Nesterov acceleration. This setting is only a...
Definition: coal/narrowphase/minkowski_difference.h:79
coal::details::MinkowskiDiff::Array2d
Eigen::Array< CoalScalar, 1, 2 > Array2d
Definition: coal/narrowphase/minkowski_difference.h:54
coal::details::ShapeSupportData
Stores temporary data for the computation of support points.
Definition: coal/narrowphase/support_functions.h:80
coal::details::MinkowskiDiff
Minkowski difference class of two shapes.
Definition: coal/narrowphase/minkowski_difference.h:53
support_functions.h
gjk.tf1
tuple tf1
Definition: test/scripts/gjk.py:27
data
data
coal
Main namespace.
Definition: coal/broadphase/broadphase_bruteforce.h:44
coal::details::MinkowskiDiff::support
void support(const Vec3s &dir, Vec3s &supp0, Vec3s &supp1, support_func_guess_t &hint) const
Support function for the pair of shapes. This method assumes set has already been called.
Definition: coal/narrowphase/minkowski_difference.h:174
coal::details::MinkowskiDiff::support1
Vec3s support1(const Vec3s &dir, int &hint) const
support function for shape1. The output vector is expressed in the local frame of shape0....
Definition: coal/narrowphase/minkowski_difference.h:159
coal::details::MinkowskiDiff::getSupportFunc
GetSupportFunction getSupportFunc
Definition: coal/narrowphase/minkowski_difference.h:86
coal::details::MinkowskiDiff::support0
Vec3s support0(const Vec3s &dir, int &hint) const
support function for shape0. The output vector is expressed in the local frame of shape0.
Definition: coal/narrowphase/minkowski_difference.h:142
coal::Transform3s
Simple transform class used locally by InterpMotion.
Definition: coal/math/transform.h:55
coal::details::MinkowskiDiff::swept_sphere_radius
Array2d swept_sphere_radius
The radii of the sphere swepted around each shape of the Minkowski difference. The 2 values correspon...
Definition: coal/narrowphase/minkowski_difference.h:74
transform.h
coal::support_func_guess_t
Eigen::Vector2i support_func_guess_t
Definition: coal/data_types.h:87
coal::ShapeBase
Base class for all basic geometric shapes.
Definition: coal/shape/geometric_shapes.h:58
coal::details::MinkowskiDiff::MinkowskiDiff
MinkowskiDiff()
Definition: coal/narrowphase/minkowski_difference.h:88
coal::details::MinkowskiDiff::ot1
Vec3s ot1
translation from shape1 to shape0 such that .
Definition: coal/narrowphase/minkowski_difference.h:69
coal::Matrix3s
Eigen::Matrix< CoalScalar, 3, 3 > Matrix3s
Definition: coal/data_types.h:81
coal::details::MinkowskiDiff::oR1
Matrix3s oR1
rotation from shape1 to shape0 such that .
Definition: coal/narrowphase/minkowski_difference.h:65
geometric_shapes.h


hpp-fcl
Author(s):
autogenerated on Sat Nov 23 2024 03:44:58