<s> import numpy <EOL> LOCATION_SCALING_FACTOR = <NUM_LIT> ; <EOL> def scale_longitude ( llh ) : <EOL> return numpy . cos ( llh [ <NUM_LIT:0> ] * numpy . pi / <NUM_LIT> ) <EOL> def llh2ned ( llh , llh_ref ) : <EOL> diffs = numpy . subtract ( llh , llh_ref ) <EOL> diffs [ <NUM_LIT:0> ] = diffs [ <NUM_LIT:0> ] * LOCATION_SCALING_FACTOR <EOL> diffs [ <NUM_LIT:1> ] = diffs [ <NUM_LIT:1> ] * LOCATION_SCALING_FACTOR * scale_longitude ( llh_ref ) <EOL> return diffs <EOL> def ned2llh ( ned , llh_ref ) : <EOL> lat = llh_ref [ <NUM_LIT:0> ] + ( ned [ <NUM_LIT:0> ] / LOCATION_SCALING_FACTOR ) <EOL> lng = llh_ref [ <NUM_LIT:1> ] + ( ned [ <NUM_LIT:1> ] / ( LOCATION_SCALING_FACTOR * scale_longitude ( llh_ref ) ) ) <EOL> alt = llh_ref [ <NUM_LIT:2> ] - ned [ <NUM_LIT:2> ] <EOL> return numpy . array ( [ lat , lng , alt ] ) <EOL> def get_distance_llh ( llh1 , llh2 ) : <EOL> return numpy . linalg . norm ( llh2ned ( llh1 , llh2 ) ) </s>
