Skip to content

Commit 6d8508c

Browse files
author
Teseo Schneider
committed
sparse_voxel_grid
1 parent 78db79d commit 6d8508c

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed

src/sparse_voxel_grid.cpp

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#include <common.h>
2+
#include <npe.h>
3+
#include <typedefs.h>
4+
5+
#include <pybind11/functional.h>
6+
#include <pybind11/stl.h>
7+
8+
#include <igl/sparse_voxel_grid.h>
9+
10+
const char *ds_sparse_voxel_grid = R"igl_Qu8mg5v7(
11+
12+
sparse_voxel_grid( p0, scalarFunc, eps, CV, CS, CI )
13+
Given a point, p0, on an isosurface, construct a shell of epsilon sized cubes surrounding the surface.
14+
These cubes can be used as the input to marching cubes.
15+
16+
17+
Parameters
18+
----------
19+
p0 A 3D point on the isosurface surface defined by scalarFunc(x) = 0
20+
scalarFunc A scalar function from R^3 to R -- points which map to 0 lie
21+
on the surface, points which are negative lie inside the surface,
22+
and points which are positive lie outside the surface
23+
eps The edge length of the cubes surrounding the surface
24+
expected_number_of_cubes This pre-allocates internal data structures to speed things up
25+
26+
Returns
27+
-------
28+
29+
CS #cube-vertices by 1 list of scalar values at the cube vertices
30+
CV #cube-vertices by 3 list of cube vertex positions
31+
CI #number of cubes by 8 list of indexes into CS and CV. Each row represents a cube
32+
33+
See also
34+
--------
35+
36+
37+
Notes
38+
-----
39+
None
40+
41+
Examples
42+
--------
43+
44+
)igl_Qu8mg5v7";
45+
46+
npe_function(sparse_voxel_grid)
47+
npe_doc(ds_sparse_voxel_grid)
48+
49+
npe_arg(p0, EigenDenseFloat)
50+
npe_arg(scalar_func, const std::function< typename EigenDenseFloat::Scalar (Eigen::Matrix<typename EigenDenseFloat::Scalar, 1, 3> &) >)
51+
npe_arg(eps, double)
52+
npe_arg(expected_number_of_cubes, int)
53+
54+
55+
npe_begin_code()
56+
57+
EigenDenseFloat cs;
58+
EigenDenseFloat cv;
59+
EigenDenseInt ci;
60+
igl::sparse_voxel_grid(p0, scalar_func, eps, expected_number_of_cubes, cs, cv, ci);
61+
return std::make_tuple(npe::move(cs), npe::move(cv), npe::move(ci));
62+
63+
npe_end_code()
64+
65+

0 commit comments

Comments
 (0)