Statistics
| Revision:

root / src / compute_lengths.cpp

History | View | Annotate | Download (649 Bytes)

1 1 akiss
#include <math.h>
2 1 akiss
#include "constants.h"
3 1 akiss
#include "compute_lengths.h"
4 1 akiss
#include <stdio.h>
5 1 akiss
6 1 akiss
/* this functions computes the lengths of each wall */
7 1 akiss
8 1 akiss
void compute_lengths(double *vertices, int *edges_vertices, int edge_number, double *lengths, int *periodizer, double width, double height){
9 1 akiss
10 1 akiss
for (int i=0;i<edge_number;i++){
11 1 akiss
    lengths[i]=sqrt(pow(vertices[2*edges_vertices[2*i]]+width*(double)periodizer[4*i]-vertices[2*edges_vertices[2*i+1]]-width*(double)periodizer[4*i+2],2.)+
12 1 akiss
                    pow(vertices[2*edges_vertices[2*i]+1]+height*(double)periodizer[4*i+1]-vertices[2*edges_vertices[2*i+1]+1]-height*(double)periodizer[4*i+3],2.));
13 1 akiss
}
14 1 akiss
15 1 akiss
}