diff --git a/bindings/c/cross.cpp b/bindings/c/cross.cpp index d05e07e46..d91ad78f0 100644 --- a/bindings/c/cross.cpp +++ b/bindings/c/cross.cpp @@ -59,12 +59,12 @@ size_t manifold_cross_section_vec_length(ManifoldCrossSectionVec *csv) { } ManifoldCrossSection *manifold_cross_section_vec_get( - void *mem, ManifoldCrossSectionVec *csv, int idx) { + void *mem, ManifoldCrossSectionVec *csv, size_t idx) { auto cs = (*from_c(csv))[idx]; return to_c(new (mem) CrossSection(cs)); } -void manifold_cross_section_vec_set(ManifoldCrossSectionVec *csv, int idx, +void manifold_cross_section_vec_set(ManifoldCrossSectionVec *csv, size_t idx, ManifoldCrossSection *cs) { (*from_c(csv))[idx] = *from_c(cs); } diff --git a/bindings/c/include/manifold/manifoldc.h b/bindings/c/include/manifold/manifoldc.h index 580b098dc..e56dca5c9 100644 --- a/bindings/c/include/manifold/manifoldc.h +++ b/bindings/c/include/manifold/manifoldc.h @@ -30,14 +30,14 @@ ManifoldPolygons *manifold_polygons(void *mem, ManifoldSimplePolygon **ps, size_t length); size_t manifold_simple_polygon_length(ManifoldSimplePolygon *p); size_t manifold_polygons_length(ManifoldPolygons *ps); -size_t manifold_polygons_simple_length(ManifoldPolygons *ps, int idx); +size_t manifold_polygons_simple_length(ManifoldPolygons *ps, size_t idx); ManifoldVec2 manifold_simple_polygon_get_point(ManifoldSimplePolygon *p, - int idx); + size_t idx); ManifoldSimplePolygon *manifold_polygons_get_simple(void *mem, ManifoldPolygons *ps, - int idx); -ManifoldVec2 manifold_polygons_get_point(ManifoldPolygons *ps, int simple_idx, - int pt_idx); + size_t idx); +ManifoldVec2 manifold_polygons_get_point(ManifoldPolygons *ps, + size_t simple_idx, size_t pt_idx); // Mesh Construction @@ -88,8 +88,8 @@ ManifoldManifoldVec *manifold_manifold_vec(void *mem, size_t sz); void manifold_manifold_vec_reserve(ManifoldManifoldVec *ms, size_t sz); size_t manifold_manifold_vec_length(ManifoldManifoldVec *ms); ManifoldManifold *manifold_manifold_vec_get(void *mem, ManifoldManifoldVec *ms, - int idx); -void manifold_manifold_vec_set(ManifoldManifoldVec *ms, int idx, + size_t idx); +void manifold_manifold_vec_set(ManifoldManifoldVec *ms, size_t idx, ManifoldManifold *m); void manifold_manifold_vec_push_back(ManifoldManifoldVec *ms, ManifoldManifold *m); @@ -195,7 +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); +int manifold_num_prop(ManifoldManifold *m); ManifoldBox *manifold_bounding_box(void *mem, ManifoldManifold *m); double manifold_epsilon(ManifoldManifold *m); int manifold_genus(ManifoldManifold *m); @@ -243,8 +243,8 @@ void manifold_cross_section_vec_reserve(ManifoldCrossSectionVec *csv, size_t sz); size_t manifold_cross_section_vec_length(ManifoldCrossSectionVec *csv); ManifoldCrossSection *manifold_cross_section_vec_get( - void *mem, ManifoldCrossSectionVec *csv, int idx); -void manifold_cross_section_vec_set(ManifoldCrossSectionVec *csv, int idx, + void *mem, ManifoldCrossSectionVec *csv, size_t idx); +void manifold_cross_section_vec_set(ManifoldCrossSectionVec *csv, size_t idx, ManifoldCrossSection *cs); void manifold_cross_section_vec_push_back(ManifoldCrossSectionVec *csv, ManifoldCrossSection *cs); diff --git a/bindings/c/manifoldc.cpp b/bindings/c/manifoldc.cpp index ca40b344b..7ec184594 100644 --- a/bindings/c/manifoldc.cpp +++ b/bindings/c/manifoldc.cpp @@ -73,24 +73,24 @@ size_t manifold_polygons_length(ManifoldPolygons *ps) { return from_c(ps)->size(); } -size_t manifold_polygons_simple_length(ManifoldPolygons *ps, int idx) { +size_t manifold_polygons_simple_length(ManifoldPolygons *ps, size_t idx) { return (*from_c(ps))[idx].size(); } ManifoldVec2 manifold_simple_polygon_get_point(ManifoldSimplePolygon *p, - int idx) { + size_t idx) { return to_c((*from_c(p))[idx]); } ManifoldSimplePolygon *manifold_polygons_get_simple(void *mem, ManifoldPolygons *ps, - int idx) { + size_t idx) { auto sp = (*from_c(ps))[idx]; return to_c(new (mem) SimplePolygon(sp)); } -ManifoldVec2 manifold_polygons_get_point(ManifoldPolygons *ps, int simple_idx, - int pt_idx) { +ManifoldVec2 manifold_polygons_get_point(ManifoldPolygons *ps, + size_t simple_idx, size_t pt_idx) { return to_c((*from_c(ps))[simple_idx][pt_idx]); } @@ -111,12 +111,12 @@ size_t manifold_manifold_vec_length(ManifoldManifoldVec *ms) { } ManifoldManifold *manifold_manifold_vec_get(void *mem, ManifoldManifoldVec *ms, - int idx) { + size_t idx) { auto m = (*from_c(ms))[idx]; return to_c(new (mem) Manifold(m)); } -void manifold_manifold_vec_set(ManifoldManifoldVec *ms, int idx, +void manifold_manifold_vec_set(ManifoldManifoldVec *ms, size_t idx, ManifoldManifold *m) { (*from_c(ms))[idx] = *from_c(m); } @@ -633,7 +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_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) { diff --git a/include/manifold/manifold.h b/include/manifold/manifold.h index a4f65e9c4..9574fb190 100644 --- a/include/manifold/manifold.h +++ b/include/manifold/manifold.h @@ -270,7 +270,7 @@ class Manifold { size_t NumVert() const; size_t NumEdge() const; size_t NumTri() const; - size_t NumProp() const; + int NumProp() const; size_t NumPropVert() const; Box BoundingBox() const; int Genus() const; diff --git a/src/impl.h b/src/impl.h index 8f7d70009..cba015586 100644 --- a/src/impl.h +++ b/src/impl.h @@ -265,7 +265,7 @@ struct Manifold::Impl { size_t NumVert() const { return vertPos_.size(); } size_t NumEdge() const { return halfedge_.size() / 2; } size_t NumTri() const { return halfedge_.size() / 3; } - size_t NumProp() const { return meshRelation_.numProp; } + int NumProp() const { return meshRelation_.numProp; } size_t NumPropVert() const { return NumProp() == 0 ? NumVert() : meshRelation_.properties.size() / NumProp(); diff --git a/src/manifold.cpp b/src/manifold.cpp index a36dd460b..a35d91e4b 100644 --- a/src/manifold.cpp +++ b/src/manifold.cpp @@ -360,9 +360,7 @@ size_t Manifold::NumTri() const { return GetCsgLeafNode().GetImpl()->NumTri(); } /** * The number of properties per vertex in the Manifold. */ -size_t Manifold::NumProp() const { - return GetCsgLeafNode().GetImpl()->NumProp(); -} +int Manifold::NumProp() const { return GetCsgLeafNode().GetImpl()->NumProp(); } /** * The number of property vertices in the Manifold. This will always be >= * NumVert, as some physical vertices may be duplicated to account for different