1 |
|
|
// |
2 |
|
|
// Software License Agreement (BSD License) |
3 |
|
|
// |
4 |
|
|
// Copyright (c) 2022 INRIA |
5 |
|
|
// Author: Justin Carpentier |
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 INRIA 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 |
|
|
#ifndef HPP_FCL_PYTHON_BROADPHASE_BROADPHASE_CALLBACKS_HH |
36 |
|
|
#define HPP_FCL_PYTHON_BROADPHASE_BROADPHASE_CALLBACKS_HH |
37 |
|
|
|
38 |
|
|
#include <eigenpy/eigenpy.hpp> |
39 |
|
|
|
40 |
|
|
#include <hpp/fcl/fwd.hh> |
41 |
|
|
#include <hpp/fcl/broadphase/broadphase_callbacks.h> |
42 |
|
|
|
43 |
|
|
#include "../fcl.hh" |
44 |
|
|
|
45 |
|
|
#ifdef HPP_FCL_HAS_DOXYGEN_AUTODOC |
46 |
|
|
#include "doxygen_autodoc/functions.h" |
47 |
|
|
#include "doxygen_autodoc/hpp/fcl/broadphase/broadphase_callbacks.h" |
48 |
|
|
#endif |
49 |
|
|
|
50 |
|
|
namespace hpp { |
51 |
|
|
namespace fcl { |
52 |
|
|
|
53 |
|
|
struct CollisionCallBackBaseWrapper : CollisionCallBackBase, |
54 |
|
|
bp::wrapper<CollisionCallBackBase> { |
55 |
|
|
typedef CollisionCallBackBase Base; |
56 |
|
|
|
57 |
|
|
void init() { this->get_override("init")(); } |
58 |
|
|
bool collide(CollisionObject* o1, CollisionObject* o2) { |
59 |
|
|
#pragma GCC diagnostic push |
60 |
|
|
#pragma GCC diagnostic ignored "-Wconversion" |
61 |
|
|
return this->get_override("collide")(o1, o2); |
62 |
|
|
#pragma GCC diagnostic pop |
63 |
|
|
} |
64 |
|
|
|
65 |
|
5 |
static void expose() { |
66 |
|
5 |
bp::class_<CollisionCallBackBaseWrapper, boost::noncopyable>( |
67 |
|
|
"CollisionCallBackBase", bp::no_init) |
68 |
|
|
.def("init", bp::pure_virtual(&Base::init), |
69 |
✓✗✓✗
|
5 |
doxygen::member_func_doc(&Base::init)) |
70 |
|
|
.def("collide", bp::pure_virtual(&Base::collide), |
71 |
✓✗✓✗
|
5 |
doxygen::member_func_doc(&Base::collide)) |
72 |
|
|
.def("__call__", &Base::operator(), |
73 |
✓✗ |
5 |
doxygen::member_func_doc(&Base::operator())); |
74 |
|
5 |
} |
75 |
|
|
}; // CollisionCallBackBaseWrapper |
76 |
|
|
|
77 |
|
|
struct DistanceCallBackBaseWrapper : DistanceCallBackBase, |
78 |
|
|
bp::wrapper<DistanceCallBackBase> { |
79 |
|
|
typedef DistanceCallBackBase Base; |
80 |
|
|
typedef DistanceCallBackBaseWrapper Self; |
81 |
|
|
|
82 |
|
|
void init() { this->get_override("init")(); } |
83 |
|
|
bool distance(CollisionObject* o1, CollisionObject* o2, |
84 |
|
|
Eigen::Matrix<double, 1, 1>& dist) { |
85 |
|
|
return distance(o1, o2, dist.coeffRef(0, 0)); |
86 |
|
|
} |
87 |
|
|
|
88 |
|
|
bool distance(CollisionObject* o1, CollisionObject* o2, FCL_REAL& dist) { |
89 |
|
|
#pragma GCC diagnostic push |
90 |
|
|
#pragma GCC diagnostic ignored "-Wconversion" |
91 |
|
|
return this->get_override("distance")(o1, o2, dist); |
92 |
|
|
#pragma GCC diagnostic pop |
93 |
|
|
} |
94 |
|
|
|
95 |
|
5 |
static void expose() { |
96 |
|
5 |
bp::class_<DistanceCallBackBaseWrapper, boost::noncopyable>( |
97 |
|
|
"DistanceCallBackBase", bp::no_init) |
98 |
|
|
.def("init", bp::pure_virtual(&Base::init), |
99 |
✓✗✓✗
|
5 |
doxygen::member_func_doc(&Base::init)) |
100 |
|
|
.def("distance", |
101 |
|
|
bp::pure_virtual( |
102 |
|
|
static_cast<bool (Self::*)( |
103 |
|
|
CollisionObject* o1, CollisionObject* o2, |
104 |
|
|
Eigen::Matrix<double, 1, 1>& dist)>(&Self::distance)), |
105 |
✓✗✓✗
|
5 |
doxygen::member_func_doc(&Base::distance)) |
106 |
|
|
.def("__call__", &Base::operator(), |
107 |
✓✗ |
5 |
doxygen::member_func_doc(&Base::operator())); |
108 |
|
5 |
} |
109 |
|
|
}; // DistanceCallBackBaseWrapper |
110 |
|
|
|
111 |
|
|
} // namespace fcl |
112 |
|
|
} // namespace hpp |
113 |
|
|
|
114 |
|
|
#endif // ifndef HPP_FCL_PYTHON_BROADPHASE_BROADPHASE_CALLBACKS_HH |