question: public void moveAlong ( ) { if ( DEBUG ) { Debug . output ( "PilotPath.moveAlong(): segment " + ( pathIndex / 2 ) + " of " + ( pathPoints . length / 2 ) ) ; } double [ ] latlons = getSegmentCoordinates ( pathIndex ) ; double segLength = GreatCircle . sphericalDistance ( latlons [ 0 ] , latlons [ 1 ] , latlons [ 2 ] , latlons [ 3 ] ) ; if ( DEBUG ) { Debug . output ( "PilotPath.moveAlong(): segment Length " + segLength + ", and already have " + currentSegDist + " of it." ) ; } double needToTravel = rate ; int originalPathIndex = pathIndex ; int loopingTimes = 0 ; while ( needToTravel >= segLength - currentSegDist ) { needToTravel -= ( segLength - currentSegDist ) ; currentSegDist = 0f ; pathIndex += 2 ; if ( DEBUG ) { Debug . output ( "PilotPath to next segment(" + ( pathIndex / 2 ) + "), need to travel " + needToTravel ) ; } latlons = getSegmentCoordinates ( pathIndex ) ; if ( pathIndex == originalPathIndex ) { loopingTimes ++ ; if ( loopingTimes > 1 ) { if ( DEBUG ) Debug . output ( "PilotPath looping on itself, setting to stationary" ) ; setStationary ( true ) ; return ; } } segLength = GreatCircle . sphericalDistance ( latlons [ 0 ] , latlons [ 1 ] , latlons [ 2 ] , latlons [ 3 ] ) ; } if ( DEBUG ) { Debug . output ( "Moving PilotPath within current(" + ( pathIndex / 2 ) + ") segment, segLength: " + segLength + ", ntt: " + needToTravel ) ; } double azimuth = GreatCircle . sphericalAzimuth ( latlons [ 0 ] , latlons [ 1 ] , latlons [ 2 ] , latlons [ 3 ] ) ; Point2D newPoint = GreatCircle . sphericalBetween ( latlons [ 0 ] , latlons [ 1 ] , currentSegDist + needToTravel , azimuth ) ; setLat ( newPoint . getY ( ) ) ; setLon ( newPoint . getX ( ) ) ; currentSegDist = GreatCircle . sphericalDistance ( latlons [ 0 ] , latlons [ 1 ] , Math . toRadians ( newPoint . getY ( ) ) , Math . toRadians ( newPoint . getX ( ) ) ) ; if ( DEBUG ) Debug . output ( "moveAlong: azimuth = " + azimuth ) ; if ( viewProjection == null ) { return ; } Point2D newLoc = viewProjection . forward ( newPoint ) ; if ( DEBUG ) Debug . output ( newLoc . toString ( ) + ", compared with lastX, lastY: " + lastX + ", " + lastY + ", scaleFactor= " + scaleFactor ) ; double centerXOffset = newLoc . getX ( ) * scaleFactor ; double centerYOffset = newLoc . getY ( ) * scaleFactor ; Vector3d translate = new Vector3d ( ) ; translate . set ( centerXOffset - lastX , 0 , centerYOffset - lastY ) ; lastX = centerXOffset ; lastY = centerYOffset ; if ( DEBUG ) Debug . output ( "PP moving: " + translate ) ; if ( platformBehavior != null ) { platformBehavior . doMove ( translate ) ; if ( lastAzimuth != azimuth ) { platformBehavior . doLookY ( lastAzimuth - azimuth ) ; lastAzimuth = azimuth ; } } }
target:  Figures out the next position of the pilot, given the distance the pilot should move for this turn.