gjk.cc
Go to the documentation of this file.
1 //
2 // Software License Agreement (BSD License)
3 //
4 // Copyright (c) 2020 CNRS-LAAS
5 // Author: Joseph Mirabel
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 CNRS-LAAS. 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 #include <eigenpy/eigenpy.hpp>
36 
37 #include "fcl.hh"
38 
39 #include <hpp/fcl/fwd.hh>
41 
42 #ifdef HPP_FCL_HAS_DOXYGEN_AUTODOC
43 #include "doxygen_autodoc/functions.h"
44 #include "doxygen_autodoc/hpp/fcl/narrowphase/gjk.h"
45 #endif
46 
47 using namespace boost::python;
48 using namespace hpp::fcl;
52 
53 void exposeGJK() {
54  if (!eigenpy::register_symbolic_link_to_registered_type<GJK::Status>()) {
55  enum_<GJK::Status>("GJKStatus")
56  .value("Valid", GJK::Valid)
57  .value("Inside", GJK::Inside)
58  .value("Failed", GJK::Failed)
59  .export_values();
60  }
61 
62  if (!eigenpy::register_symbolic_link_to_registered_type<MinkowskiDiff>()) {
63  class_<MinkowskiDiff>("MinkowskiDiff", doxygen::class_doc<MinkowskiDiff>(),
64  no_init)
65  .def(doxygen::visitor::init<MinkowskiDiff>())
66  .def("set",
67  static_cast<void (MinkowskiDiff::*)(
68  const ShapeBase*, const ShapeBase*)>(&MinkowskiDiff::set),
70  static_cast<void (MinkowskiDiff::*)(
71  const ShapeBase*, const ShapeBase*)>(&MinkowskiDiff::set)))
72  .def("set",
73  static_cast<void (MinkowskiDiff::*)(
74  const ShapeBase*, const ShapeBase*, const Transform3f& tf0,
75  const Transform3f& tf1)>(&MinkowskiDiff::set),
77  static_cast<void (MinkowskiDiff::*)(
78  const ShapeBase*, const ShapeBase*, const Transform3f& tf0,
79  const Transform3f& tf1)>(&MinkowskiDiff::set)))
80  .DEF_CLASS_FUNC(MinkowskiDiff, support0)
81  .DEF_CLASS_FUNC(MinkowskiDiff, support1)
82  .DEF_CLASS_FUNC(MinkowskiDiff, support)
83  .DEF_RW_CLASS_ATTRIB(MinkowskiDiff, inflation)
84  .DEF_RW_CLASS_ATTRIB(MinkowskiDiff, normalize_support_direction);
85  }
86 
87  if (!eigenpy::register_symbolic_link_to_registered_type<GJKVariant>()) {
88  enum_<GJKVariant>("GJKVariant")
89  .value("DefaultGJK", GJKVariant::DefaultGJK)
90  .value("NesterovAcceleration", GJKVariant::NesterovAcceleration)
91  .export_values();
92  }
93 
96  enum_<GJKConvergenceCriterion>("GJKConvergenceCriterion")
98  .value("DualityGap", GJKConvergenceCriterion::DualityGap)
99  .value("Hybrid", GJKConvergenceCriterion::Hybrid)
100  .export_values();
101  }
102 
105  enum_<GJKConvergenceCriterionType>("GJKConvergenceCriterionType")
107  .value("Relative", GJKConvergenceCriterionType::Relative)
108  .export_values();
109  }
110 
111  if (!eigenpy::register_symbolic_link_to_registered_type<GJK>()) {
112  class_<GJK>("GJK", doxygen::class_doc<GJK>(), no_init)
113  .def(doxygen::visitor::init<GJK, unsigned int, FCL_REAL>())
114  .DEF_RW_CLASS_ATTRIB(GJK, distance)
115  .DEF_RW_CLASS_ATTRIB(GJK, ray)
116  .DEF_RW_CLASS_ATTRIB(GJK, support_hint)
117  .DEF_RW_CLASS_ATTRIB(GJK, gjk_variant)
118  .DEF_RW_CLASS_ATTRIB(GJK, convergence_criterion)
119  .DEF_RW_CLASS_ATTRIB(GJK, convergence_criterion_type)
120  .DEF_CLASS_FUNC(GJK, evaluate)
121  .DEF_CLASS_FUNC(GJK, hasClosestPoints)
122  .DEF_CLASS_FUNC(GJK, hasPenetrationInformation)
123  .DEF_CLASS_FUNC(GJK, getClosestPoints)
124  .DEF_CLASS_FUNC(GJK, setDistanceEarlyBreak)
125  .DEF_CLASS_FUNC(GJK, getGuessFromSimplex)
126  .DEF_CLASS_FUNC(GJK, getIterations);
127  }
128 }
GJKConvergenceCriterionType
Wether the convergence criterion is scaled on the norm of the solution or not.
Definition: data_types.h:93
Simple transform class used locally by InterpMotion.
Definition: transform.h:54
const char * member_func_doc(FuncPtr)
Definition: doxygen.hh:33
class for GJK algorithm
Definition: gjk.h:141
Minkowski difference class of two shapes.
Definition: gjk.h:59
bool register_symbolic_link_to_registered_type()
class for EPA algorithm
Definition: gjk.h:312
Base class for all basic geometric shapes.
float value
GJKConvergenceCriterion
Which convergence criterion is used to stop the algorithm (when the shapes are not in collision)...
Definition: data_types.h:89
void exposeGJK()
Definition: gjk.cc:53
bool getClosestPoints(const GJK::Simplex &simplex, Vec3f &w0, Vec3f &w1)
double distance(const std::vector< Transform3f > &tf, const BVHModel< BV > &m1, const BVHModel< BV > &m2, bool verbose)
Definition: benchmark.cpp:93
tuple tf1


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