docs: public static double crossTrackDistanceRad(double lat1, double lon1, double lat2, double lon2, double latQ, double lonQ, double dist1Q) {
      final double dlon12 = lon2 - lon1;
      final double dlon1Q = lonQ - lon1;
  
      // Compute trigonometric functions only once.
      final DoubleWrapper tmp = new DoubleWrapper(); // To return cosine
      final double slat1 = sinAndCos(lat1, tmp), clat1 = tmp.value;
      final double slatQ = sinAndCos(latQ, tmp), clatQ = tmp.value;
      final double slat2 = sinAndCos(lat2, tmp), clat2 = tmp.value;
  
      // / Compute the course
      // y = sin(dlon) * cos(lat2)
      final double sdlon12 = sinAndCos(dlon12, tmp), cdlon12 = tmp.value;
      final double sdlon1Q = sinAndCos(dlon1Q, tmp), cdlon1Q = tmp.value;
      final double yE = sdlon12 * clat2;
      final double yQ = sdlon1Q * clatQ;
  
      // x = cos(lat1) * sin(lat2) - sin(lat1) * cos(lat2) * cos(dlon)
      final double xE = clat1 * slat2 - slat1 * clat2 * cdlon12;
      final double xQ = clat1 * slatQ - slat1 * clatQ * cdlon1Q;
  
      final double crs12 = atan2(yE, xE);
      final double crs1Q = atan2(yQ, xQ);
  
      // / Calculate cross-track distance
      return asin(sin(dist1Q) * sin(crs1Q - crs12));
    }