Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add C binding for Manifold::NumProp() #1078

Merged
merged 1 commit into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bindings/c/include/manifold/manifoldc.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ ManifoldError manifold_status(ManifoldManifold *m);
size_t manifold_num_vert(ManifoldManifold *m);
size_t manifold_num_edge(ManifoldManifold *m);
size_t manifold_num_tri(ManifoldManifold *m);
size_t manifold_num_prop(ManifoldManifold *m);
ManifoldBox *manifold_bounding_box(void *mem, ManifoldManifold *m);
double manifold_epsilon(ManifoldManifold *m);
int manifold_genus(ManifoldManifold *m);
Expand Down
1 change: 1 addition & 0 deletions bindings/c/manifoldc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,7 @@ ManifoldError manifold_status(ManifoldManifold *m) {
size_t manifold_num_vert(ManifoldManifold *m) { return from_c(m)->NumVert(); }
size_t manifold_num_edge(ManifoldManifold *m) { return from_c(m)->NumEdge(); }
size_t manifold_num_tri(ManifoldManifold *m) { return from_c(m)->NumTri(); }
size_t manifold_num_prop(ManifoldManifold *m) { return from_c(m)->NumProp(); };
int manifold_genus(ManifoldManifold *m) { return from_c(m)->Genus(); }

double manifold_surface_area(ManifoldManifold *m) {
Expand Down
5 changes: 5 additions & 0 deletions test/manifoldc_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,10 +294,15 @@ TEST(CBIND, properties) {

ManifoldManifold *cube =
manifold_cube(alloc_manifold_buffer(), 1.0, 1.0, 1.0, 1);
EXPECT_EQ(manifold_num_prop(cube), 0);

ManifoldManifold *cube_props =
manifold_set_properties(alloc_manifold_buffer(), cube, 1, props, NULL);
EXPECT_EQ(manifold_num_prop(cube_props), 1);

ManifoldManifold *cube_props_context = manifold_set_properties(
alloc_manifold_buffer(), cube, 1, propscontext, context);
EXPECT_EQ(manifold_num_prop(cube_props_context), 1);

manifold_destruct_manifold(cube);
manifold_destruct_manifold(cube_props);
Expand Down