GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: python/broadphase/broadphase.cc Lines: 36 36 100.0 %
Date: 2024-02-09 12:57:42 Branches: 23 46 50.0 %

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 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 <hpp/fcl/fwd.hh>
36
#include "../fcl.hh"
37
38
#include "hpp/fcl/broadphase/broadphase_dynamic_AABB_tree.h"
39
#include "hpp/fcl/broadphase/broadphase_dynamic_AABB_tree_array.h"
40
#include "hpp/fcl/broadphase/broadphase_bruteforce.h"
41
#include "hpp/fcl/broadphase/broadphase_SaP.h"
42
#include "hpp/fcl/broadphase/broadphase_SSaP.h"
43
#include "hpp/fcl/broadphase/broadphase_interval_tree.h"
44
#include "hpp/fcl/broadphase/broadphase_spatialhash.h"
45
46
#ifdef HPP_FCL_HAS_DOXYGEN_AUTODOC
47
#include "doxygen_autodoc/functions.h"
48
#include "doxygen_autodoc/hpp/fcl/broadphase/default_broadphase_callbacks.h"
49
// #include "doxygen_autodoc/hpp/fcl/broadphase/broadphase_dynamic_AABB_tree.h"
50
// #include
51
//"doxygen_autodoc/hpp/fcl/broadphase/broadphase_dynamic_AABB_tree_array.h"
52
// #include "doxygen_autodoc/hpp/fcl/broadphase/broadphase_bruteforce.h"
53
// #include "doxygen_autodoc/hpp/fcl/broadphase/broadphase_SaP.h"
54
// #include "doxygen_autodoc/hpp/fcl/broadphase/broadphase_SSaP.h"
55
// #include "doxygen_autodoc/hpp/fcl/broadphase/broadphase_interval_tree.h"
56
// #include "doxygen_autodoc/hpp/fcl/broadphase/broadphase_spatialhash.h"
57
#endif
58
59
#include "broadphase_callbacks.hh"
60
#include "broadphase_collision_manager.hh"
61
62
using namespace hpp::fcl;
63
64
5
void exposeBroadPhase() {
65
5
  CollisionCallBackBaseWrapper::expose();
66
5
  DistanceCallBackBaseWrapper::expose();
67
68
  // CollisionCallBackDefault
69
5
  bp::class_<CollisionCallBackDefault, bp::bases<CollisionCallBackBase> >(
70
      "CollisionCallBackDefault", bp::no_init)
71
5
      .def(dv::init<CollisionCallBackDefault>())
72
5
      .DEF_RW_CLASS_ATTRIB(CollisionCallBackDefault, data);
73
74
  // DistanceCallBackDefault
75
5
  bp::class_<DistanceCallBackDefault, bp::bases<DistanceCallBackBase> >(
76
      "DistanceCallBackDefault", bp::no_init)
77
5
      .def(dv::init<DistanceCallBackDefault>())
78
5
      .DEF_RW_CLASS_ATTRIB(DistanceCallBackDefault, data);
79
80
  // CollisionCallBackCollect
81
5
  bp::class_<CollisionCallBackCollect, bp::bases<CollisionCallBackBase> >(
82
      "CollisionCallBackCollect", bp::no_init)
83
5
      .def(dv::init<CollisionCallBackCollect, const size_t>())
84

5
      .DEF_CLASS_FUNC(CollisionCallBackCollect, numCollisionPairs)
85
5
      .DEF_CLASS_FUNC2(CollisionCallBackCollect, getCollisionPairs,
86
                       bp::return_value_policy<bp::copy_const_reference>())
87

5
      .DEF_CLASS_FUNC(CollisionCallBackCollect, exist);
88
89
5
  bp::class_<CollisionData>("CollisionData", bp::no_init)
90
5
      .def(dv::init<CollisionData>())
91
5
      .DEF_RW_CLASS_ATTRIB(CollisionData, request)
92
5
      .DEF_RW_CLASS_ATTRIB(CollisionData, result)
93
5
      .DEF_RW_CLASS_ATTRIB(CollisionData, done)
94

5
      .DEF_CLASS_FUNC(CollisionData, clear);
95
96
5
  bp::class_<DistanceData>("DistanceData", bp::no_init)
97
5
      .def(dv::init<DistanceData>())
98
5
      .DEF_RW_CLASS_ATTRIB(DistanceData, request)
99
5
      .DEF_RW_CLASS_ATTRIB(DistanceData, result)
100
5
      .DEF_RW_CLASS_ATTRIB(DistanceData, done)
101

5
      .DEF_CLASS_FUNC(DistanceData, clear);
102
103
5
  BroadPhaseCollisionManagerWrapper::expose();
104
105
  BroadPhaseCollisionManagerWrapper::exposeDerived<
106
5
      DynamicAABBTreeCollisionManager>();
107
  BroadPhaseCollisionManagerWrapper::exposeDerived<
108
5
      DynamicAABBTreeArrayCollisionManager>();
109
  BroadPhaseCollisionManagerWrapper::exposeDerived<
110
5
      IntervalTreeCollisionManager>();
111
5
  BroadPhaseCollisionManagerWrapper::exposeDerived<SSaPCollisionManager>();
112
5
  BroadPhaseCollisionManagerWrapper::exposeDerived<SaPCollisionManager>();
113
5
  BroadPhaseCollisionManagerWrapper::exposeDerived<NaiveCollisionManager>();
114
115
  // Specific case of SpatialHashingCollisionManager
116
  {
117
    typedef detail::SimpleHashTable<AABB, CollisionObject *,
118
                                    detail::SpatialHash>
119
        HashTable;
120
    typedef SpatialHashingCollisionManager<HashTable> Derived;
121
5
    bp::class_<Derived, bp::bases<BroadPhaseCollisionManager> >(
122
        "SpatialHashingCollisionManager", bp::no_init)
123
        .def(dv::init<Derived, FCL_REAL, const Vec3f &, const Vec3f &,
124
5
                      bp::optional<unsigned int> >());
125
  }
126
5
}