-
Notifications
You must be signed in to change notification settings - Fork 23
/
CalcDistance.c
executable file
·34 lines (31 loc) · 980 Bytes
/
CalcDistance.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
* SUMMARY: CalcDistance.c - Calculate the distance between two points
* USAGE: Part of DHSVM
*
* AUTHOR: Bart Nijssen
* ORG: University of Washington, Department of Civil Engineering
* E-MAIL: [email protected]
* ORIG-DATE: Apr-96
* DESCRIPTION: Calculates a simple "pythagorean" distance between two
* locations
* DESCRIP-END.
* FUNCTIONS: CalcDistance()
* COMMENTS:
* $Id: CalcDistance.c,v 1.4 2003/07/01 21:26:09 olivier Exp $
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "settings.h"
#include "data.h"
#include "functions.h"
double CalcDistance(COORD * LocA, COORD * LocB)
{
double Distance;
double dN = (double) (LocA->N - LocB->N);
double dE = (double) (LocA->E - LocB->E);
Distance = sqrt(dN * dN + dE * dE);
/* Distance = sqrt(pow((double)(LocA.N-LocB.N), (double) 2.0) + */
/* pow((double)(LocA.E-LocB.E), (double) 2.0)); */
return Distance;
}