broadphase_callbacks.hh
Go to the documentation of this file.
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"
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 
53  bp::wrapper<CollisionCallBackBase> {
55 
56  void init() { this->get_override("init")(); }
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  static void expose() {
65  bp::class_<CollisionCallBackBaseWrapper, boost::noncopyable>(
66  "CollisionCallBackBase", bp::no_init)
67  .def("init", bp::pure_virtual(&Base::init),
69  .def("collide", bp::pure_virtual(&Base::collide),
71  .def("__call__", &Base::operator(),
72  doxygen::member_func_doc(&Base::operator()));
73  }
74 }; // CollisionCallBackBaseWrapper
75 
77  bp::wrapper<DistanceCallBackBase> {
80 
81  void init() { this->get_override("init")(); }
83  Eigen::Matrix<double, 1, 1>& dist) {
84  return distance(o1, o2, dist.coeffRef(0, 0));
85  }
86 
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  static void expose() {
95  bp::class_<DistanceCallBackBaseWrapper, boost::noncopyable>(
96  "DistanceCallBackBase", bp::no_init)
97  .def("init", bp::pure_virtual(&Base::init),
99  .def("distance",
100  bp::pure_virtual(
101  static_cast<bool (Self::*)(
103  Eigen::Matrix<double, 1, 1>& dist)>(&Self::distance)),
105  .def("__call__", &Base::operator(),
106  doxygen::member_func_doc(&Base::operator()));
107  }
108 }; // DistanceCallBackBaseWrapper
109 
110 } // namespace coal
111 
112 #endif // ifndef COAL_PYTHON_BROADPHASE_BROADPHASE_CALLBACKS_HH
coal::CollisionCallBackBase::collide
virtual bool collide(CollisionObject *o1, CollisionObject *o2)=0
Collision evaluation between two objects in collision. This callback will cause the broadphase evalua...
eigenpy.hpp
coal::DistanceCallBackBaseWrapper::Self
DistanceCallBackBaseWrapper Self
Definition: broadphase_callbacks.hh:79
coal::DistanceCallBackBaseWrapper::Base
DistanceCallBackBase Base
Definition: broadphase_callbacks.hh:78
coal
Main namespace.
Definition: coal/broadphase/broadphase_bruteforce.h:44
coal::CollisionCallBackBaseWrapper
Definition: broadphase_callbacks.hh:52
coal::CollisionCallBackBaseWrapper::collide
bool collide(CollisionObject *o1, CollisionObject *o2)
Collision evaluation between two objects in collision. This callback will cause the broadphase evalua...
Definition: broadphase_callbacks.hh:57
coal::DistanceCallBackBase::init
virtual void init()
Initialization of the callback before running the collision broadphase manager.
Definition: coal/broadphase/broadphase_callbacks.h:75
coal::CollisionCallBackBaseWrapper::expose
static void expose()
Definition: broadphase_callbacks.hh:64
coal::DistanceCallBackBaseWrapper::distance
bool distance(CollisionObject *o1, CollisionObject *o2, CoalScalar &dist)
Distance evaluation between two objects in collision. This callback will cause the broadphase evaluat...
Definition: broadphase_callbacks.hh:87
coal::CollisionCallBackBase::init
virtual void init()
Initialization of the callback before running the collision broadphase manager.
Definition: coal/broadphase/broadphase_callbacks.h:52
coal::DistanceCallBackBaseWrapper::expose
static void expose()
Definition: broadphase_callbacks.hh:94
fwd.hh
coal::DistanceCallBackBase
Base callback class for distance queries. This class can be supersed by child classes to provide desi...
Definition: coal/broadphase/broadphase_callbacks.h:72
coal::CollisionObject
the object for collision or distance computation, contains the geometry and the transform information
Definition: coal/collision_object.h:214
coal::CollisionCallBackBaseWrapper::Base
CollisionCallBackBase Base
Definition: broadphase_callbacks.hh:54
coal::DistanceCallBackBaseWrapper
Definition: broadphase_callbacks.hh:76
broadphase_callbacks.h
coal::CollisionCallBackBaseWrapper::init
void init()
Initialization of the callback before running the collision broadphase manager.
Definition: broadphase_callbacks.hh:56
coal::DistanceCallBackBaseWrapper::init
void init()
Initialization of the callback before running the collision broadphase manager.
Definition: broadphase_callbacks.hh:81
coal::CollisionCallBackBase
Base callback class for collision queries. This class can be supersed by child classes to provide des...
Definition: coal/broadphase/broadphase_callbacks.h:49
coal::CoalScalar
double CoalScalar
Definition: coal/data_types.h:76
coal::DistanceCallBackBase::distance
virtual bool distance(CollisionObject *o1, CollisionObject *o2, CoalScalar &dist)=0
Distance evaluation between two objects in collision. This callback will cause the broadphase evaluat...
coal::DistanceCallBackBaseWrapper::distance
bool distance(CollisionObject *o1, CollisionObject *o2, Eigen::Matrix< double, 1, 1 > &dist)
Definition: broadphase_callbacks.hh:82
doxygen::member_func_doc
const char * member_func_doc(FuncPtr)
Definition: doxygen.hh:33


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