@@ -276,18 +276,22 @@ cdef dist_array_size(
276
276
DTYPE_ui i_start,
277
277
DTYPE_ui nb_c_per_l,
278
278
DTYPE_ui * nb_pt_per_c,
279
- DTYPE_ui * c_i
279
+ DTYPE_ui * c_i,
280
+ # return param
281
+ DTYPE_ui * i_end,
282
+ DTYPE_ui * c_start,
283
+ DTYPE_ui * c_end
280
284
):
281
285
""" Give slice to select data
282
286
"""
283
- cdef DTYPE_ui i_elt, i_end, nb_pts
284
- i_end = i_start + nb_c_per_l
287
+ cdef DTYPE_ui i_elt, nb_pts
288
+ i_end[ 0 ] = i_start + nb_c_per_l
285
289
nb_pts = 0
286
290
287
- for i_elt from i_start <= i_elt < i_end:
288
- nb_pts += nb_pt_per_c[i_elt ]
289
- i_contour = c_i[i_start]
290
- return i_start, i_end, i_contour, i_contour + nb_pts
291
+ c_start[ 0 ] = c_i[i_start]
292
+ c_end[ 0 ] = c_start[ 0 ]
293
+ for i_elt from i_start <= i_elt < i_end[ 0 ]:
294
+ c_end[ 0 ] += nb_pt_per_c[i_elt]
291
295
292
296
293
297
@ wraparound (False )
@@ -314,20 +318,25 @@ def index_from_nearest_path(
314
318
if nb_contour == 0 :
315
319
return None
316
320
317
- main_start, main_stop, start, end = dist_array_size(
318
- l_i[level_index],
321
+ main_start = l_i[level_index]
322
+ dist_array_size(
323
+ main_start,
319
324
nb_contour,
320
325
& nb_pt_per_c[0 ],
321
326
& indices_of_first_pts[0 ],
327
+ & main_stop,
328
+ & start,
329
+ & end
322
330
)
323
331
324
- nearesti = nearest_contour_index(
332
+ nearest_contour_index(
325
333
& x_value[0 ],
326
334
& y_value[0 ],
327
335
xpt,
328
336
ypt,
329
337
start,
330
338
end,
339
+ & nearesti
331
340
)
332
341
333
342
for i_elt from main_start <= i_elt < main_stop:
@@ -346,6 +355,8 @@ cdef nearest_contour_index(
346
355
DTYPE_coord ypt,
347
356
DTYPE_ui start,
348
357
DTYPE_ui end,
358
+ # return param
359
+ DTYPE_ui * nearesti
349
360
):
350
361
""" Give index fron the nearest pts
351
362
"""
@@ -358,4 +369,4 @@ cdef nearest_contour_index(
358
369
if dist < dist_ref:
359
370
dist_ref = dist
360
371
i_ref = i_elt
361
- return i_ref - start
372
+ nearesti[ 0 ] = i_ref - start
0 commit comments