From 5fb17a52a8369ce7dd397daaf184f3c3f6934585 Mon Sep 17 00:00:00 2001 From: imadhammani Date: Thu, 21 Nov 2024 11:48:06 +0100 Subject: [PATCH] XCore: remove warnings --- Cassiopee/XCore/XCore/intersectMesh/dcel.cpp | 3 +-- Cassiopee/XCore/XCore/intersectMesh/dcel_reconstruct.cpp | 4 ++-- Cassiopee/XCore/XCore/intersectMesh/icapsule.cpp | 4 ++-- Cassiopee/XCore/XCore/intersectMesh/smesh_locate.cpp | 7 +++++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Cassiopee/XCore/XCore/intersectMesh/dcel.cpp b/Cassiopee/XCore/XCore/intersectMesh/dcel.cpp index e3d175d0b..f3388a360 100644 --- a/Cassiopee/XCore/XCore/intersectMesh/dcel.cpp +++ b/Cassiopee/XCore/XCore/intersectMesh/dcel.cpp @@ -705,7 +705,6 @@ void Dcel::triangulate(const Smesh &Mf, const Smesh &Sf) std::vector non_convex_faces; for (size_t fid = 0; fid < F.size(); fid++) { - Face *f = F[fid]; // TODO(Imad): skip single color faces const auto &vertices = Fv[fid]; @@ -767,7 +766,7 @@ void Dcel::triangulate(const Smesh &Mf, const Smesh &Sf) E_Int vid = 0; do { Vertex *v = current->v; - char fname[16] = {0}; + char fname[128] = {0}; sprintf(fname, "vertex%d.im", vid); point_write(fname, v->x, v->y, v->z); current = current->next; diff --git a/Cassiopee/XCore/XCore/intersectMesh/dcel_reconstruct.cpp b/Cassiopee/XCore/XCore/intersectMesh/dcel_reconstruct.cpp index f717887d4..129f73b3f 100644 --- a/Cassiopee/XCore/XCore/intersectMesh/dcel_reconstruct.cpp +++ b/Cassiopee/XCore/XCore/intersectMesh/dcel_reconstruct.cpp @@ -32,7 +32,7 @@ void Dcel::reconstruct(Smesh &Mf, int color) const for (size_t i = 0; i < faces_to_keep.size(); i++) { E_Int fid = faces_to_keep[i]; - Face *f = F[fid]; + //Face *f = F[fid]; const auto &vertices = Fv[fid]; for (size_t j = 0; j < vertices.size(); j++) { Vertex *v = vertices[j]; @@ -71,7 +71,7 @@ void Dcel::reconstruct(Smesh &Mf, int color) const // Add the rest of the children for (size_t i = 1; i < children.size(); i++) { - Face *f = F[children[i]]; + //Face *f = F[children[i]]; const auto &vertices = Fv[children[i]]; std::vector PN(vertices.size()); for (size_t j = 0; j < vertices.size(); j++) { diff --git a/Cassiopee/XCore/XCore/intersectMesh/icapsule.cpp b/Cassiopee/XCore/XCore/intersectMesh/icapsule.cpp index 5e0638a89..54bed37e4 100644 --- a/Cassiopee/XCore/XCore/intersectMesh/icapsule.cpp +++ b/Cassiopee/XCore/XCore/intersectMesh/icapsule.cpp @@ -410,7 +410,7 @@ PyObject *K_XCORE::icapsule_intersect(PyObject *self, PyObject *args) for (size_t i = 0; i < Ss.size(); i++) { - printf("Intersecting slave %d\n", i); + printf("Intersecting slave %lu\n", i); Mf.make_bbox(); Mf.hash_faces(); @@ -438,7 +438,7 @@ PyObject *K_XCORE::icapsule_intersect(PyObject *self, PyObject *args) Dcel D = Dcel::intersect(Mf, Sf, plocs); - E_Int nf_before_intersect = Sf.nf; + //E_Int nf_before_intersect = Sf.nf; D.reconstruct(Mf, Dcel::RED); //Mf.write_ngon("Mf_after_intersect.im"); diff --git a/Cassiopee/XCore/XCore/intersectMesh/smesh_locate.cpp b/Cassiopee/XCore/XCore/intersectMesh/smesh_locate.cpp index 5039f294c..d673bbe68 100644 --- a/Cassiopee/XCore/XCore/intersectMesh/smesh_locate.cpp +++ b/Cassiopee/XCore/XCore/intersectMesh/smesh_locate.cpp @@ -35,6 +35,8 @@ Point2D project_to_2D(Point3D point, const E_Float *N) return projected; } +#define MAX_PTS 100 + bool Smesh::is_point_in_3D_polygon(E_Float x, E_Float y, E_Float z, E_Int fid) const { const auto &pn = Fc[fid]; @@ -44,8 +46,9 @@ bool Smesh::is_point_in_3D_polygon(E_Float x, E_Float y, E_Float z, E_Int fid) c E_Float dp = fabs(K_MATH::dot(ap, fN, 3)); if (dp > TOL) return false; - Point2D projected_polygon[pn.size()]; - for (int i = 0; i < pn.size(); i++) { + assert(pn.size() <= MAX_PTS); + Point2D projected_polygon[MAX_PTS]; + for (size_t i = 0; i < pn.size(); i++) { Point3D p = {X[pn[i]], Y[pn[i]], Z[pn[i]]}; projected_polygon[i] = project_to_2D(p, fN); }