distance.c File Reference

#include <math.h>
#include <grass/gis.h>

Include dependency graph for distance.c:

Go to the source code of this file.

Functions

int G_begin_distance_calculations ()
 begin distance calculations
double G_distance (double e1, double n1, double e2, double n2)
 distance in meters
double G_distance_between_line_segments (double ax1, double ay1, double ax2, double ay2, double bx1, double by1, double bx2, double by2)
double G_distance_point_to_line_segment (double xp, double yp, double x1, double y1, double x2, double y2)


Function Documentation

int G_begin_distance_calculations (  ) 

begin distance calculations

Initializes the distance calculations. It is used both for the planimetric and latitude-longitude projections. It returns 2 if the projection is latitude-longitude, 1 if the projection is planimetric, and 0 if the projection doesn't hav e a metric (e.g. imagery.)

Parameters:
void 
Returns:
int

Definition at line 28 of file distance.c.

References G_begin_geodesic_distance(), G_database_units_to_meters_factor(), G_get_ellipsoid_parameters(), and G_projection().

double G_distance ( double  e1,
double  n1,
double  e2,
double  n2 
)

distance in meters

This routine computes the distance, in meters, from x1,y1 to x2,y2. If the projection is latitude-longitude, this distance is measured along the geodesic. Two routines perform geodesic distance calculations.

Parameters:
x1 
y1 
x2 
y2 
Returns:
double

Definition at line 66 of file distance.c.

References G_geodesic_distance().

Referenced by G_distance_point_to_line_segment().

double G_distance_between_line_segments ( double  ax1,
double  ay1,
double  ax2,
double  ay2,
double  bx1,
double  by1,
double  bx2,
double  by2 
)

Definition at line 77 of file distance.c.

References G_distance_point_to_line_segment(), and G_intersect_line_segments().

double G_distance_point_to_line_segment ( double  xp,
double  yp,
double  x1,
double  y1,
double  x2,
double  y2 
)

Definition at line 100 of file distance.c.

References G_distance(), and G_intersect_line_segments().

Referenced by G_distance_between_line_segments().


Generated on Sun Apr 6 17:32:18 2008 for GRASS by  doxygen 1.5.5