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