/*======== struct matrix * make_rotZ() ========== Inputs: double theta Returns: The rotation matrix created using theta as the angle of rotation and Z as the axis of rotation. ====================*/ struct matrix * make_rotZ(double theta) { struct matrix *transform = new_matrix(4, 4); ident(transform); transform->m[0][0] = cos(convertToRadians(theta)); transform->m[0][1] = -1 * sin(convertToRadians(theta)); transform->m[1][1] = cos(convertToRadians(theta)); transform->m[1][0] = sin(convertToRadians(theta)); return transform; }
double LocationWatcher::cut(double lat1,double lon1,double lat2,double lon2){ const double RADIO = 6371; // Mean radius of Earth in Km double dlon = convertToRadians(lon1 - lon2); double dlat = convertToRadians(lat1 - lat2); double a = ( pow(sin(dlat / 2), 2) + cos(convertToRadians(lat1))) * cos(convertToRadians(lat2)) * pow(sin(dlon / 2), 2); double angle = 2 * asin(sqrt(a)); double distance=angle * RADIO; distance=distance*1000; return distance; }