Skip to content

Commit 92294da

Browse files
doyubkimutilForever
authored andcommitted
Fix default params for ImplicitTriangleMesh3 (#223)
1 parent acaaaae commit 92294da

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

include/jet/implicit_triangle_mesh3.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ class ImplicitTriangleMesh3 final : public ImplicitSurface3 {
2828
class Builder;
2929

3030
//! Constructs an ImplicitSurface3 with mesh and other grid parameters.
31-
ImplicitTriangleMesh3(const TriangleMesh3Ptr& mesh, size_t resolutionX,
32-
double margin,
31+
ImplicitTriangleMesh3(const TriangleMesh3Ptr& mesh, size_t resolutionX = 32,
32+
double margin = 0.2,
3333
const Transform3& transform = Transform3(),
3434
bool isNormalFlipped = false);
3535

src/examples/python_examples/apic_example03.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@ def main():
2626
bunny_filename = os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../../resources/bunny.obj')
2727
bunny_mesh = TriangleMesh3()
2828
bunny_mesh.readObj(bunny_filename)
29-
bunny_sdf = ImplicitTriangleMesh3(mesh=bunny_mesh, resolutionX=64, margin=0)
29+
bunny_sdf = ImplicitTriangleMesh3(mesh=bunny_mesh, resolutionX=64, margin=0.2)
3030
emitter = VolumeParticleEmitter3(implicitSurface=bunny_sdf, spacing=1.0 / (2 * resX), isOneShot=False)
3131
solver.particleEmitter = emitter
3232

3333
# Convert to surface
3434
grid_size = 1.0 / resX
35-
grid = CellCenteredScalarGrid3((resX, resX, resX), (grid_size, grid_size, grid_size))
35+
grid = VertexCenteredScalarGrid3((resX, resX, resX), (grid_size, grid_size, grid_size))
3636

3737
def write_surface(frame_cnt, pos):
38-
converter = SphPointsToImplicit3(2.0 * grid_size, 0.5)
38+
converter = SphPointsToImplicit3(1.5 * grid_size, 0.5)
3939
converter.convert(pos.tolist(), grid)
4040
surface_mesh = marchingCubes(grid, (grid_size, grid_size, grid_size), (0, 0, 0), 0.0, DIRECTION_ALL)
4141
surface_mesh.writeObj('frame_{:06d}.obj'.format(frame_cnt))

src/python/implicit_triangle_mesh.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ void addImplicitTriangleMesh3(pybind11::module& m) {
2929
R"pbdoc(
3030
Constructs an ImplicitSurface3 with mesh and other grid parameters.
3131
)pbdoc",
32-
py::arg("mesh"), py::arg("resolutionX"), py::arg("margin"),
33-
py::arg("transform") = Transform3(),
32+
py::arg("mesh"), py::arg("resolutionX") = 32,
33+
py::arg("margin") = 0.2, py::arg("transform") = Transform3(),
3434
py::arg("isNormalFlipped") = false)
3535
.def_property_readonly("grid", &ImplicitTriangleMesh3::grid,
3636
R"pbdoc(The grid data.)pbdoc");

0 commit comments

Comments
 (0)