private double computeSegmentLength(Path path, DrawContext dc, Position posA, Position posB) {
final LatLon llA = new LatLon(posA.getLatitude(), posA.getLongitude());
final LatLon llB = new LatLon(posB.getLatitude(), posB.getLongitude());
Angle ang;
String pathType = path.getPathType();
if (Objects.equals(pathType, AVKey.LINEAR)) {
ang = LatLon.linearDistance(llA, llB);
} else if (Objects.equals(pathType, AVKey.RHUMB_LINE) || Objects.equals(pathType, AVKey.LOXODROME)) {
ang = LatLon.rhumbDistance(llA, llB);
} else {
ang = LatLon.greatCircleDistance(llA, llB);
}
if (path.getAltitudeMode() == WorldWind.CLAMP_TO_GROUND) {
return ang.radians * (dc.getGlobe().getRadius());
}
final double height = 0.5 * (posA.getElevation() + posB.getElevation());
return ang.radians * (dc.getGlobe().getRadius() + height * dc.getVerticalExaggeration());
}