| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // | ||
| 2 | // Software License Agreement (BSD License) | ||
| 3 | // | ||
| 4 | // Copyright (c) 2019-2024 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 | #include <eigenpy/eigen-to-python.hpp> | ||
| 37 | |||
| 38 | #if EIGENPY_VERSION_AT_LEAST(3, 8, 0) | ||
| 39 | #include <eigenpy/id.hpp> | ||
| 40 | #endif | ||
| 41 | #include "coal.hh" | ||
| 42 | |||
| 43 | #include "deprecation.hh" | ||
| 44 | |||
| 45 | #include "coal/fwd.hh" | ||
| 46 | #include "coal/shape/geometric_shapes.h" | ||
| 47 | #include "coal/shape/convex.h" | ||
| 48 | #include "coal/BVH/BVH_model.h" | ||
| 49 | #include "coal/hfield.h" | ||
| 50 | |||
| 51 | #include "coal/serialization/memory.h" | ||
| 52 | #include "coal/serialization/AABB.h" | ||
| 53 | #include "coal/serialization/BVH_model.h" | ||
| 54 | #include "coal/serialization/hfield.h" | ||
| 55 | #include "coal/serialization/geometric_shapes.h" | ||
| 56 | #include "coal/serialization/convex.h" | ||
| 57 | |||
| 58 | #include "pickle.hh" | ||
| 59 | #include "serializable.hh" | ||
| 60 | |||
| 61 | #ifdef COAL_HAS_DOXYGEN_AUTODOC | ||
| 62 | // FIXME for a reason I do not understand, doxygen fails to understand that | ||
| 63 | // BV_splitter is not defined in coal/BVH/BVH_model.h | ||
| 64 | #include "coal/internal/BV_splitter.h" | ||
| 65 | #include "coal/broadphase/detail/hierarchy_tree.h" | ||
| 66 | |||
| 67 | #include "doxygen_autodoc/coal/BVH/BVH_model.h" | ||
| 68 | #include "doxygen_autodoc/coal/BV/AABB.h" | ||
| 69 | #include "doxygen_autodoc/coal/hfield.h" | ||
| 70 | #include "doxygen_autodoc/coal/shape/geometric_shapes.h" | ||
| 71 | #include "doxygen_autodoc/functions.h" | ||
| 72 | #endif | ||
| 73 | |||
| 74 | using namespace boost::python; | ||
| 75 | using namespace coal; | ||
| 76 | using namespace coal::python; | ||
| 77 | namespace dv = doxygen::visitor; | ||
| 78 | namespace bp = boost::python; | ||
| 79 | |||
| 80 | using boost::noncopyable; | ||
| 81 | |||
| 82 | typedef std::vector<Vec3s> Vec3ss; | ||
| 83 | |||
| 84 | struct BVHModelBaseWrapper { | ||
| 85 | typedef Eigen::Matrix<Scalar, Eigen::Dynamic, 3, Eigen::RowMajor> RowMatrixX3; | ||
| 86 | typedef Eigen::Map<RowMatrixX3> MapRowMatrixX3; | ||
| 87 | typedef Eigen::Ref<RowMatrixX3> RefRowMatrixX3; | ||
| 88 | |||
| 89 | ✗ | static Vec3s& vertex(BVHModelBase& bvh, unsigned int i) { | |
| 90 | ✗ | if (i >= bvh.num_vertices) throw std::out_of_range("index is out of range"); | |
| 91 | ✗ | return (*(bvh.vertices))[i]; | |
| 92 | } | ||
| 93 | |||
| 94 | 1 | static RefRowMatrixX3 vertices(BVHModelBase& bvh) { | |
| 95 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | if (bvh.num_vertices > 0) |
| 96 | ✗ | return MapRowMatrixX3(bvh.vertices->data()->data(), bvh.num_vertices, 3); | |
| 97 | else | ||
| 98 |
3/6✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
|
1 | return MapRowMatrixX3(NULL, bvh.num_vertices, 3); |
| 99 | } | ||
| 100 | |||
| 101 | ✗ | static Triangle32 tri_indices(const BVHModelBase& bvh, unsigned int i) { | |
| 102 | ✗ | if (i >= bvh.num_tris) throw std::out_of_range("index is out of range"); | |
| 103 | ✗ | return (*bvh.tri_indices)[i]; | |
| 104 | } | ||
| 105 | }; | ||
| 106 | |||
| 107 | template <typename BV> | ||
| 108 | 20 | void exposeBVHModel(const std::string& bvname) { | |
| 109 | typedef BVHModel<BV> BVH; | ||
| 110 | |||
| 111 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
20 | const std::string type_name = "BVHModel" + bvname; |
| 112 |
2/4✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 10 times.
✗ Branch 6 not taken.
|
20 | class_<BVH, bases<BVHModelBase>, shared_ptr<BVH>>( |
| 113 | type_name.c_str(), doxygen::class_doc<BVH>(), no_init) | ||
| 114 |
1/2✓ Branch 2 taken 10 times.
✗ Branch 3 not taken.
|
20 | .def(dv::init<BVH>()) |
| 115 |
1/2✓ Branch 2 taken 10 times.
✗ Branch 3 not taken.
|
20 | .def(dv::init<BVH, const BVH&>()) |
| 116 |
2/4✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 10 times.
✗ Branch 5 not taken.
|
20 | .DEF_CLASS_FUNC(BVH, getNumBVs) |
| 117 |
2/4✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 10 times.
✗ Branch 5 not taken.
|
20 | .DEF_CLASS_FUNC(BVH, makeParentRelative) |
| 118 |
2/4✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 10 times.
✗ Branch 5 not taken.
|
20 | .DEF_CLASS_FUNC(BVHModelBase, memUsage) |
| 119 | 20 | .def("clone", &BVH::clone, doxygen::member_func_doc(&BVH::clone), | |
| 120 | ✗ | return_value_policy<manage_new_object>()) | |
| 121 |
2/4✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 10 times.
✗ Branch 5 not taken.
|
20 | .def_pickle(PickleObject<BVH>()) |
| 122 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
20 | .def(SerializableVisitor<BVH>()) |
| 123 | #if EIGENPY_VERSION_AT_LEAST(3, 8, 0) | ||
| 124 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
20 | .def(eigenpy::IdVisitor<BVH>()) |
| 125 | #endif | ||
| 126 | ; | ||
| 127 | 20 | } | |
| 128 | |||
| 129 | template <typename BV> | ||
| 130 | 20 | void exposeHeightField(const std::string& bvname) { | |
| 131 | typedef HeightField<BV> Geometry; | ||
| 132 | typedef typename Geometry::Base Base; | ||
| 133 | typedef typename Geometry::Node Node; | ||
| 134 | |||
| 135 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
20 | const std::string type_name = "HeightField" + bvname; |
| 136 |
2/4✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 10 times.
✗ Branch 6 not taken.
|
20 | class_<Geometry, bases<Base>, shared_ptr<Geometry>>( |
| 137 | type_name.c_str(), doxygen::class_doc<Geometry>(), no_init) | ||
| 138 |
1/2✓ Branch 2 taken 10 times.
✗ Branch 3 not taken.
|
20 | .def(dv::init<HeightField<BV>>()) |
| 139 |
1/2✓ Branch 2 taken 10 times.
✗ Branch 3 not taken.
|
20 | .def(dv::init<HeightField<BV>, const HeightField<BV>&>()) |
| 140 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
20 | .def(dv::init<HeightField<BV>, Scalar, Scalar, const MatrixXs&, |
| 141 | 20 | bp::optional<Scalar>>()) | |
| 142 | |||
| 143 |
2/4✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 10 times.
✗ Branch 5 not taken.
|
20 | .DEF_CLASS_FUNC(Geometry, getXDim) |
| 144 |
2/4✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 10 times.
✗ Branch 5 not taken.
|
20 | .DEF_CLASS_FUNC(Geometry, getYDim) |
| 145 |
2/4✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 10 times.
✗ Branch 5 not taken.
|
20 | .DEF_CLASS_FUNC(Geometry, getMinHeight) |
| 146 |
2/4✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 10 times.
✗ Branch 5 not taken.
|
20 | .DEF_CLASS_FUNC(Geometry, getMaxHeight) |
| 147 |
2/4✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 10 times.
✗ Branch 5 not taken.
|
20 | .DEF_CLASS_FUNC(Geometry, getNodeType) |
| 148 |
2/4✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 10 times.
✗ Branch 5 not taken.
|
20 | .DEF_CLASS_FUNC(Geometry, updateHeights) |
| 149 | |||
| 150 | 40 | .def("clone", &Geometry::clone, | |
| 151 | 20 | doxygen::member_func_doc(&Geometry::clone), | |
| 152 | ✗ | return_value_policy<manage_new_object>()) | |
| 153 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
20 | .def("getXGrid", &Geometry::getXGrid, |
| 154 | 20 | doxygen::member_func_doc(&Geometry::getXGrid), | |
| 155 | ✗ | bp::return_value_policy<bp::copy_const_reference>()) | |
| 156 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
20 | .def("getYGrid", &Geometry::getYGrid, |
| 157 | 20 | doxygen::member_func_doc(&Geometry::getYGrid), | |
| 158 | ✗ | bp::return_value_policy<bp::copy_const_reference>()) | |
| 159 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
20 | .def("getHeights", &Geometry::getHeights, |
| 160 | 20 | doxygen::member_func_doc(&Geometry::getHeights), | |
| 161 | ✗ | bp::return_value_policy<bp::copy_const_reference>()) | |
| 162 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
20 | .def("getBV", (Node & (Geometry::*)(unsigned int)) & Geometry::getBV, |
| 163 |
1/2✓ Branch 2 taken 10 times.
✗ Branch 3 not taken.
|
20 | doxygen::member_func_doc((Node & (Geometry::*)(unsigned int)) & |
| 164 | Geometry::getBV), | ||
| 165 | ✗ | bp::return_internal_reference<>()) | |
| 166 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
20 | .def_pickle(PickleObject<Geometry>()) |
| 167 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
20 | .def(SerializableVisitor<Geometry>()) |
| 168 | #if EIGENPY_VERSION_AT_LEAST(3, 8, 0) | ||
| 169 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
20 | .def(eigenpy::IdVisitor<Geometry>()) |
| 170 | #endif | ||
| 171 | ; | ||
| 172 | 20 | } | |
| 173 | |||
| 174 | template <typename IndexType> | ||
| 175 | struct ConvexBaseWrapper { | ||
| 176 | typedef ConvexBaseTpl<IndexType> ConvexBaseType; | ||
| 177 | typedef Eigen::Matrix<Scalar, Eigen::Dynamic, 3, Eigen::RowMajor> RowMatrixX3; | ||
| 178 | typedef Eigen::Map<RowMatrixX3> MapRowMatrixX3; | ||
| 179 | typedef Eigen::Ref<RowMatrixX3> RefRowMatrixX3; | ||
| 180 | typedef Eigen::Map<VecXs> MapVecXs; | ||
| 181 | typedef Eigen::Ref<VecXs> RefVecXs; | ||
| 182 | |||
| 183 | ✗ | static Vec3s& point(const ConvexBaseType& convex, unsigned int i) { | |
| 184 | ✗ | if (i >= convex.num_points) | |
| 185 | ✗ | throw std::out_of_range("index is out of range"); | |
| 186 | ✗ | return (*(convex.points))[i]; | |
| 187 | } | ||
| 188 | |||
| 189 | ✗ | static RefRowMatrixX3 points(const ConvexBaseType& convex) { | |
| 190 | ✗ | return MapRowMatrixX3((*(convex.points))[0].data(), convex.num_points, 3); | |
| 191 | } | ||
| 192 | |||
| 193 | ✗ | static Vec3s& normal(const ConvexBaseType& convex, unsigned int i) { | |
| 194 | ✗ | if (i >= convex.num_normals_and_offsets) | |
| 195 | ✗ | throw std::out_of_range("index is out of range"); | |
| 196 | ✗ | return (*(convex.normals))[i]; | |
| 197 | } | ||
| 198 | |||
| 199 | ✗ | static RefRowMatrixX3 normals(const ConvexBaseType& convex) { | |
| 200 | ✗ | return MapRowMatrixX3((*(convex.normals))[0].data(), | |
| 201 | ✗ | convex.num_normals_and_offsets, 3); | |
| 202 | } | ||
| 203 | |||
| 204 | ✗ | static Scalar offset(const ConvexBaseType& convex, unsigned int i) { | |
| 205 | ✗ | if (i >= convex.num_normals_and_offsets) | |
| 206 | ✗ | throw std::out_of_range("index is out of range"); | |
| 207 | ✗ | return (*(convex.offsets))[i]; | |
| 208 | } | ||
| 209 | |||
| 210 | ✗ | static RefVecXs offsets(const ConvexBaseType& convex) { | |
| 211 | ✗ | return MapVecXs(convex.offsets->data(), convex.num_normals_and_offsets, 1); | |
| 212 | } | ||
| 213 | |||
| 214 | ✗ | static list neighbors(const ConvexBaseType& convex, unsigned int i) { | |
| 215 | ✗ | if (i >= convex.num_points) | |
| 216 | ✗ | throw std::out_of_range("index is out of range"); | |
| 217 | ✗ | list n; | |
| 218 | const std::vector<typename ConvexBaseType::Neighbors>& neighbors_ = | ||
| 219 | ✗ | *(convex.neighbors); | |
| 220 | ✗ | for (unsigned char j = 0; j < neighbors_[i].count; ++j) { | |
| 221 | ✗ | n.append(convex.neighbor(IndexType(i), j)); | |
| 222 | } | ||
| 223 | ✗ | return n; | |
| 224 | ✗ | } | |
| 225 | |||
| 226 | 2 | static ConvexBaseType* convexHull(const Vec3ss& points, bool keepTri, | |
| 227 | const char* qhullCommand) { | ||
| 228 | 2 | return ConvexBaseType::convexHull( | |
| 229 | 2 | points.data(), (unsigned int)points.size(), keepTri, qhullCommand); | |
| 230 | } | ||
| 231 | }; | ||
| 232 | |||
| 233 | template <typename PolygonT> | ||
| 234 | struct ConvexWrapper { | ||
| 235 | typedef ConvexTpl<PolygonT> Convex_t; | ||
| 236 | typedef typename PolygonT::IndexType IndexType; | ||
| 237 | typedef TriangleTpl<IndexType> TriangleType; | ||
| 238 | |||
| 239 | ✗ | static PolygonT polygons(const Convex_t& convex, unsigned int i) { | |
| 240 | ✗ | if (i >= convex.num_polygons) | |
| 241 | ✗ | throw std::out_of_range("index is out of range"); | |
| 242 | ✗ | return (*convex.polygons)[i]; | |
| 243 | } | ||
| 244 | |||
| 245 | 3 | static shared_ptr<Convex_t> constructor( | |
| 246 | const Vec3ss& _points, const std::vector<TriangleType>& _tris) { | ||
| 247 |
1/4✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
3 | std::shared_ptr<std::vector<Vec3s>> points( |
| 248 |
2/4✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 3 times.
✗ Branch 6 not taken.
|
6 | new std::vector<Vec3s>(_points.size())); |
| 249 | 3 | std::vector<Vec3s>& points_ = *points; | |
| 250 |
3/4✓ Branch 3 taken 11 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 11 times.
✓ Branch 7 taken 3 times.
|
14 | for (std::size_t i = 0; i < _points.size(); ++i) points_[i] = _points[i]; |
| 251 | |||
| 252 |
1/4✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
3 | std::shared_ptr<std::vector<TriangleType>> tris( |
| 253 |
2/4✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 3 times.
✗ Branch 6 not taken.
|
6 | new std::vector<TriangleType>(_tris.size())); |
| 254 | 3 | std::vector<TriangleType>& tris_ = *tris; | |
| 255 |
3/4✓ Branch 3 taken 9 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 9 times.
✓ Branch 7 taken 3 times.
|
12 | for (std::size_t i = 0; i < _tris.size(); ++i) tris_[i] = _tris[i]; |
| 256 |
2/4✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 6 taken 3 times.
✗ Branch 7 not taken.
|
12 | return shared_ptr<Convex_t>(new Convex_t(points, |
| 257 | 3 | (unsigned int)_points.size(), tris, | |
| 258 |
1/4✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
9 | (unsigned int)_tris.size())); |
| 259 | 3 | } | |
| 260 | }; | ||
| 261 | |||
| 262 | template <typename T> | ||
| 263 | 120 | void defComputeMemoryFootprint() { | |
| 264 | 120 | doxygen::def("computeMemoryFootprint", &computeMemoryFootprint<T>); | |
| 265 | 120 | } | |
| 266 | |||
| 267 | 5 | void exposeComputeMemoryFootprint() { | |
| 268 | 5 | defComputeMemoryFootprint<Sphere>(); | |
| 269 | 5 | defComputeMemoryFootprint<Ellipsoid>(); | |
| 270 | 5 | defComputeMemoryFootprint<Cone>(); | |
| 271 | 5 | defComputeMemoryFootprint<Capsule>(); | |
| 272 | 5 | defComputeMemoryFootprint<Cylinder>(); | |
| 273 | 5 | defComputeMemoryFootprint<Box>(); | |
| 274 | 5 | defComputeMemoryFootprint<Plane>(); | |
| 275 | 5 | defComputeMemoryFootprint<Halfspace>(); | |
| 276 | 5 | defComputeMemoryFootprint<TriangleP>(); | |
| 277 | |||
| 278 | 5 | defComputeMemoryFootprint<BVHModel<OBB>>(); | |
| 279 | 5 | defComputeMemoryFootprint<BVHModel<RSS>>(); | |
| 280 | 5 | defComputeMemoryFootprint<BVHModel<OBBRSS>>(); | |
| 281 | 5 | } | |
| 282 | |||
| 283 | template <typename IndexType> | ||
| 284 | 20 | void exposeConvexBase(const std::string& classname) { | |
| 285 | typedef ConvexBaseTpl<IndexType> ConvexBaseType; | ||
| 286 | typedef ConvexBaseWrapper<IndexType> ConvexBaseTypeWrapper; | ||
| 287 | |||
| 288 |
2/4✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 10 times.
✗ Branch 6 not taken.
|
20 | class_<ConvexBaseType, bases<ShapeBase>, shared_ptr<ConvexBaseType>, |
| 289 | noncopyable>(classname.c_str(), doxygen::class_doc<ConvexBaseType>(), | ||
| 290 | no_init) | ||
| 291 |
2/4✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 10 times.
✗ Branch 5 not taken.
|
20 | .DEF_RO_CLASS_ATTRIB(ConvexBaseType, center) |
| 292 |
2/4✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 10 times.
✗ Branch 5 not taken.
|
20 | .DEF_RO_CLASS_ATTRIB(ConvexBaseType, num_points) |
| 293 |
2/4✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 10 times.
✗ Branch 5 not taken.
|
20 | .DEF_RO_CLASS_ATTRIB(ConvexBaseType, num_normals_and_offsets) |
| 294 |
2/4✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 10 times.
✗ Branch 5 not taken.
|
20 | .def("point", &ConvexBaseTypeWrapper::point, bp::args("self", "index"), |
| 295 | "Retrieve the point given by its index.", | ||
| 296 | 20 | bp::return_internal_reference<>()) | |
| 297 |
2/4✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 10 times.
✗ Branch 5 not taken.
|
20 | .def("points", &ConvexBaseTypeWrapper::point, bp::args("self", "index"), |
| 298 | "Retrieve the point given by its index.", | ||
| 299 |
2/4✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 10 times.
✗ Branch 5 not taken.
|
60 | ::coal::python::deprecated_member<bp::return_internal_reference<>>()) |
| 300 |
2/4✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 10 times.
✗ Branch 5 not taken.
|
20 | .def("points", &ConvexBaseTypeWrapper::points, bp::args("self"), |
| 301 | "Retrieve all the points.", | ||
| 302 | 20 | bp::with_custodian_and_ward_postcall<0, 1>()) | |
| 303 |
2/4✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 10 times.
✗ Branch 5 not taken.
|
20 | .def("normal", &ConvexBaseTypeWrapper::normal, bp::args("self", "index"), |
| 304 | "Retrieve the normal given by its index.", | ||
| 305 | 20 | bp::return_internal_reference<>()) | |
| 306 |
2/4✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 10 times.
✗ Branch 5 not taken.
|
20 | .def("normals", &ConvexBaseTypeWrapper::normals, bp::args("self"), |
| 307 | "Retrieve all the normals.", | ||
| 308 | 20 | bp::with_custodian_and_ward_postcall<0, 1>()) | |
| 309 |
2/4✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 10 times.
✗ Branch 5 not taken.
|
40 | .def("offset", &ConvexBaseTypeWrapper::offset, bp::args("self", "index"), |
| 310 | "Retrieve the offset given by its index.") | ||
| 311 |
2/4✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 10 times.
✗ Branch 5 not taken.
|
20 | .def("offsets", &ConvexBaseTypeWrapper::offsets, bp::args("self"), |
| 312 | "Retrieve all the offsets.", | ||
| 313 | 20 | bp::with_custodian_and_ward_postcall<0, 1>()) | |
| 314 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
20 | .def("neighbors", &ConvexBaseTypeWrapper::neighbors) |
| 315 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
20 | .def("convexHull", &ConvexBaseTypeWrapper::convexHull, |
| 316 | ✗ | return_value_policy<manage_new_object>()) | |
| 317 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
20 | .staticmethod("convexHull") |
| 318 | 20 | .def("clone", &ConvexBaseType::clone, | |
| 319 |
1/2✓ Branch 2 taken 10 times.
✗ Branch 3 not taken.
|
20 | doxygen::member_func_doc(&ConvexBaseType::clone), |
| 320 | 20 | return_value_policy<manage_new_object>()); | |
| 321 | 20 | } | |
| 322 | |||
| 323 | template <typename PolygonT> | ||
| 324 | 20 | void exposeConvex(const std::string& classname) { | |
| 325 | typedef ConvexTpl<PolygonT> ConvexType; | ||
| 326 | typedef ConvexBaseTpl<typename PolygonT::IndexType> ConvexBaseType; | ||
| 327 | typedef ConvexWrapper<PolygonT> ConvexWrapperType; | ||
| 328 | |||
| 329 |
2/4✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 10 times.
✗ Branch 6 not taken.
|
20 | class_<ConvexType, bases<ConvexBaseType>, shared_ptr<ConvexType>, |
| 330 | noncopyable>(classname.c_str(), doxygen::class_doc<ConvexType>(), | ||
| 331 | no_init) | ||
| 332 |
2/4✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 10 times.
✗ Branch 5 not taken.
|
40 | .def("__init__", |
| 333 | make_constructor(&ConvexWrapper<Triangle32>::constructor)) | ||
| 334 |
1/2✓ Branch 2 taken 10 times.
✗ Branch 3 not taken.
|
20 | .def(dv::init<ConvexType>()) |
| 335 |
1/2✓ Branch 2 taken 10 times.
✗ Branch 3 not taken.
|
20 | .def(dv::init<ConvexType, const ConvexType&>()) |
| 336 |
2/4✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 10 times.
✗ Branch 5 not taken.
|
20 | .DEF_RO_CLASS_ATTRIB(ConvexType, num_polygons) |
| 337 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
20 | .def("polygons", &ConvexWrapperType::polygons) |
| 338 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
20 | .def_pickle(PickleObject<ConvexType>()) |
| 339 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
20 | .def(SerializableVisitor<ConvexType>()) |
| 340 | #if EIGENPY_VERSION_AT_LEAST(3, 8, 0) | ||
| 341 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
20 | .def(eigenpy::IdVisitor<ConvexType>()) |
| 342 | #endif | ||
| 343 | ; | ||
| 344 | 20 | } | |
| 345 | |||
| 346 | 5 | void exposeShapes() { | |
| 347 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | class_<ShapeBase, bases<CollisionGeometry>, shared_ptr<ShapeBase>, |
| 348 | noncopyable>("ShapeBase", doxygen::class_doc<ShapeBase>(), no_init) | ||
| 349 | //.def ("getObjectType", &CollisionGeometry::getObjectType) | ||
| 350 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def(dv::member_func("setSweptSphereRadius", |
| 351 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | &ShapeBase::setSweptSphereRadius)) |
| 352 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def(dv::member_func("getSweptSphereRadius", |
| 353 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
10 | &ShapeBase::getSweptSphereRadius)); |
| 354 | |||
| 355 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | class_<Box, bases<ShapeBase>, shared_ptr<Box>>( |
| 356 | "Box", doxygen::class_doc<ShapeBase>(), no_init) | ||
| 357 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .def(dv::init<Box>()) |
| 358 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .def(dv::init<Box, const Box&>()) |
| 359 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .def(dv::init<Box, Scalar, Scalar, Scalar>()) |
| 360 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .def(dv::init<Box, const Vec3s&>()) |
| 361 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .DEF_RW_CLASS_ATTRIB(Box, halfSide) |
| 362 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .def("clone", &Box::clone, doxygen::member_func_doc(&Box::clone), |
| 363 | ✗ | return_value_policy<manage_new_object>()) | |
| 364 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def_pickle(PickleObject<Box>()) |
| 365 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def(SerializableVisitor<Box>()) |
| 366 | #if EIGENPY_VERSION_AT_LEAST(3, 8, 0) | ||
| 367 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def(eigenpy::IdVisitor<Box>()) |
| 368 | #endif | ||
| 369 | ; | ||
| 370 | |||
| 371 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | class_<Capsule, bases<ShapeBase>, shared_ptr<Capsule>>( |
| 372 | "Capsule", doxygen::class_doc<Capsule>(), no_init) | ||
| 373 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .def(dv::init<Capsule>()) |
| 374 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .def(dv::init<Capsule, Scalar, Scalar>()) |
| 375 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .def(dv::init<Capsule, const Capsule&>()) |
| 376 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .DEF_RW_CLASS_ATTRIB(Capsule, radius) |
| 377 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .DEF_RW_CLASS_ATTRIB(Capsule, halfLength) |
| 378 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .def("clone", &Capsule::clone, doxygen::member_func_doc(&Capsule::clone), |
| 379 | ✗ | return_value_policy<manage_new_object>()) | |
| 380 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def_pickle(PickleObject<Capsule>()) |
| 381 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def(SerializableVisitor<Capsule>()) |
| 382 | #if EIGENPY_VERSION_AT_LEAST(3, 8, 0) | ||
| 383 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def(eigenpy::IdVisitor<Capsule>()) |
| 384 | #endif | ||
| 385 | ; | ||
| 386 | |||
| 387 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
10 | class_<Cone, bases<ShapeBase>, shared_ptr<Cone>>( |
| 388 | "Cone", doxygen::class_doc<Cone>(), no_init) | ||
| 389 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .def(dv::init<Cone>()) |
| 390 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .def(dv::init<Cone, Scalar, Scalar>()) |
| 391 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .def(dv::init<Cone, const Cone&>()) |
| 392 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .DEF_RW_CLASS_ATTRIB(Cone, radius) |
| 393 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .DEF_RW_CLASS_ATTRIB(Cone, halfLength) |
| 394 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .def("clone", &Cone::clone, doxygen::member_func_doc(&Cone::clone), |
| 395 | ✗ | return_value_policy<manage_new_object>()) | |
| 396 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def_pickle(PickleObject<Cone>()) |
| 397 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def(SerializableVisitor<Cone>()) |
| 398 | #if EIGENPY_VERSION_AT_LEAST(3, 8, 0) | ||
| 399 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def(eigenpy::IdVisitor<Cone>()) |
| 400 | #endif | ||
| 401 | ; | ||
| 402 | |||
| 403 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
10 | exposeConvexBase<Triangle16::IndexType>("ConvexBase16"); |
| 404 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
10 | exposeConvexBase<Triangle32::IndexType>("ConvexBase32"); |
| 405 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
10 | exposeConvex<Triangle16>("Convex16"); |
| 406 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
5 | exposeConvex<Triangle32>("Convex32"); |
| 407 |
5/10✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 5 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 5 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 5 times.
✗ Branch 14 not taken.
|
5 | bp::scope().attr("Convex") = bp::scope().attr("Convex32"); |
| 408 | |||
| 409 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | class_<Cylinder, bases<ShapeBase>, shared_ptr<Cylinder>>( |
| 410 | "Cylinder", doxygen::class_doc<Cylinder>(), no_init) | ||
| 411 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .def(dv::init<Cylinder>()) |
| 412 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .def(dv::init<Cylinder, Scalar, Scalar>()) |
| 413 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .def(dv::init<Cylinder, const Cylinder&>()) |
| 414 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .DEF_RW_CLASS_ATTRIB(Cylinder, radius) |
| 415 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .DEF_RW_CLASS_ATTRIB(Cylinder, halfLength) |
| 416 | 10 | .def("clone", &Cylinder::clone, | |
| 417 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | doxygen::member_func_doc(&Cylinder::clone), |
| 418 | ✗ | return_value_policy<manage_new_object>()) | |
| 419 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def_pickle(PickleObject<Cylinder>()) |
| 420 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def(SerializableVisitor<Cylinder>()) |
| 421 | #if EIGENPY_VERSION_AT_LEAST(3, 8, 0) | ||
| 422 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def(eigenpy::IdVisitor<Cylinder>()) |
| 423 | #endif | ||
| 424 | ; | ||
| 425 | |||
| 426 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | class_<Halfspace, bases<ShapeBase>, shared_ptr<Halfspace>>( |
| 427 | "Halfspace", doxygen::class_doc<Halfspace>(), no_init) | ||
| 428 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .def(dv::init<Halfspace, const Vec3s&, Scalar>()) |
| 429 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .def(dv::init<Halfspace, const Halfspace&>()) |
| 430 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .def(dv::init<Halfspace, Scalar, Scalar, Scalar, Scalar>()) |
| 431 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .def(dv::init<Halfspace>()) |
| 432 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .DEF_RW_CLASS_ATTRIB(Halfspace, n) |
| 433 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .DEF_RW_CLASS_ATTRIB(Halfspace, d) |
| 434 | 10 | .def("clone", &Halfspace::clone, | |
| 435 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | doxygen::member_func_doc(&Halfspace::clone), |
| 436 | ✗ | return_value_policy<manage_new_object>()) | |
| 437 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def_pickle(PickleObject<Halfspace>()) |
| 438 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def(SerializableVisitor<Halfspace>()) |
| 439 | #if EIGENPY_VERSION_AT_LEAST(3, 8, 0) | ||
| 440 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def(eigenpy::IdVisitor<Halfspace>()) |
| 441 | #endif | ||
| 442 | ; | ||
| 443 | |||
| 444 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | class_<Plane, bases<ShapeBase>, shared_ptr<Plane>>( |
| 445 | "Plane", doxygen::class_doc<Plane>(), no_init) | ||
| 446 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .def(dv::init<Plane, const Vec3s&, Scalar>()) |
| 447 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .def(dv::init<Plane, const Plane&>()) |
| 448 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .def(dv::init<Plane, Scalar, Scalar, Scalar, Scalar>()) |
| 449 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .def(dv::init<Plane>()) |
| 450 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .DEF_RW_CLASS_ATTRIB(Plane, n) |
| 451 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .DEF_RW_CLASS_ATTRIB(Plane, d) |
| 452 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .def("clone", &Plane::clone, doxygen::member_func_doc(&Plane::clone), |
| 453 | ✗ | return_value_policy<manage_new_object>()) | |
| 454 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def_pickle(PickleObject<Plane>()) |
| 455 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def(SerializableVisitor<Plane>()) |
| 456 | #if EIGENPY_VERSION_AT_LEAST(3, 8, 0) | ||
| 457 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def(eigenpy::IdVisitor<Plane>()) |
| 458 | #endif | ||
| 459 | ; | ||
| 460 | |||
| 461 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | class_<Sphere, bases<ShapeBase>, shared_ptr<Sphere>>( |
| 462 | "Sphere", doxygen::class_doc<Sphere>(), no_init) | ||
| 463 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .def(dv::init<Sphere>()) |
| 464 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .def(dv::init<Sphere, const Sphere&>()) |
| 465 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .def(dv::init<Sphere, Scalar>()) |
| 466 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .DEF_RW_CLASS_ATTRIB(Sphere, radius) |
| 467 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .def("clone", &Sphere::clone, doxygen::member_func_doc(&Sphere::clone), |
| 468 | ✗ | return_value_policy<manage_new_object>()) | |
| 469 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def_pickle(PickleObject<Sphere>()) |
| 470 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def(SerializableVisitor<Sphere>()) |
| 471 | #if EIGENPY_VERSION_AT_LEAST(3, 8, 0) | ||
| 472 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def(eigenpy::IdVisitor<Sphere>()) |
| 473 | #endif | ||
| 474 | ; | ||
| 475 | |||
| 476 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | class_<Ellipsoid, bases<ShapeBase>, shared_ptr<Ellipsoid>>( |
| 477 | "Ellipsoid", doxygen::class_doc<Ellipsoid>(), no_init) | ||
| 478 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .def(dv::init<Ellipsoid>()) |
| 479 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .def(dv::init<Ellipsoid, Scalar, Scalar, Scalar>()) |
| 480 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .def(dv::init<Ellipsoid, Vec3s>()) |
| 481 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .def(dv::init<Ellipsoid, const Ellipsoid&>()) |
| 482 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .DEF_RW_CLASS_ATTRIB(Ellipsoid, radii) |
| 483 | 10 | .def("clone", &Ellipsoid::clone, | |
| 484 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | doxygen::member_func_doc(&Ellipsoid::clone), |
| 485 | ✗ | return_value_policy<manage_new_object>()) | |
| 486 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def_pickle(PickleObject<Ellipsoid>()) |
| 487 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def(SerializableVisitor<Ellipsoid>()) |
| 488 | #if EIGENPY_VERSION_AT_LEAST(3, 8, 0) | ||
| 489 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def(eigenpy::IdVisitor<Ellipsoid>()) |
| 490 | #endif | ||
| 491 | ; | ||
| 492 | |||
| 493 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | class_<TriangleP, bases<ShapeBase>, shared_ptr<TriangleP>>( |
| 494 | "TriangleP", doxygen::class_doc<TriangleP>(), no_init) | ||
| 495 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .def(dv::init<TriangleP>()) |
| 496 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .def(dv::init<TriangleP, const Vec3s&, const Vec3s&, const Vec3s&>()) |
| 497 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .def(dv::init<TriangleP, const TriangleP&>()) |
| 498 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .DEF_RW_CLASS_ATTRIB(TriangleP, a) |
| 499 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .DEF_RW_CLASS_ATTRIB(TriangleP, b) |
| 500 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .DEF_RW_CLASS_ATTRIB(TriangleP, c) |
| 501 | 10 | .def("clone", &TriangleP::clone, | |
| 502 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | doxygen::member_func_doc(&TriangleP::clone), |
| 503 | ✗ | return_value_policy<manage_new_object>()) | |
| 504 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def_pickle(PickleObject<TriangleP>()) |
| 505 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def(SerializableVisitor<TriangleP>()) |
| 506 | #if EIGENPY_VERSION_AT_LEAST(3, 8, 0) | ||
| 507 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def(eigenpy::IdVisitor<TriangleP>()) |
| 508 | #endif | ||
| 509 | ; | ||
| 510 | 5 | } | |
| 511 | |||
| 512 | ✗ | boost::python::tuple AABB_distance_proxy(const AABB& self, const AABB& other) { | |
| 513 | ✗ | Vec3s P, Q; | |
| 514 | ✗ | Scalar distance = self.distance(other, &P, &Q); | |
| 515 | ✗ | return boost::python::make_tuple(distance, P, Q); | |
| 516 | } | ||
| 517 | |||
| 518 | 5 | void exposeCollisionGeometries() { | |
| 519 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
10 | enum_<BVHModelType>("BVHModelType") |
| 520 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .value("BVH_MODEL_UNKNOWN", BVH_MODEL_UNKNOWN) |
| 521 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .value("BVH_MODEL_TRIANGLES", BVH_MODEL_TRIANGLES) |
| 522 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .value("BVH_MODEL_POINTCLOUD", BVH_MODEL_POINTCLOUD) |
| 523 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .export_values(); |
| 524 | |||
| 525 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
10 | enum_<BVHBuildState>("BVHBuildState") |
| 526 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .value("BVH_BUILD_STATE_EMPTY", BVH_BUILD_STATE_EMPTY) |
| 527 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .value("BVH_BUILD_STATE_BEGUN", BVH_BUILD_STATE_BEGUN) |
| 528 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .value("BVH_BUILD_STATE_PROCESSED", BVH_BUILD_STATE_PROCESSED) |
| 529 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .value("BVH_BUILD_STATE_UPDATE_BEGUN", BVH_BUILD_STATE_UPDATE_BEGUN) |
| 530 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .value("BVH_BUILD_STATE_UPDATED", BVH_BUILD_STATE_UPDATED) |
| 531 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .value("BVH_BUILD_STATE_REPLACE_BEGUN", BVH_BUILD_STATE_REPLACE_BEGUN) |
| 532 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .export_values(); |
| 533 | |||
| 534 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | if (!eigenpy::register_symbolic_link_to_registered_type<OBJECT_TYPE>()) { |
| 535 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
10 | enum_<OBJECT_TYPE>("OBJECT_TYPE") |
| 536 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .value("OT_UNKNOWN", OT_UNKNOWN) |
| 537 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .value("OT_BVH", OT_BVH) |
| 538 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .value("OT_GEOM", OT_GEOM) |
| 539 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .value("OT_OCTREE", OT_OCTREE) |
| 540 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .value("OT_HFIELD", OT_HFIELD) |
| 541 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .export_values(); |
| 542 | } | ||
| 543 | |||
| 544 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | if (!eigenpy::register_symbolic_link_to_registered_type<NODE_TYPE>()) { |
| 545 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
10 | enum_<NODE_TYPE>("NODE_TYPE") |
| 546 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .value("BV_UNKNOWN", BV_UNKNOWN) |
| 547 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .value("BV_AABB", BV_AABB) |
| 548 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .value("BV_OBB", BV_OBB) |
| 549 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .value("BV_RSS", BV_RSS) |
| 550 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .value("BV_kIOS", BV_kIOS) |
| 551 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .value("BV_OBBRSS", BV_OBBRSS) |
| 552 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .value("BV_KDOP16", BV_KDOP16) |
| 553 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .value("BV_KDOP18", BV_KDOP18) |
| 554 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .value("BV_KDOP24", BV_KDOP24) |
| 555 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .value("GEOM_BOX", GEOM_BOX) |
| 556 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .value("GEOM_SPHERE", GEOM_SPHERE) |
| 557 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .value("GEOM_ELLIPSOID", GEOM_ELLIPSOID) |
| 558 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .value("GEOM_CAPSULE", GEOM_CAPSULE) |
| 559 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .value("GEOM_CONE", GEOM_CONE) |
| 560 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .value("GEOM_CYLINDER", GEOM_CYLINDER) |
| 561 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .value("GEOM_CONVEX", GEOM_CONVEX) |
| 562 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .value("GEOM_PLANE", GEOM_PLANE) |
| 563 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .value("GEOM_HALFSPACE", GEOM_HALFSPACE) |
| 564 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .value("GEOM_TRIANGLE", GEOM_TRIANGLE) |
| 565 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .value("GEOM_OCTREE", GEOM_OCTREE) |
| 566 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .value("HF_AABB", HF_AABB) |
| 567 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .value("HF_OBBRSS", HF_OBBRSS) |
| 568 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .export_values(); |
| 569 | } | ||
| 570 | |||
| 571 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | class_<AABB>("AABB", |
| 572 | "A class describing the AABB collision structure, which is a " | ||
| 573 | "box in 3D space determined by two diagonal points", | ||
| 574 | no_init) | ||
| 575 |
3/6✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 5 times.
✗ Branch 8 not taken.
|
10 | .def(init<>(bp::arg("self"), "Default constructor")) |
| 576 |
3/6✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 5 times.
✗ Branch 8 not taken.
|
10 | .def(init<AABB>(bp::args("self", "other"), "Copy constructor")) |
| 577 |
3/6✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 5 times.
✗ Branch 8 not taken.
|
10 | .def(init<Vec3s>(bp::args("self", "v"), |
| 578 | "Creating an AABB at position v with zero size.")) | ||
| 579 |
3/6✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 5 times.
✗ Branch 8 not taken.
|
10 | .def(init<Vec3s, Vec3s>(bp::args("self", "a", "b"), |
| 580 | "Creating an AABB with two endpoints a and b.")) | ||
| 581 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
5 | .def(init<AABB, Vec3s>( |
| 582 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
10 | bp::args("self", "core", "delta"), |
| 583 | "Creating an AABB centered as core and is of half-dimension delta.")) | ||
| 584 |
3/6✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 5 times.
✗ Branch 8 not taken.
|
10 | .def(init<Vec3s, Vec3s, Vec3s>(bp::args("self", "a", "b", "c"), |
| 585 | "Creating an AABB contains three points.")) | ||
| 586 | |||
| 587 | 10 | .def("contain", (bool (AABB::*)(const Vec3s&) const) & AABB::contain, | |
| 588 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
10 | bp::args("self", "p"), "Check whether the AABB contains a point p.") |
| 589 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def("contain", (bool (AABB::*)(const AABB&) const) & AABB::contain, |
| 590 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
10 | bp::args("self", "other"), |
| 591 | "Check whether the AABB contains another AABB.") | ||
| 592 | |||
| 593 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def("overlap", (bool (AABB::*)(const AABB&) const) & AABB::overlap, |
| 594 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
10 | bp::args("self", "other"), "Check whether two AABB are overlap.") |
| 595 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def("overlap", |
| 596 | (bool (AABB::*)(const AABB&, AABB&) const) & AABB::overlap, | ||
| 597 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
10 | bp::args("self", "other", "overlapping_part"), |
| 598 | "Check whether two AABB are overlaping and return the overloaping " | ||
| 599 | "part if true.") | ||
| 600 | |||
| 601 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def("distance", (Scalar (AABB::*)(const AABB&) const) & AABB::distance, |
| 602 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
10 | bp::args("self", "other"), "Distance between two AABBs.") |
| 603 | // .def("distance", | ||
| 604 | // AABB_distance_proxy, | ||
| 605 | // bp::args("self","other"), | ||
| 606 | // "Distance between two AABBs.") | ||
| 607 | |||
| 608 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
10 | .add_property( |
| 609 | "min_", | ||
| 610 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | bp::make_function( |
| 611 | ✗ | +[](AABB& self) -> Vec3s& { return self.min_; }, | |
| 612 | ✗ | bp::return_internal_reference<>()), | |
| 613 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
10 | bp::make_function( |
| 614 | 5 | +[](AABB& self, const Vec3s& min_) -> void { self.min_ = min_; }), | |
| 615 | "The min point in the AABB.") | ||
| 616 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .add_property( |
| 617 | "max_", | ||
| 618 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | bp::make_function( |
| 619 | ✗ | +[](AABB& self) -> Vec3s& { return self.max_; }, | |
| 620 | ✗ | bp::return_internal_reference<>()), | |
| 621 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
10 | bp::make_function( |
| 622 | 5 | +[](AABB& self, const Vec3s& max_) -> void { self.max_ = max_; }), | |
| 623 | "The max point in the AABB.") | ||
| 624 | |||
| 625 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .def(bp::self == bp::self) |
| 626 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .def(bp::self != bp::self) |
| 627 | |||
| 628 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .def(bp::self + bp::self) |
| 629 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .def(bp::self += bp::self) |
| 630 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 5 times.
✗ Branch 6 not taken.
|
5 | .def(bp::self += Vec3s()) |
| 631 | |||
| 632 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
10 | .def("size", &AABB::volume, bp::arg("self"), "Size of the AABB.") |
| 633 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
10 | .def("center", &AABB::center, bp::arg("self"), "Center of the AABB.") |
| 634 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
10 | .def("width", &AABB::width, bp::arg("self"), "Width of the AABB.") |
| 635 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
10 | .def("height", &AABB::height, bp::arg("self"), "Height of the AABB.") |
| 636 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
10 | .def("depth", &AABB::depth, bp::arg("self"), "Depth of the AABB.") |
| 637 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
10 | .def("volume", &AABB::volume, bp::arg("self"), "Volume of the AABB.") |
| 638 | |||
| 639 | 10 | .def("expand", | |
| 640 | static_cast<AABB& (AABB::*)(const AABB&, Scalar)>(&AABB::expand), | ||
| 641 | // doxygen::member_func_doc(static_cast<AABB& (AABB::*)(const | ||
| 642 | // AABB &, Scalar)>(&AABB::expand)), | ||
| 643 | // doxygen::member_func_args(static_cast<AABB& | ||
| 644 | // (AABB::*)(const AABB &, Scalar)>(&AABB::expand)), | ||
| 645 | ✗ | bp::return_internal_reference<>()) | |
| 646 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def("expand", static_cast<AABB& (AABB::*)(const Scalar)>(&AABB::expand), |
| 647 | // doxygen::member_func_doc(static_cast<AABB& (AABB::*)(const | ||
| 648 | // Scalar)>(&AABB::expand)), | ||
| 649 | // doxygen::member_func_args(static_cast<AABB& | ||
| 650 | // (AABB::*)(const Scalar)>(&AABB::expand)), | ||
| 651 | ✗ | bp::return_internal_reference<>()) | |
| 652 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def("expand", static_cast<AABB& (AABB::*)(const Vec3s&)>(&AABB::expand), |
| 653 | // doxygen::member_func_doc(static_cast<AABB& (AABB::*)(const | ||
| 654 | // Vec3s &)>(&AABB::expand)), | ||
| 655 | // doxygen::member_func_args(static_cast<AABB& | ||
| 656 | // (AABB::*)(const Vec3s &)>(&AABB::expand)), | ||
| 657 | ✗ | bp::return_internal_reference<>()) | |
| 658 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
5 | .def_pickle(PickleObject<AABB>()) |
| 659 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def(SerializableVisitor<AABB>()) |
| 660 | #if EIGENPY_VERSION_AT_LEAST(3, 8, 0) | ||
| 661 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def(eigenpy::IdVisitor<AABB>()) |
| 662 | #endif | ||
| 663 | ; | ||
| 664 | |||
| 665 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | def("translate", (AABB (*)(const AABB&, const Vec3s&))&translate, |
| 666 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
10 | bp::args("aabb", "t"), "Translate the center of AABB by t"); |
| 667 | |||
| 668 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | def("rotate", (AABB (*)(const AABB&, const Matrix3s&))&rotate, |
| 669 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
10 | bp::args("aabb", "R"), "Rotate the AABB object by R"); |
| 670 | |||
| 671 | 5 | if (!eigenpy::register_symbolic_link_to_registered_type< | |
| 672 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | CollisionGeometry>()) { |
| 673 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
10 | class_<CollisionGeometry, CollisionGeometryPtr_t, noncopyable>( |
| 674 | "CollisionGeometry", no_init) | ||
| 675 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def("getObjectType", &CollisionGeometry::getObjectType) |
| 676 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def("getNodeType", &CollisionGeometry::getNodeType) |
| 677 | |||
| 678 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def("computeLocalAABB", &CollisionGeometry::computeLocalAABB) |
| 679 | |||
| 680 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def("computeCOM", &CollisionGeometry::computeCOM) |
| 681 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def("computeMomentofInertia", |
| 682 | &CollisionGeometry::computeMomentofInertia) | ||
| 683 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def("computeVolume", &CollisionGeometry::computeVolume) |
| 684 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def("computeMomentofInertiaRelatedToCOM", |
| 685 | &CollisionGeometry::computeMomentofInertiaRelatedToCOM) | ||
| 686 | |||
| 687 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def_readwrite("aabb_radius", &CollisionGeometry::aabb_radius, |
| 688 | "AABB radius.") | ||
| 689 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def_readwrite("aabb_center", &CollisionGeometry::aabb_center, |
| 690 | "AABB center in local coordinate.") | ||
| 691 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def_readwrite("aabb_local", &CollisionGeometry::aabb_local, |
| 692 | "AABB in local coordinate, used for tight AABB when " | ||
| 693 | "only translation transform.") | ||
| 694 | |||
| 695 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
10 | .def("isOccupied", &CollisionGeometry::isOccupied, bp::arg("self"), |
| 696 | "Whether the object is completely occupied.") | ||
| 697 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
10 | .def("isFree", &CollisionGeometry::isFree, bp::arg("self"), |
| 698 | "Whether the object is completely free.") | ||
| 699 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
10 | .def("isUncertain", &CollisionGeometry::isUncertain, bp::arg("self"), |
| 700 | "Whether the object has some uncertainty.") | ||
| 701 | |||
| 702 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def_readwrite("cost_density", &CollisionGeometry::cost_density, |
| 703 | "Collision cost for unit volume.") | ||
| 704 | 10 | .def_readwrite("threshold_occupied", | |
| 705 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | &CollisionGeometry::threshold_occupied, |
| 706 | "Threshold for occupied ( >= is occupied).") | ||
| 707 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def_readwrite("threshold_free", &CollisionGeometry::threshold_free, |
| 708 | "Threshold for free (<= is free).") | ||
| 709 | |||
| 710 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .def(self == self) |
| 711 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .def(self != self); |
| 712 | } | ||
| 713 | |||
| 714 | 5 | exposeShapes(); | |
| 715 | |||
| 716 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
10 | class_<BVHModelBase, bases<CollisionGeometry>, BVHModelPtr_t, noncopyable>( |
| 717 | "BVHModelBase", no_init) | ||
| 718 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
5 | .def("vertex", &BVHModelBaseWrapper::vertex, bp::args("self", "index"), |
| 719 | "Retrieve the vertex given by its index.", | ||
| 720 | 5 | bp::return_internal_reference<>()) | |
| 721 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
5 | .def("vertices", &BVHModelBaseWrapper::vertex, bp::args("self", "index"), |
| 722 | "Retrieve the vertex given by its index.", | ||
| 723 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
15 | ::coal::python::deprecated_member<bp::return_internal_reference<>>()) |
| 724 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
5 | .def("vertices", &BVHModelBaseWrapper::vertices, bp::args("self"), |
| 725 | "Retrieve all the vertices.", | ||
| 726 | 5 | bp::with_custodian_and_ward_postcall<0, 1>()) | |
| 727 | // .add_property ("vertices", | ||
| 728 | // bp::make_function(&BVHModelBaseWrapper::vertices,bp::with_custodian_and_ward_postcall<0,1>()), | ||
| 729 | // "Vertices of the BVH.") | ||
| 730 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def("tri_indices", &BVHModelBaseWrapper::tri_indices, |
| 731 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
10 | bp::args("self", "index"), |
| 732 | "Retrieve the triangle given by its index.") | ||
| 733 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def_readonly("num_vertices", &BVHModelBase::num_vertices) |
| 734 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def_readonly("num_tris", &BVHModelBase::num_tris) |
| 735 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def_readonly("build_state", &BVHModelBase::build_state) |
| 736 | |||
| 737 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def_readonly("convex", &BVHModelBase::convex) |
| 738 | |||
| 739 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
5 | .DEF_CLASS_FUNC(BVHModelBase, buildConvexRepresentation) |
| 740 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
5 | .DEF_CLASS_FUNC(BVHModelBase, buildConvexHull) |
| 741 | |||
| 742 | // Expose function to build a BVH | ||
| 743 |
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("beginModel", &BVHModelBase::beginModel)) |
| 744 |
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("addVertex", &BVHModelBase::addVertex)) |
| 745 |
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("addVertices", &BVHModelBase::addVertices)) |
| 746 |
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("addTriangle", &BVHModelBase::addTriangle)) |
| 747 |
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("addTriangles", &BVHModelBase::addTriangles)) |
| 748 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def(dv::member_func<int (BVHModelBase::*)( |
| 749 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | const Vec3ss&, const std::vector<Triangle32>&)>( |
| 750 | "addSubModel", &BVHModelBase::addSubModel)) | ||
| 751 |
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<int (BVHModelBase::*)(const Vec3ss&)>( |
| 752 | "addSubModel", &BVHModelBase::addSubModel)) | ||
| 753 |
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("endModel", &BVHModelBase::endModel)) |
| 754 | // Expose function to replace a BVH | ||
| 755 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def(dv::member_func("beginReplaceModel", |
| 756 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | &BVHModelBase::beginReplaceModel)) |
| 757 |
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("replaceVertex", &BVHModelBase::replaceVertex)) |
| 758 |
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("replaceTriangle", &BVHModelBase::replaceTriangle)) |
| 759 |
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("replaceSubModel", &BVHModelBase::replaceSubModel)) |
| 760 |
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("endReplaceModel", &BVHModelBase::endReplaceModel)) |
| 761 |
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("getModelType", &BVHModelBase::getModelType)); |
| 762 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
10 | exposeBVHModel<OBB>("OBB"); |
| 763 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
10 | exposeBVHModel<OBBRSS>("OBBRSS"); |
| 764 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
10 | exposeHeightField<OBBRSS>("OBBRSS"); |
| 765 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
5 | exposeHeightField<AABB>("AABB"); |
| 766 | 5 | exposeComputeMemoryFootprint(); | |
| 767 | 5 | } | |
| 768 | |||
| 769 | 5 | void exposeCollisionObject() { | |
| 770 | namespace bp = boost::python; | ||
| 771 | |||
| 772 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | if (!eigenpy::register_symbolic_link_to_registered_type<CollisionObject>()) { |
| 773 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
10 | class_<CollisionObject, CollisionObjectPtr_t>("CollisionObject", no_init) |
| 774 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def(dv::init<CollisionObject, const CollisionGeometryPtr_t&, |
| 775 | 5 | bp::optional<bool>>()) | |
| 776 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def(dv::init<CollisionObject, const CollisionGeometryPtr_t&, |
| 777 | 5 | const Transform3s&, bp::optional<bool>>()) | |
| 778 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def(dv::init<CollisionObject, const CollisionGeometryPtr_t&, |
| 779 | 5 | const Matrix3s&, const Vec3s&, bp::optional<bool>>()) | |
| 780 | |||
| 781 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
5 | .DEF_CLASS_FUNC(CollisionObject, getObjectType) |
| 782 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
5 | .DEF_CLASS_FUNC(CollisionObject, getNodeType) |
| 783 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
5 | .DEF_CLASS_FUNC(CollisionObject, computeAABB) |
| 784 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def(dv::member_func("getAABB", |
| 785 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | static_cast<AABB& (CollisionObject::*)()>( |
| 786 | &CollisionObject::getAABB), | ||
| 787 | ✗ | bp::return_internal_reference<>())) | |
| 788 | |||
| 789 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .DEF_CLASS_FUNC2(CollisionObject, getTranslation, |
| 790 | bp::return_value_policy<bp::copy_const_reference>()) | ||
| 791 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
5 | .DEF_CLASS_FUNC(CollisionObject, setTranslation) |
| 792 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .DEF_CLASS_FUNC2(CollisionObject, getRotation, |
| 793 | bp::return_value_policy<bp::copy_const_reference>()) | ||
| 794 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
5 | .DEF_CLASS_FUNC(CollisionObject, setRotation) |
| 795 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .DEF_CLASS_FUNC2(CollisionObject, getTransform, |
| 796 | bp::return_value_policy<bp::copy_const_reference>()) | ||
| 797 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def(dv::member_func( |
| 798 | "setTransform", | ||
| 799 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | static_cast<void (CollisionObject::*)(const Transform3s&)>( |
| 800 | &CollisionObject::setTransform))) | ||
| 801 | |||
| 802 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
5 | .DEF_CLASS_FUNC(CollisionObject, isIdentityTransform) |
| 803 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
5 | .DEF_CLASS_FUNC(CollisionObject, setIdentityTransform) |
| 804 |
1/2✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | .DEF_CLASS_FUNC2(CollisionObject, setCollisionGeometry, |
| 805 | (bp::with_custodian_and_ward_postcall<1, 2>())) | ||
| 806 | |||
| 807 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | .def(dv::member_func( |
| 808 | "collisionGeometry", | ||
| 809 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | static_cast<const CollisionGeometryPtr_t& (CollisionObject::*)()>( |
| 810 | &CollisionObject::collisionGeometry), | ||
| 811 | 5 | bp::return_value_policy<bp::copy_const_reference>())); | |
| 812 | } | ||
| 813 | 5 | } | |
| 814 |