3093{
3095 double za = 0.0, zb = 0.0;
3097 uint32_t i;
3099 double length = 0.0;
3100 double seglength = 0.0;
3101
3102
3103 if ( ! pa || pa->
npoints < 2 )
3104 return 0.0;
3105
3106
3108
3109
3112 if ( hasz )
3114
3115
3116 for ( i = 1; i < pa->
npoints; i++ )
3117 {
3118 seglength = 0.0;
3121 if ( hasz )
3123
3124
3127
3128 else
3130
3131
3132 if ( hasz )
3133 seglength = sqrt( (zb-za)*(zb-za) + seglength*seglength );
3134
3135
3136 length += seglength;
3137
3138
3139 a = b;
3140 za = zb;
3141 }
3142 return length;
3143}
#define FLAGS_GET_Z(flags)
int getPoint4d_p(const POINTARRAY *pa, uint32_t n, POINT4D *point)
void geographic_point_init(double lon, double lat, GEOGRAPHIC_POINT *g)
Initialize a geographic point.
double sphere_distance(const GEOGRAPHIC_POINT *s, const GEOGRAPHIC_POINT *e)
Given two points on a unit sphere, calculate their distance apart in radians.
double spheroid_distance(const GEOGRAPHIC_POINT *a, const GEOGRAPHIC_POINT *b, const SPHEROID *spheroid)
Computes the shortest distance along the surface of the spheroid between two points,...
Point in spherical coordinates on the world.