@@ -131,21 +131,17 @@ delaunay_impl(npy_intp npoints, const double* x, const double* y,
131
131
{
132
132
qhT qh_qh; /* qh variable type and name must be like */
133
133
qhT* qh = &qh_qh; /* this for Qhull macros to work correctly. */
134
- std::vector<coordT> points;
135
134
facetT* facet;
136
135
int i, ntri, max_facet_id;
137
- FILE* error_file = NULL ; /* qhull expects a FILE* to write errors to. */
138
136
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 ];
141
137
const int ndim = 2 ;
142
138
double x_mean = 0.0 ;
143
139
double y_mean = 0.0 ;
144
140
145
141
QHULL_LIB_CHECK
146
142
147
143
/* Allocate points. */
148
- points. resize (npoints * ndim);
144
+ std::vector<coordT> points (npoints * ndim);
149
145
150
146
/* Determine mean x, y coordinates. */
151
147
for (i = 0 ; i < npoints; ++i) {
@@ -162,6 +158,7 @@ delaunay_impl(npy_intp npoints, const double* x, const double* y,
162
158
}
163
159
164
160
/* qhull expects a FILE* to write errors to. */
161
+ FILE* error_file = NULL ;
165
162
if (hide_qhull_errors) {
166
163
/* qhull errors are ignored by writing to OS-equivalent of /dev/null.
167
164
* 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,
204
201
max_facet_id = qh->facet_id - 1 ;
205
202
206
203
/* 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 );
208
205
209
206
/* Allocate Python arrays to return. */
210
207
npy_intp dims[2 ] = {ntri, 3 };
@@ -218,6 +215,7 @@ delaunay_impl(npy_intp npoints, const double* x, const double* y,
218
215
i = 0 ;
219
216
FORALLfacets {
220
217
if (!facet->upperdelaunay ) {
218
+ int indices[3 ];
221
219
tri_indices[facet->id ] = i++;
222
220
get_facet_vertices (qh, facet, indices);
223
221
*triangles_ptr++ = (facet->toporient ? indices[0 ] : indices[2 ]);
@@ -232,6 +230,7 @@ delaunay_impl(npy_intp npoints, const double* x, const double* y,
232
230
/* Determine neighbors array. */
233
231
FORALLfacets {
234
232
if (!facet->upperdelaunay ) {
233
+ int indices[3 ];
235
234
get_facet_neighbours (facet, tri_indices, indices);
236
235
*neighbors_ptr++ = (facet->toporient ? indices[2 ] : indices[0 ]);
237
236
*neighbors_ptr++ = (facet->toporient ? indices[0 ] : indices[2 ]);
0 commit comments