[SIZE=2][COLOR=#0000ff]
[SIZE=2][COLOR=#0000ff]double[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] time = J2000 - 40.0*365.25;[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]double[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] dt = 36.525;[/SIZE]
[SIZE=2]FILE *file = fopen([/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"Data.txt"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2],[/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"w"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]for[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] ([/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] i=0;i<1000;i++) {[/SIZE]
[SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]/*[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]double opPrcLan = 3.0474;[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]double opPrcObl = 0.00037707; [/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]double opLanOff = 5.39624;[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]double opLanPer = -6792.06 * 86400.0;[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]double opRotOff = 4.79151;[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]double opRotPer = 2.36059e+006;[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]double opObliqu = 0.0269272;[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]*/[/COLOR][/SIZE]
[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]double[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] opPrcLan = 0.0;[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]double[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] opPrcObl = 0.0; [/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]double[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] opLanOff = 2.181328;[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]double[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] opLanPer = -6792.9076 * 86400.0;[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]double[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] opRotOff = 4.770748;[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]double[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] opRotPer = 2360591.597;[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]double[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] opObliqu = 0.02694055;[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]double[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] t = (time - J2000) * 86400.0;[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]double[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] ln = limit(opLanOff + PI2 * t / opLanPer); [/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]double[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] rt = limit(opRotOff + PI2 * t / opRotPer + opLanOff - ln);[/SIZE]
[SIZE=2]MATRIX3 Mat = mul(_MRz(rt), _MRx(-opObliqu));[/SIZE]
[SIZE=2]Mat = mul(Mat, _MRz(ln));[/SIZE]
[SIZE=2]Mat = mul(Mat, _MRx(-opPrcObl));[/SIZE]
[SIZE=2]Mat = mul(Mat, _MRz(opPrcLan));[/SIZE]
[SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]// Planet Meridian Axis[/COLOR][/SIZE]
[/COLOR][/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]//[/COLOR][/SIZE]
[/COLOR][/SIZE][SIZE=2]VECTOR3 _Prime = tmul(Mat, _V(1,0,0));[/SIZE]
[SIZE=2]VECTOR3 _K, _I, _J; [/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]double[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] lan, obl, rot;[/SIZE]
[SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]// Call IAU Lunar Model[/COLOR][/SIZE]
[/COLOR][/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]//[/COLOR][/SIZE]
[/COLOR][/SIZE][SIZE=2]Moon(time, &lan, &obl, &rot, &_K, &_I); [/SIZE]
[SIZE=2]sprintf_s(txt,256,[/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"%1.8f %1.8f"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2],DEG*asin(dotp(_Prime, crossp(_K, _I))), DEG*asin(dotp(_Prime,_K)));[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]for[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] ([/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] i=0;i<256;i++) [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] (txt[i]==[/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]'.'[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]) txt[i]=[/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]','[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];[/SIZE]
[SIZE=2]fprintf(file,[/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"%s\n"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2],txt);[/SIZE]
[SIZE=2]time += dt;[/SIZE]
[SIZE=2]} [/SIZE]
[SIZE=2]fclose(file);[/SIZE]