@@ -131,21 +131,17 @@ delaunay_impl(npy_intp npoints, const double* x, const double* y,
131131{
132132 qhT qh_qh; /* qh variable type and name must be like */
133133 qhT* qh = &qh_qh; /* this for Qhull macros to work correctly. */
134- std::vector<coordT> points;
135134 facetT* facet;
136135 int i, ntri, max_facet_id;
137- FILE* error_file = NULL ; /* qhull expects a FILE* to write errors to. */
138136 int exitcode; /* Value returned from qh_new_qhull(). */
139- std::vector<int > tri_indices; /* Maps qhull facet id to triangle index. */
140- int indices[3 ];
141137 const int ndim = 2 ;
142138 double x_mean = 0.0 ;
143139 double y_mean = 0.0 ;
144140
145141 QHULL_LIB_CHECK
146142
147143 /* Allocate points. */
148- points. resize (npoints * ndim);
144+ std::vector<coordT> points (npoints * ndim);
149145
150146 /* Determine mean x, y coordinates. */
151147 for (i = 0 ; i < npoints; ++i) {
@@ -162,6 +158,7 @@ delaunay_impl(npy_intp npoints, const double* x, const double* y,
162158 }
163159
164160 /* qhull expects a FILE* to write errors to. */
161+ FILE* error_file = NULL ;
165162 if (hide_qhull_errors) {
166163 /* qhull errors are ignored by writing to OS-equivalent of /dev/null.
167164 * Rather than have OS-specific code here, instead it is determined by
@@ -204,7 +201,7 @@ delaunay_impl(npy_intp npoints, const double* x, const double* y,
204201 max_facet_id = qh->facet_id - 1 ;
205202
206203 /* Create array to map facet id to triangle index. */
207- tri_indices. resize (max_facet_id+1 );
204+ std::vector< int > tri_indices (max_facet_id+1 );
208205
209206 /* Allocate Python arrays to return. */
210207 npy_intp dims[2 ] = {ntri, 3 };
@@ -218,6 +215,7 @@ delaunay_impl(npy_intp npoints, const double* x, const double* y,
218215 i = 0 ;
219216 FORALLfacets {
220217 if (!facet->upperdelaunay ) {
218+ int indices[3 ];
221219 tri_indices[facet->id ] = i++;
222220 get_facet_vertices (qh, facet, indices);
223221 *triangles_ptr++ = (facet->toporient ? indices[0 ] : indices[2 ]);
@@ -232,6 +230,7 @@ delaunay_impl(npy_intp npoints, const double* x, const double* y,
232230 /* Determine neighbors array. */
233231 FORALLfacets {
234232 if (!facet->upperdelaunay ) {
233+ int indices[3 ];
235234 get_facet_neighbours (facet, tri_indices, indices);
236235 *neighbors_ptr++ = (facet->toporient ? indices[2 ] : indices[0 ]);
237236 *neighbors_ptr++ = (facet->toporient ? indices[0 ] : indices[2 ]);
0 commit comments