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 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>
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 
54  bp::wrapper<CollisionCallBackBase> {
56 
57  void init() { this->get_override("init")(); }
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  static void expose() {
66  bp::class_<CollisionCallBackBaseWrapper, boost::noncopyable>(
67  "CollisionCallBackBase", bp::no_init)
68  .def("init", bp::pure_virtual(&Base::init),
70  .def("collide", bp::pure_virtual(&Base::collide),
72  .def("__call__", &Base::operator(),
73  doxygen::member_func_doc(&Base::operator()));
74  }
75 }; // CollisionCallBackBaseWrapper
76 
78  bp::wrapper<DistanceCallBackBase> {
81 
82  void init() { this->get_override("init")(); }
84  Eigen::Matrix<double, 1, 1>& dist) {
85  return distance(o1, o2, dist.coeffRef(0, 0));
86  }
87 
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  static void expose() {
96  bp::class_<DistanceCallBackBaseWrapper, boost::noncopyable>(
97  "DistanceCallBackBase", bp::no_init)
98  .def("init", bp::pure_virtual(&Base::init),
100  .def("distance",
101  bp::pure_virtual(
102  static_cast<bool (Self::*)(
104  Eigen::Matrix<double, 1, 1>& dist)>(&Self::distance)),
106  .def("__call__", &Base::operator(),
107  doxygen::member_func_doc(&Base::operator()));
108  }
109 }; // DistanceCallBackBaseWrapper
110 
111 } // namespace fcl
112 } // namespace hpp
113 
114 #endif // ifndef HPP_FCL_PYTHON_BROADPHASE_BROADPHASE_CALLBACKS_HH
virtual void init()
Initialization of the callback before running the collision broadphase manager.
const char * member_func_doc(FuncPtr)
Definition: doxygen.hh:33
Main namespace.
Base callback class for collision queries. This class can be supersed by child classes to provide des...
void init()
Initialization of the callback before running the collision broadphase manager.
void def(const char *name, Func func)
bool distance(CollisionObject *o1, CollisionObject *o2, Eigen::Matrix< double, 1, 1 > &dist)
HPP_FCL_DLLAPI FCL_REAL distance(const Matrix3f &R0, const Vec3f &T0, const kIOS &b1, const kIOS &b2, Vec3f *P=NULL, Vec3f *Q=NULL)
Approximate distance between two kIOS bounding volumes.
Definition: kIOS.cpp:181
double FCL_REAL
Definition: data_types.h:65
virtual bool collide(CollisionObject *o1, CollisionObject *o2)=0
Collision evaluation between two objects in collision. This callback will cause the broadphase evalua...
void init()
Initialization of the callback before running the collision broadphase manager.
bool distance(CollisionObject *o1, CollisionObject *o2, FCL_REAL &dist)
Distance evaluation between two objects in collision. This callback will cause the broadphase evaluat...
the object for collision or distance computation, contains the geometry and the transform information...
Base callback class for distance queries. This class can be supersed by child classes to provide desi...
double distance(const std::vector< Transform3f > &tf, const BVHModel< BV > &m1, const BVHModel< BV > &m2, bool verbose)
Definition: benchmark.cpp:93
bool collide(CollisionObject *o1, CollisionObject *o2)
Collision evaluation between two objects in collision. This callback will cause the broadphase evalua...


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