function
Geodesy.projectRouteToLocalEnu
Project a lat/lon/alt route into the origin's East-North-Up frame
Public declarations
Explicit source declarations; dimensions, modifications and defaults are shown as written, without evaluation.
| Role | Name | Type | Dimensions / attributes / default | Description |
|---|---|---|---|---|
| input | origin | GeodeticOrigin | | Local frame reference point |
| input | globalWaypoints | Real | [:, 3] | Route rows are [latitude_deg, longitude_deg, altitude_m] |
| input | earth_radius_m | Real | = 6378137.0 | Spherical Earth radius [m] |
| output | localWaypoints | Real | [size(globalWaypoints, 1), 3] | Route rows are [east_m, north_m, up_m] |
Modelica declarations and implementation
Show parameters, interfaces and source
Parameters, inputs, outputs, defaults and equations from the source file.
function projectRouteToLocalEnu
"Project a lat/lon/alt route into the origin's East-North-Up frame"
input GeodeticOrigin origin "Local frame reference point";
input Real globalWaypoints[:, 3]
"Route rows are [latitude_deg, longitude_deg, altitude_m]";
input Real earth_radius_m = 6378137.0 "Spherical Earth radius [m]";
output Real localWaypoints[size(globalWaypoints, 1), 3]
"Route rows are [east_m, north_m, up_m]";
protected
Real localWaypoint[3];
algorithm
// Keep one waypoint cohesive: compute the vector once, then write one row.
for row in 1:size(globalWaypoints, 1) loop
localWaypoint := geodeticToLocalEnu(
origin,
globalWaypoints[row, 1],
globalWaypoints[row, 2],
globalWaypoints[row, 3],
earth_radius_m);
localWaypoints[row, :] := localWaypoint;
end for;
end projectRouteToLocalEnu;