Commit 762835ae781f665f05381b8b3f85643ba3ded9db

Authored by Thiago Franco de Moraes
1 parent bb368c35
Exists in casmoothing_cython

Compiling in Windows

Showing 2 changed files with 12 additions and 5 deletions   Show diff stats
@@ -24,3 +24,9 @@ tags @@ -24,3 +24,9 @@ tags
24 build 24 build
25 *.patch 25 *.patch
26 *.tgz 26 *.tgz
  27 +
  28 +*.pyd
  29 +*.cpp
  30 +*.diff
  31 +
  32 +*.directory
invesalius/data/cy_mesh.pyx
@@ -410,22 +410,23 @@ cdef void taubin_smooth(Mesh mesh, vector[weight_t]& weights, float l, float m, @@ -410,22 +410,23 @@ cdef void taubin_smooth(Mesh mesh, vector[weight_t]& weights, float l, float m,
410 Signal Processing Approach To Fair Surface Design". His benefeat is it 410 Signal Processing Approach To Fair Surface Design". His benefeat is it
411 avoids surface shrinking. 411 avoids surface shrinking.
412 """ 412 """
  413 + cdef int s, i, nvertices
  414 + nvertices = mesh.vertices.shape[0]
413 cdef vector[Point] D = vector[Point](mesh.vertices.shape[0]) 415 cdef vector[Point] D = vector[Point](mesh.vertices.shape[0])
414 cdef vertex_t* vi 416 cdef vertex_t* vi
415 - cdef int s, i  
416 for s in xrange(steps): 417 for s in xrange(steps):
417 - for i in prange(D.size(), nogil=True): 418 + for i in prange(nvertices, nogil=True):
418 D[i] = calc_d(mesh, i) 419 D[i] = calc_d(mesh, i)
419 420
420 - for i in prange(D.size(), nogil=True): 421 + for i in prange(nvertices, nogil=True):
421 mesh.vertices[i, 0] += weights[i]*l*D[i].x; 422 mesh.vertices[i, 0] += weights[i]*l*D[i].x;
422 mesh.vertices[i, 1] += weights[i]*l*D[i].y; 423 mesh.vertices[i, 1] += weights[i]*l*D[i].y;
423 mesh.vertices[i, 2] += weights[i]*l*D[i].z; 424 mesh.vertices[i, 2] += weights[i]*l*D[i].z;
424 425
425 - for i in prange(D.size(), nogil=True): 426 + for i in prange(nvertices, nogil=True):
426 D[i] = calc_d(mesh, i) 427 D[i] = calc_d(mesh, i)
427 428
428 - for i in prange(D.size(), nogil=True): 429 + for i in prange(nvertices, nogil=True):
429 mesh.vertices[i, 0] += weights[i]*m*D[i].x; 430 mesh.vertices[i, 0] += weights[i]*m*D[i].x;
430 mesh.vertices[i, 1] += weights[i]*m*D[i].y; 431 mesh.vertices[i, 1] += weights[i]*m*D[i].y;
431 mesh.vertices[i, 2] += weights[i]*m*D[i].z; 432 mesh.vertices[i, 2] += weights[i]*m*D[i].z;