X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/snake_gpu.git/blobdiff_plain/935bdd1c8b99ce5d70b6e4a53ca29f06353e8baa..4808809dab187a1799ac382ae24041d6243a97cc:/src/lib_kernel_snake_2_gpu.cu diff --git a/src/lib_kernel_snake_2_gpu.cu b/src/lib_kernel_snake_2_gpu.cu index 8d819a8..7b8c291 100644 --- a/src/lib_kernel_snake_2_gpu.cu +++ b/src/lib_kernel_snake_2_gpu.cu @@ -34,95 +34,6 @@ __global__ void genere_snake_rectangle_4nodes_gpu(snake_node_gpu * d_snake, int } -__global__ void genere_snake_rectangle_Nnodes_gpu(snake_node_gpu * d_snake, int dist_bords, int i_dim, int j_dim){ - int nb_node_seg = 9 ; - int limite = 64 ; - - int i , h= i_dim-2*dist_bords, l= j_dim-2*dist_bords ; - int inch = h/(nb_node_seg+1), incl= l/(nb_node_seg+1) ; - if (threadIdx.x == 0){ - int n = 0; - /* n0 */ - d_snake[n].posi = dist_bords ; - d_snake[n].posj = dist_bords ; - n++ ; - /*entre sommet 0 et 1*/ - i = 0 ; - while (i < nb_node_seg) - { - if ( (d_snake[n-1].posi + inch)-(i_dim - dist_bords) > limite ) - d_snake[n].posi = d_snake[n-1].posi + inch ; - else - d_snake[n].posi = d_snake[n-1].posi + inch/2 ; - d_snake[n].posj = dist_bords ; - d_snake[n-1].nb_pixels = d_snake[n].posi - d_snake[n-1].posi ; - n++ ; i++ ; - } - /* n1 */ - d_snake[n].posi = i_dim - dist_bords ; - d_snake[n].posj = dist_bords ; - d_snake[n-1].nb_pixels = d_snake[n].posi - d_snake[n-1].posi ; - n++ ; - /*entre S1 et S2*/ - i = 0 ; - while (i< nb_node_seg) - { - if ( (j_dim - dist_bords) - (d_snake[n-1].posj + incl) > limite ) - d_snake[n].posj = d_snake[n-1].posj + incl ; - else - d_snake[n].posj = d_snake[n-1].posj + incl/2 ; - d_snake[n].posi = i_dim - dist_bords ; - d_snake[n-1].nb_pixels = d_snake[n].posj - d_snake[n-1].posj ; - n++ ; i++ ; - } - /* n2 */ - d_snake[n].posi = i_dim - dist_bords ; - d_snake[n].posj = j_dim - dist_bords ; - d_snake[n-1].nb_pixels = d_snake[n].posj - d_snake[n-1].posj ; - n++ ; - /*entre S2 et S3*/ - i = 0 ; - while (i< nb_node_seg) - { - if ( (d_snake[n-1].posi - inch) - dist_bords > limite ) - d_snake[n].posi = d_snake[n-1].posi - inch ; - else - d_snake[n].posi = d_snake[n-1].posi - inch/2 ; - d_snake[n].posj = j_dim - dist_bords ; - d_snake[n-1].nb_pixels = d_snake[n-1].posi - d_snake[n].posi ; - n++ ; i++ ; - } - /* n3 */ - d_snake[n].posi = dist_bords ; - d_snake[n].posj = j_dim - dist_bords ; - d_snake[n-1].nb_pixels = d_snake[n-1].posi - d_snake[n].posi ; - n++ ; - /*entre S3 et S0*/ - i = 0 ; - while (i< nb_node_seg) - { - if ( (d_snake[n-1].posj - incl) - dist_bords > limite) - d_snake[n].posj = d_snake[n-1].posj - incl ; - else - d_snake[n].posj = d_snake[n-1].posj - incl/2 ; - d_snake[n].posi = dist_bords ; - d_snake[n-1].nb_pixels = d_snake[n-1].posj - d_snake[n].posj ; - n++ ; i++ ; - } - d_snake[n-1].nb_pixels = d_snake[n-1].posj - d_snake[0].posj ; - for (i=0; i