octree.cc
Go to the documentation of this file.
1 
2 #include "coal.hh"
3 
4 #include <eigenpy/std-vector.hpp>
5 
6 #include "coal/fwd.hh"
7 #include "coal/octree.h"
8 
9 #ifdef COAL_HAS_DOXYGEN_AUTODOC
10 #include "doxygen_autodoc/functions.h"
11 #include "doxygen_autodoc/coal/octree.h"
12 #endif
13 
14 bp::object toPyBytes(std::vector<uint8_t>& bytes) {
15 #if PY_MAJOR_VERSION == 2
16  PyObject* py_buf =
17  PyBuffer_FromMemory((char*)bytes.data(), Py_ssize_t(bytes.size()));
18  return bp::object(bp::handle<>(py_buf));
19 #else
20  PyObject* py_buf = PyMemoryView_FromMemory(
21  (char*)bytes.data(), Py_ssize_t(bytes.size()), PyBUF_READ);
22  return bp::object(bp::handle<>(PyBytes_FromObject(py_buf)));
23 #endif
24 }
25 
26 bp::object tobytes(const coal::OcTree& self) {
27  std::vector<uint8_t> bytes = self.tobytes();
28  return toPyBytes(bytes);
29 }
30 
31 void exposeOctree() {
32  using namespace coal;
33  namespace bp = boost::python;
34  namespace dv = doxygen::visitor;
35 
36  bp::class_<OcTree, bp::bases<CollisionGeometry>, shared_ptr<OcTree> >(
37  "OcTree", doxygen::class_doc<OcTree>(), bp::no_init)
38  .def(dv::init<OcTree, CoalScalar>())
40  bp::return_value_policy<bp::manage_new_object>())
41  .def(dv::member_func("getTreeDepth", &OcTree::getTreeDepth))
42  .def(dv::member_func("size", &OcTree::size))
43  .def(dv::member_func("getResolution", &OcTree::getResolution))
44  .def(dv::member_func("getOccupancyThres", &OcTree::getOccupancyThres))
45  .def(dv::member_func("getFreeThres", &OcTree::getFreeThres))
46  .def(dv::member_func("getDefaultOccupancy", &OcTree::getDefaultOccupancy))
47  .def(dv::member_func("setCellDefaultOccupancy",
49  .def(dv::member_func("setOccupancyThres", &OcTree::setOccupancyThres))
50  .def(dv::member_func("setFreeThres", &OcTree::setFreeThres))
51  .def(dv::member_func("getRootBV", &OcTree::getRootBV))
52  .def(dv::member_func("toBoxes", &OcTree::toBoxes))
54 
55  doxygen::def("makeOctree", &makeOctree);
56  eigenpy::enableEigenPySpecific<Vec6s>();
58  "StdVec_Vec6");
59 }
octree.h
boost::python
coal::OcTree::toBoxes
std::vector< Vec6s > toBoxes() const
transform the octree into a bunch of boxes; uncertainty information is kept in the boxes....
Definition: coal/octree.h:178
coal.hh
eigenpy::StdVectorPythonVisitor
exposeOctree
void exposeOctree()
Definition: octree.cc:31
coal::OcTree::getRootBV
AABB getRootBV() const
get the bounding volume for the root
Definition: coal/octree.h:139
coal
Main namespace.
Definition: coal/broadphase/broadphase_bruteforce.h:44
doxygen::visitor
Definition: doxygen-boost.hh:12
coal::OcTree::size
unsigned long size() const
Returns the size of the octree.
Definition: coal/octree.h:150
coal::OcTree::tobytes
std::vector< uint8_t > tobytes() const
Returns a byte description of *this.
Definition: coal/octree.h:203
coal::makeOctree
COAL_DLLAPI OcTreePtr_t makeOctree(const Eigen::Matrix< CoalScalar, Eigen::Dynamic, 3 > &point_cloud, const CoalScalar resolution)
Build an OcTree from a point cloud and a given resolution.
Definition: src/octree.cpp:188
doxygen::def
void def(const char *name, Func func)
Definition: doxygen-boost.hh:106
coal::OcTree::getResolution
CoalScalar getResolution() const
Returns the resolution of the octree.
Definition: coal/octree.h:153
std-vector.hpp
coal::OcTree::getOccupancyThres
CoalScalar getOccupancyThres() const
the threshold used to decide whether one node is occupied, this is NOT the octree occupied_thresold
Definition: coal/octree.h:225
fwd.hh
doxygen::visitor::member_func
member_func_impl< function_type > member_func(const char *name, const function_type &function)
Definition: doxygen-boost.hh:49
coal::OcTree::setFreeThres
void setFreeThres(CoalScalar d)
Definition: coal/octree.h:237
coal::OcTree::setOccupancyThres
void setOccupancyThres(CoalScalar d)
Definition: coal/octree.h:235
coal::OcTree::setCellDefaultOccupancy
void setCellDefaultOccupancy(CoalScalar d)
Definition: coal/octree.h:233
toPyBytes
bp::object toPyBytes(std::vector< uint8_t > &bytes)
Definition: octree.cc:14
coal::OcTree
Octree is one type of collision geometry which can encode uncertainty information in the sensor data.
Definition: coal/octree.h:53
coal::OcTree::getDefaultOccupancy
CoalScalar getDefaultOccupancy() const
Definition: coal/octree.h:231
coal::OcTree::clone
OcTree * clone() const
Clone *this into a new Octree.
Definition: coal/octree.h:97
tobytes
bp::object tobytes(const coal::OcTree &self)
Definition: octree.cc:26
coal::OcTree::getFreeThres
CoalScalar getFreeThres() const
the threshold used to decide whether one node is free, this is NOT the octree free_threshold
Definition: coal/octree.h:229
coal::OcTree::getTreeDepth
unsigned int getTreeDepth() const
Returns the depth of the octree.
Definition: coal/octree.h:147
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:58