Statistiques
| Révision :

root / bin / compute_wall_vertices.cpp @ 1

Historique | Voir | Annoter | Télécharger (880 octet)

1
#include "compute_wall_vertices.h"
2
#include <stdio.h>
3

    
4
/* this function finds the 2 vertices of each wall */
5

    
6
void compute_wall_vertices(int *cells_vertices, int *vertices_number_in_each_cell, int cell_number, int *wall_vertices){
7

    
8
int i,j,k,m,n,previous; m=0;
9

    
10
for (i=0;i<cell_number;i++){ previous=vertices_number_in_each_cell[i+1]-1;
11
    for (j=vertices_number_in_each_cell[i];j<vertices_number_in_each_cell[i+1];j++){
12
        n=0;
13
        for (k=0;k<m;k++){
14
            if ((wall_vertices[2*k]==cells_vertices[previous] && wall_vertices[2*k+1]==cells_vertices[j]) || (wall_vertices[2*k]==cells_vertices[j] && wall_vertices[2*k+1]==cells_vertices[previous])){
15
                n=1;
16
            }
17
        }
18
        if (n==0){
19
            wall_vertices[2*m]=cells_vertices[previous]; wall_vertices[2*m+1]=cells_vertices[j]; m++;
20
        }
21
    previous=j;
22
    }
23
}
24

    
25
}