Skip to content

Commit

Permalink
Feature/update bindings (#29)
Browse files Browse the repository at this point in the history
* add version method to bindings

* add bounding box min and max properties
  • Loading branch information
nathanhhughes authored Dec 12, 2024
1 parent 9743cc9 commit 6ac0396
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions python/bindings/spark_dsg_bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include <spark_dsg/scene_graph_utilities.h>
#include <spark_dsg/serialization/file_io.h>
#include <spark_dsg/serialization/graph_binary_serialization.h>
#include <spark_dsg/serialization/versioning.h>

#include <iomanip>
#include <iostream>
Expand Down Expand Up @@ -234,6 +235,14 @@ PYBIND11_MODULE(_dsg_bindings, module) {
.def("compute_iou",
static_cast<float (BoundingBox::*)(const BoundingBox&) const>(
&BoundingBox::computeIoU))
.def_property_readonly("min",
[](const BoundingBox& box) {
return box.pointToWorldFrame(-box.dimensions / 2);
})
.def_property_readonly("max",
[](const BoundingBox& box) {
return box.pointToWorldFrame(box.dimensions / 2);
})
.def("__repr__", [](const BoundingBox& box) {
std::stringstream ss;
ss << box;
Expand Down Expand Up @@ -828,5 +837,8 @@ PYBIND11_MODULE(_dsg_bindings, module) {
"child_layer"_a = DsgLayers::PLACES,
"bbox_type"_a = BoundingBox::Type::AABB);

module.def("version",
[]() { return spark_dsg::io::FileHeader::current().version.toString(); });

py::implicitly_convertible<char, LayerPrefix>();
}

0 comments on commit 6ac0396

Please sign in to comment.