Am I doing this correctly?
I want to create a vessel in a known (lat, lon, h) location.
I want it to look Down on the moon surface
I've developed the rotation matrix by extracting the directions of north-east-up according to Orbiter's left handed system
X = East
Y = Up
Z = North
hence ENU
It's consistent with rotating and swapping Y <-> Z by transforming the rotation matrix as given in
http://what-when-how.com/the-3-d-gl...derivation-the-3-d-global-spatial-data-model/
In the SDK, createvessel uses arot
Did I understand conrrectly, that arot are the yaw/pitch/roll of the matrix
ENU -> ECLIPTIC ? (where ENU is the local frame of the vessel)
and is this calculation correct?
* Eventually, my code for computing these angles would be:
I want to create a vessel in a known (lat, lon, h) location.
I want it to look Down on the moon surface
I've developed the rotation matrix by extracting the directions of north-east-up according to Orbiter's left handed system
X = East
Y = Up
Z = North
hence ENU
It's consistent with rotating and swapping Y <-> Z by transforming the rotation matrix as given in
http://what-when-how.com/the-3-d-gl...derivation-the-3-d-global-spatial-data-model/
In the SDK, createvessel uses arot
Did I understand conrrectly, that arot are the yaw/pitch/roll of the matrix
ENU -> ECLIPTIC ? (where ENU is the local frame of the vessel)
and is this calculation correct?
* Eventually, my code for computing these angles would be:
Code:
void Global2Local(VECTOR3& ypr, double lat, double lon)
{
/*
Y(ecliptic)
| Up (y)
| North (z) /
| \ /
| \/_ >----------------> \/_____ East (x)
| / .
| r / .
| / .
| / .
| / .
| /\ .
|/t |________________________ Z(ecliptic)
/p\ / .
/__/\ .
/ \ .
/ \ .
/ \ .
/ \ .
/ \ .
/ \.
X(ecliptic)
*/
MATRIX3 ENU2ECLIPTIC = _M(
-sin(lon), cos(lon)*cos(lat), -cos(lon)*sin(lat),
0, sin(lat), cos(lat),
cos(lon), sin(lon)*cos(lat), -sin(lon)*sin(lat));
ypr.x = atan(ENU2ECLIPTIC.m23/ENU2ECLIPTIC.m33);
ypr.y = -asin(ENU2ECLIPTIC.m13);
ypr.z = atan(ENU2ECLIPTIC.m12/ENU2ECLIPTIC.m11);
}
Last edited: