Statistiques
| Révision :

root / bin / find_boundary_walls.cpp @ 1

Historique | Voir | Annoter | Télécharger (1,31 ko)

1
#include "find_boundary_walls.h"
2
#include <stdio.h>
3
#include "constants.h"
4

    
5
/* this function finds the vertices which are on the boundary of the tissue */
6

    
7
void find_boundary_walls(int *cells_vertices, int *vertices_number_in_each_cell, int cell_number,
8
                         int *boundary, int *wall_number){
9

    
10
int i,j,k,l,previous,previous2; *wall_number=0;
11

    
12
for (i=0;i<vertices_number_in_each_cell[cell_number];i++){boundary[i]=1;}
13

    
14
for (i=0;i<cell_number-1;i++){ previous=vertices_number_in_each_cell[i+1]-1;
15
    for (j=vertices_number_in_each_cell[i];j<vertices_number_in_each_cell[i+1];j++){
16
        previous=j-1; if (j==vertices_number_in_each_cell[i]){previous=vertices_number_in_each_cell[i+1]-1;}
17
        for (k=i+1;k<cell_number;k++){
18
            for (l=vertices_number_in_each_cell[k];l<vertices_number_in_each_cell[k+1];l++){
19
                previous2=l-1; if (l==vertices_number_in_each_cell[k]){ previous2=vertices_number_in_each_cell[k+1]-1;}
20
                if (cells_vertices[j]==cells_vertices[previous2] && cells_vertices[previous]==cells_vertices[l]){
21
                    boundary[j]=0; boundary[l]=0; *wall_number+=1;
22
                }
23
            }
24
        }
25
    }
26
}
27

    
28
for (i=0;i<vertices_number_in_each_cell[cell_number];i++){
29
    if (boundary[i]==1){
30
        *wall_number+=1;
31
    }
32
}
33
//printf("%d\n",*wall_number);
34
}