22 static double min4(
double,
double,
double,
double);
23 static double min2(
double,
double);
54 if (
st->factor <= 0.0) {
75 double G_distance(
double e1,
double n1,
double e2,
double n2)
80 return st->factor * hypot(e1 - e2, n1 - n2);
92 double ay2,
double bx1,
double by1,
93 double bx2,
double by2)
118 double y1,
double x2,
double y2)
122 double xq, yq, ra, rb;
129 if (dx == 0.0 && dy == 0.0)
132 if (fabs(dy) > fabs(dx)) {
134 yq = (dx / dy) * (xp - xq) + yp;
138 xq = (dy / dx) * (yp - yq) + xp;
142 t =
G_intersect_line_segments(xp, yp, xq, yq, x1, y1, x2, y2, &ra, &rb, &
x,
151 "code=%d P=(%f,%f) S=(%f,%f)(%f,%f)"),
152 "G_distance_point_to_line_segment",
t, xp, yp, x1, y1, x2,
158 if (rb >= 0 && rb <= 1.0)
167 static double min4(
double a,
double b,
double c,
double d)
169 return min2(min2(a,
b), min2(c, d));
172 static double min2(
double a,
double b)
174 return a <
b ? a :
b;
void G_begin_geodesic_distance(double, double)
Begin geodesic distance.
void G_warning(const char *,...) __attribute__((format(printf
int G_get_ellipsoid_parameters(double *, double *)
get ellipsoid parameters
double G_database_units_to_meters_factor(void)
Conversion to meters.
double G_geodesic_distance(double, double, double, double)
Calculates geodesic distance.
int G_intersect_line_segments(double, double, double, double, double, double, double, double, double *, double *, double *, double *)
int G_projection(void)
Query cartographic projection.
double G_distance_point_to_line_segment(double xp, double yp, double x1, double y1, double x2, double y2)
Returns distance between a point and line segment in meters.
int G_begin_distance_calculations(void)
Begin distance calculations.
double G_distance_between_line_segments(double ax1, double ay1, double ax2, double ay2, double bx1, double by1, double bx2, double by2)
Returns distance between two line segments in meters.
double G_distance(double e1, double n1, double e2, double n2)
Returns distance in meters.
#define PROJECTION_LL
Projection code - Latitude-Longitude.