Statistics
| Revision:

root / src / compute_lengths.cpp

History | View | Annotate | Download (649 Bytes)

1
#include <math.h>
2
#include "constants.h"
3
#include "compute_lengths.h"
4
#include <stdio.h>
5

    
6
/* this functions computes the lengths of each wall */
7

    
8
void compute_lengths(double *vertices, int *edges_vertices, int edge_number, double *lengths, int *periodizer, double width, double height){
9

    
10
for (int i=0;i<edge_number;i++){
11
    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
                    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
}
14

    
15
}