Skip to content

Commit

Permalink
Fixed VoxelPoolingMode in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
timohl committed Jan 26, 2025
1 parent 89e7f3d commit cc02479
Showing 1 changed file with 35 additions and 33 deletions.
68 changes: 35 additions & 33 deletions cpp/pybind/geometry/voxelgrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ void pybind_voxelgrid_declarations(py::module &m) {
voxelgrid(m, "VoxelGrid",
"VoxelGrid is a collection of voxels which are aligned "
"in grid.");
py::enum_<VoxelGrid::VoxelPoolingMode>(
voxelgrid, "VoxelPoolingMode",
"Mode of determining color for each voxel.")
.value("AVG", VoxelGrid::VoxelPoolingMode::AVG)
.value("MIN", VoxelGrid::VoxelPoolingMode::MIN)
.value("MAX", VoxelGrid::VoxelPoolingMode::MAX)
.value("SUM", VoxelGrid::VoxelPoolingMode::SUM);
}
void pybind_voxelgrid_definitions(py::module &m) {
auto voxel = static_cast<py::class_<Voxel, std::shared_ptr<Voxel>>>(
Expand Down Expand Up @@ -64,14 +71,6 @@ void pybind_voxelgrid_definitions(py::module &m) {
std::shared_ptr<VoxelGrid>, Geometry3D>>(
m.attr("VoxelGrid"));

py::enum_<VoxelGrid::VoxelPoolingMode> pooling_mode(
voxelgrid, "VoxelPoolingMode",
"Mode of determining color for each voxel.");
pooling_mode.value("AVG", VoxelGrid::VoxelPoolingMode::AVG)
.value("MIN", VoxelGrid::VoxelPoolingMode::MIN)
.value("MAX", VoxelGrid::VoxelPoolingMode::MAX)
.value("SUM", VoxelGrid::VoxelPoolingMode::SUM);

py::detail::bind_default_constructor<VoxelGrid>(voxelgrid);
py::detail::bind_copy_functions<VoxelGrid>(voxelgrid);
voxelgrid
Expand Down Expand Up @@ -135,26 +134,29 @@ void pybind_voxelgrid_definitions(py::module &m) {
"carving",
"origin"_a, "color"_a, "voxel_size"_a, "width"_a,
"height"_a, "depth"_a)
.def_static("create_from_point_cloud",
&VoxelGrid::CreateFromPointCloud,
"Creates a VoxelGrid from a given PointCloud. The "
"color value of a given voxel is determined by the "
"VoxelPoolingMode, e.g. by default the average color "
"value of the points that fall into it (if the "
"PointCloud has colors). The bounds of the created "
"VoxelGrid are computed from the PointCloud.",
"input"_a, "voxel_size"_a,
"pooling_mode"_a = VoxelGrid::VoxelPoolingMode::AVG)
.def_static("create_from_point_cloud_within_bounds",
&VoxelGrid::CreateFromPointCloudWithinBounds,
"Creates a VoxelGrid from a given PointCloud. The "
"color value of a given voxel is determined by the "
"VoxelPoolingMode, e.g. by default the average color "
"value of the points that fall into it (if the "
"PointCloud has colors). The bounds of the created "
"VoxelGrid are defined by the given parameters.",
"input"_a, "voxel_size"_a, "min_bound"_a, "max_bound"_a,
"pooling_mode"_a = VoxelGrid::VoxelPoolingMode::AVG)
.def_static(
"create_from_point_cloud", &VoxelGrid::CreateFromPointCloud,
"Creates a VoxelGrid from a given PointCloud. The "
"color value of a given voxel is determined by the "
"VoxelPoolingMode, e.g. by default the average color "
"value of the points that fall into it (if the "
"PointCloud has colors). The bounds of the created "
"VoxelGrid are computed from the PointCloud.",
"input"_a, "voxel_size"_a,
py::arg_v("pooling_mode", VoxelGrid::VoxelPoolingMode::AVG,
"VoxelPoolingMode.AVG"))
.def_static(
"create_from_point_cloud_within_bounds",
&VoxelGrid::CreateFromPointCloudWithinBounds,
"Creates a VoxelGrid from a given PointCloud. The "
"color value of a given voxel is determined by the "
"VoxelPoolingMode, e.g. by default the average color "
"value of the points that fall into it (if the "
"PointCloud has colors). The bounds of the created "
"VoxelGrid are defined by the given parameters.",
"input"_a, "voxel_size"_a, "min_bound"_a, "max_bound"_a,
py::arg_v("pooling_mode", VoxelGrid::VoxelPoolingMode::AVG,
"VoxelPoolingMode.AVG"))
.def_static("create_from_triangle_mesh",
&VoxelGrid::CreateFromTriangleMesh,
"Creates a VoxelGrid from a given TriangleMesh. No "
Expand Down Expand Up @@ -221,20 +223,20 @@ void pybind_voxelgrid_definitions(py::module &m) {
m, "VoxelGrid", "create_dense",
{{"origin", "Coordinate center of the VoxelGrid"},
{"color", "Voxel color for all voxels if the VoxelGrid."},
{"voxel_size", "Voxel size of of the VoxelGrid construction."},
{"voxel_size", "Voxel size of the VoxelGrid construction."},
{"width", "Spatial width extend of the VoxelGrid."},
{"height", "Spatial height extend of the VoxelGrid."},
{"depth", "Spatial depth extend of the VoxelGrid."}});
docstring::ClassMethodDocInject(
m, "VoxelGrid", "create_from_point_cloud",
{{"input", "The input PointCloud"},
{"voxel_size", "Voxel size of of the VoxelGrid construction."},
{"voxel_size", "Voxel size of the VoxelGrid construction."},
{"pooling_mode",
"VoxelPoolingMode for determining voxel color."}});
docstring::ClassMethodDocInject(
m, "VoxelGrid", "create_from_point_cloud_within_bounds",
{{"input", "The input PointCloud"},
{"voxel_size", "Voxel size of of the VoxelGrid construction."},
{"voxel_size", "Voxel size of the VoxelGrid construction."},
{"min_bound",
"Minimum boundary point for the VoxelGrid to create."},
{"max_bound",
Expand All @@ -245,11 +247,11 @@ void pybind_voxelgrid_definitions(py::module &m) {
docstring::ClassMethodDocInject(
m, "VoxelGrid", "create_from_triangle_mesh",
{{"input", "The input TriangleMesh"},
{"voxel_size", "Voxel size of of the VoxelGrid construction."}});
{"voxel_size", "Voxel size of the VoxelGrid construction."}});
docstring::ClassMethodDocInject(
m, "VoxelGrid", "create_from_triangle_mesh_within_bounds",
{{"input", "The input TriangleMesh"},
{"voxel_size", "Voxel size of of the VoxelGrid construction."},
{"voxel_size", "Voxel size of the VoxelGrid construction."},
{"min_bound",
"Minimum boundary point for the VoxelGrid to create."},
{"max_bound",
Expand Down

0 comments on commit cc02479

Please sign in to comment.