[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]#define[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] _I_ECL _V(1, 0, 0) [/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]#define[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] _K_ECL _V(0, 0, 1) [/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]#define[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] _J_ECL _V(0, 1, 0) [/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]#define[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] lnEpoch 40038.000000[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]#define[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] lnRad 1738090.0[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]#define[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] lnRotOff 5.755387533590 [/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]#define[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] lnRotPer 2351139.374 // node to node rotation period[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]#define[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] lnLanOff 0.250691117180 [/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]#define[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] lnLanPer -586955667.0[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]#define[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] lnObliquity 0.0267907[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]double[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] t = (oapiGetSimMJD() - lnEpoch) * 86400.0;[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]double[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] rt = limit(lnRotOff + PI2 * t / lnRotPer);[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]double[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] ob = lnObliquity;[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]double[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] ln = limit(lnLanOff + PI2 * t / lnLanPer); [/SIZE]
[SIZE=2]VECTOR3 _R; [/SIZE]
[SIZE=2]hVessel->GetRelativePos(hMoon, _R); [/SIZE]
[SIZE=2]_R = _V(_R.x, _R.z, _R.y);[/SIZE]
[SIZE=2]VECTOR3 _i = _I_ECL*cos(ln) + _J_ECL*sin(ln);[/SIZE]
[SIZE=2]VECTOR3 _j = unit(crossp(_K_ECL, _i));[/SIZE]
[SIZE=2]VECTOR3 _K = _K_ECL*cos(ob) + _j*sin(ob);[/SIZE]
[SIZE=2]VECTOR3 _I = _i*cos(rt) + unit(crossp(_K, _i))*sin(rt);[/SIZE]
[SIZE=2]VECTOR3 _J = unit(crossp(_K, _I));[/SIZE]
[SIZE=2]_R = _V( dotp(_R,_I), dotp(_R,_J), dotp(_R,_K));[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]double[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] lat = atan( _R.z / sqrt(_R.x*_R.x + _R.y*_R.y) );[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]double[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] lng = atan2( _R.y, _R.x );[/SIZE]
[SIZE=2]TextA(5,pos,[/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"Lat "[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2],DEG*lat,6); pos+=ld;[/SIZE]
[SIZE=2]TextA(5,pos,[/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"Lng "[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2],DEG*lng,6); pos+=ld;[/SIZE]