Directory: | ./ |
---|---|
File: | python/coal.cc |
Date: | 2025-04-01 09:23:31 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 29 | 29 | 100.0% |
Branches: | 21 | 46 | 45.7% |
Line | Branch | Exec | Source |
---|---|---|---|
1 | // | ||
2 | // Software License Agreement (BSD License) | ||
3 | // | ||
4 | // Copyright (c) 2019-2022 CNRS-LAAS INRIA | ||
5 | // Author: Joseph Mirabel | ||
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 <eigenpy/eigenpy.hpp> | ||
36 | |||
37 | #include "coal.hh" | ||
38 | |||
39 | #include "coal/fwd.hh" | ||
40 | #include "coal/shape/geometric_shapes.h" | ||
41 | #include "coal/BVH/BVH_model.h" | ||
42 | |||
43 | #include "coal/mesh_loader/loader.h" | ||
44 | |||
45 | #include "coal/collision.h" | ||
46 | |||
47 | #ifdef COAL_HAS_DOXYGEN_AUTODOC | ||
48 | #include "doxygen_autodoc/coal/mesh_loader/loader.h" | ||
49 | #endif | ||
50 | |||
51 | #include "../doc/python/doxygen.hh" | ||
52 | #include "../doc/python/doxygen-boost.hh" | ||
53 | |||
54 | using namespace coal; | ||
55 | namespace dv = doxygen::visitor; | ||
56 | |||
57 | #pragma GCC diagnostic push | ||
58 | #pragma GCC diagnostic ignored "-Wconversion" | ||
59 |
0/4✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
|
10 | BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(load_overloads, MeshLoader::load, 1, 2) |
60 | #pragma GCC diagnostic pop | ||
61 | |||
62 | 5 | void exposeMeshLoader() { | |
63 | using namespace boost::python; | ||
64 | |||
65 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | if (!eigenpy::register_symbolic_link_to_registered_type<MeshLoader>()) { |
66 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | class_<MeshLoader, shared_ptr<MeshLoader> >( |
67 | "MeshLoader", doxygen::class_doc<MeshLoader>(), | ||
68 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
10 | init<optional<NODE_TYPE> >( |
69 |
2/4✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 5 times.
✗ Branch 6 not taken.
|
10 | (arg("self"), arg("node_type")), |
70 | doxygen::constructor_doc<MeshLoader, const NODE_TYPE&>())) | ||
71 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def("load", &MeshLoader::load, |
72 |
6/12✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 5 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 5 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 5 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 5 times.
✗ Branch 15 not taken.
✓ Branch 17 taken 5 times.
✗ Branch 18 not taken.
|
10 | load_overloads((arg("self"), arg("filename"), arg("scale")), |
73 | doxygen::member_func_doc(&MeshLoader::load))) | ||
74 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
5 | .def(dv::member_func("loadOctree", &MeshLoader::loadOctree)); |
75 | } | ||
76 | |||
77 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | if (!eigenpy::register_symbolic_link_to_registered_type<CachedMeshLoader>()) { |
78 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | class_<CachedMeshLoader, bases<MeshLoader>, shared_ptr<CachedMeshLoader> >( |
79 | "CachedMeshLoader", doxygen::class_doc<MeshLoader>(), | ||
80 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
10 | init<optional<NODE_TYPE> >( |
81 |
2/4✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 5 times.
✗ Branch 6 not taken.
|
10 | (arg("self"), arg("node_type")), |
82 | doxygen::constructor_doc<CachedMeshLoader, const NODE_TYPE&>())); | ||
83 | } | ||
84 | 5 | } | |
85 | |||
86 |
2/4✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 5 times.
✗ Branch 4 not taken.
|
20 | BOOST_PYTHON_MODULE(coal_pywrap) { |
87 | namespace bp = boost::python; | ||
88 | |||
89 | 10 | PyImport_ImportModule("warnings"); | |
90 | 10 | eigenpy::enableEigenPy(); | |
91 | |||
92 | 10 | exposeVersion(); | |
93 | 10 | exposeMaths(); | |
94 | 10 | exposeCollisionGeometries(); | |
95 | 10 | exposeCollisionObject(); | |
96 | 10 | exposeMeshLoader(); | |
97 | 10 | exposeCollisionAPI(); | |
98 | 10 | exposeContactPatchAPI(); | |
99 | 10 | exposeDistanceAPI(); | |
100 | 10 | exposeGJK(); | |
101 | #ifdef COAL_HAS_OCTOMAP | ||
102 | 10 | exposeOctree(); | |
103 | #endif | ||
104 | 10 | exposeBroadPhase(); | |
105 | 10 | } | |
106 |