### Get Planet Position (Python) Source: https://context7.com/gmiller123456/vsop87-multilang/llms.txt Calculates planetary positions using the Python implementation of the VSOP87 API. ```python import math from vsop87a_full import vsop87a_full def jd_to_t(jd): """Convert Julian Date to VSOP87 time parameter (Julian millennia from J2000.0)""" return (jd - 2451545.0) / 365250.0 # Calculate positions for January 1, 2000 t = jd_to_t(2451545.0) # Get Earth position earth = vsop87a_full.getEarth(t) print(f"Earth X: {earth[0]:.10f} AU") # -0.1771354586 AU print(f"Earth Y: {earth[1]:.10f} AU") # 0.9672416237 AU print(f"Earth Z: {earth[2]:.10f} AU") # -0.0000039000 AU # Get Jupiter position jupiter = vsop87a_full.getJupiter(t) print(f"Jupiter X: {jupiter[0]:.10f} AU") # 4.0011740268 AU print(f"Jupiter Y: {jupiter[1]:.10f} AU") # 2.9385810077 AU print(f"Jupiter Z: {jupiter[2]:.10f} AU") # -0.1017837501 AU ``` -------------------------------- ### Get Planet Position (C) Source: https://context7.com/gmiller123456/vsop87-multilang/llms.txt Uses a function-based API where position vectors are stored in provided output arrays. ```c #include #include "vsop87a_full.c" int main() { // Time parameter for January 1, 2000 (JD 2451545.0) double t = (2451545.0 - 2451545.0) / 365250.0; // Position arrays [x, y, z] in AU double earth[3], mars[3], moon[3], emb[3]; // Get Earth position vsop87a_full_getEarth(t, earth); printf("Earth: X=%.10f, Y=%.10f, Z=%.10f AU\n", earth[0], earth[1], earth[2]); // Get Mars position vsop87a_full_getMars(t, mars); printf("Mars: X=%.10f, Y=%.10f, Z=%.10f AU\n", mars[0], mars[1], mars[2]); // Get Moon position from Earth and EMB vsop87a_full_getEmb(t, emb); vsop87a_full_getMoon(earth, emb, moon); printf("Moon: X=%.10f, Y=%.10f, Z=%.10f AU\n", moon[0], moon[1], moon[2]); return 0; } ``` -------------------------------- ### Planetary Position Calculation Example Source: https://github.com/gmiller123456/vsop87-multilang/blob/master/Languages/BASIC/readme.md Demonstrates setting the planet index and Julian date to calculate and print Cartesian coordinates. ```BASIC 10 p=1 20 jd=2451545.0 30 t=(jd - 2451545.0) / 365250.0 40 gosub 1000 50 print "x="+str$(r(1)) 60 print "y="+str$(r(2)) 70 print "z="+str$(r(3)) 80 end ``` -------------------------------- ### Get Planet Position (Python) Source: https://context7.com/gmiller123456/vsop87-multilang/llms.txt Provides a Python implementation for calculating planetary positions with the same API structure as the JavaScript version. ```APIDOC ## Get Planet Position (Python) ### Description Python implementation with the same API structure for calculating planetary positions. ### Method N/A (Library Function) ### Endpoint N/A (Library Function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```python import math from vsop87a_full import vsop87a_full def jd_to_t(jd): """Convert Julian Date to VSOP87 time parameter (Julian millennia from J2000.0)""" return (jd - 2451545.0) / 365250.0 # Calculate positions for January 1, 2000 t = jd_to_t(2451545.0) # Get Earth position earth = vsop87a_full.getEarth(t) print(f"Earth X: {earth[0]:.10f} AU") # -0.1771354586 AU print(f"Earth Y: {earth[1]:.10f} AU") # 0.9672416237 AU print(f"Earth Z: {earth[2]:.10f} AU") # -0.0000039000 AU # Get Jupiter position jupiter = vsop87a_full.getJupiter(t) print(f"Jupiter X: {jupiter[0]:.10f} AU") # 4.0011740268 AU print(f"Jupiter Y: {jupiter[1]:.10f} AU") # 2.9385810077 AU print(f"Jupiter Z: {jupiter[2]:.10f} AU") # -0.1017837501 AU ``` ### Response #### Success Response (200) - **Array** (Array) - A list containing the X, Y, and Z coordinates in Astronomical Units (AU). #### Response Example ```json { "example": "[-0.1771354586, 0.9672416237, -0.0000039000]" } ``` ``` -------------------------------- ### VSOP87 JSON Test Suite Setup Source: https://github.com/gmiller123456/vsop87-multilang/blob/master/Languages/JSON/javaScriptVsop87json.html Initializes variables and imports the necessary VSOP87 JSON module. This code must be served from a web server. ```javascript import vsop87json from "./vsop87json.js"; let vsop87a; runTests(); var pass=true; ``` -------------------------------- ### Get Earth-Moon Barycenter Ephemeris Data Source: https://github.com/gmiller123456/vsop87-multilang/blob/master/Languages/JSON/javaScriptVsop87json.html Retrieves ephemeris data for the Earth-Moon barycenter. Requires `vsop87a_full` and `jd2et`. ```python check3(vsop87a_full.getEmb(jd2et(2451545.0)), -.1771591440, .9672192891, -.0000009536, -.0172031075, -.0031639188, .0000000258) ``` ```python check3(vsop87a_full.getEmb(jd2et(2415020.0)), -.1883097013, .9650388428, .0002152687, -.0171675938, -.0033578159, -.0000011144) ``` ```python check3(vsop87a_full.getEmb(jd2et(2378495.0)), -.1993643284, .9627828195, .0004282504, -.0171295937, -.0035503981, -.0000022560) ``` ```python check3(vsop87a_full.getEmb(jd2et(2341970.0)), -.2104343221, .9603642782, .0006462945, -.0170893883, -.0037428931, -.0000034648) ``` ```python check3(vsop87a_full.getEmb(jd2et(2305445.0)), -.2214911209, .9578778167, .0008589738, -.0170461690, -.0039348052, -.0000047385) ``` ```python check3(vsop87a_full.getEmb(jd2et(2268920.0)), -.2324953837, .9552252051, .0010711791, -.0170014432, -.0041262672, -.0000060273) ``` ```python check3(vsop87a_full.getEmb(jd2et(2232395.0)), -.2435434218, .9524355203, .0012855339, -.0169546235, -.0043172876, -.0000074100) ``` ```python check3(vsop87a_full.getEmb(jd2et(2195870.0)), -.2544800656, .9495642257, .0014936626, -.0169050854, -.0045073961, -.0000088462) ``` ```python check3(vsop87a_full.getEmb(jd2et(2159345.0)), -.2654471686, .9464953236, .0017047755, -.0168543115, -.0046981611, -.0000102989) ``` ```python check3(vsop87a_full.getEmb(jd2et(2122820.0)), -.2762837551, .9433889919, .0019144183, -.0168007538, -.0048864356, -.0000118518) ``` -------------------------------- ### Test Position Calculations Source: https://github.com/gmiller123456/vsop87-multilang/blob/master/Languages/JavaScript/example_alt_az.html These examples demonstrate calling the testPosition function with various input parameters. Each call represents a specific celestial body's position at a given time. ```Python testPosition(299,-51.1994285877759,47.8547288042908,"3850-Apr-17 15:37:54", 3127350.151319444, 12.7501180, 4.3741488, 37.3301362, 13.6109219, 277.7425,-11.2877, 8.5660567446, 13.898153, 69.185485, 6.077380997); testPosition(10,21.3939739059975,185.062784226188,"3054-Jul-06 22:11:24", 2836697.424583334, 90.7848503, 23.3022542, 106.7859687, 22.4090217, 82.9037, 67.8311, 5.5261861461, 8.446224, 69.184466, -1.592878434); testPosition(499,73.0740857589016,126.646047764118,"1849-Nov-04 16:56:08", 2396701.205648148, 98.8748563, 24.2904639, 96.5774662, 24.4005569, 141.9481, 38.3061, 4.2997754998, 5.807799, 9.292858, -2.138722244); testPosition(799,42.6099190542067,265.941021402365,"2350-Nov-20 23:35:35", 2579703.483043982, 12.1298642, 4.4605364, 16.6805295, 6.3514541, 108.6314, 28.0324, 21.2914794265, 160.285337, 69.182723, -3.820555877); testPosition(199,46.7608248537124,272.047126552327,"2595-Jun-12 17:17:39", 2669027.220590278, 48.6734272, 14.7902748, 57.0552548, 16.7846404, 208.5992, 57.3426, 4.8471607181, 7.769910, 69.184837, 1.043477063); testPosition(301,-28.4023472299445,19.3590000901352,"3974-Nov-20 04:39:13", 3172856.693900463,120.7100072, 25.3873061, 149.2778853, 17.7020640, 0.7104, 43.8927, 9.9160341952, 0.020337, 69.182461, -0.035824827); testPosition(599,-3.19724435959344,287.362387262434,"2128-Jan-17 10:42:52", 2498311.946435185,314.6323571,-17.7931398, 316.4244754,-17.2845107, 109.7079,-20.0691, 13.6170926402, 49.859514, 69.184316, -7.477872387); testPosition(301,72.3452680383534,253.386048128629,"2834-Apr-01 02:04:27", 2756247.586423611, 6.7146449, 1.2280512, 17.4907126, 5.7523456, 278.2134, 3.4281, 7.6191719321, 0.022558, 69.185549, 6.453124422); testPosition(301,49.5336853813743,72.5186840026537,"1487-Nov-18 18:40:05", 2264506.277835648,292.6761974,-24.3812704, 284.8722846,-25.3012149, 287.0485,-47.0644, 3.9193015311, 0.022631, 217.983330, 8.927815893); testPosition(301,80.1794692267992,119.599455733001,"1473-Apr-19 23:50:18", 2259180.493263889,321.5105550,-10.5825161, 314.3687584,-12.7592405, 199.2418, -3.4980, 22.2719620724, 0.021026, 240.751816, 1.314044843); testPosition(199,84.3752596894079,220.686804612923,"3564-Jan-03 11:19:31", 3022785.971886574,238.5030020,-17.3922804, 261.4420551,-20.3562941, 53.6487,-23.7638, 8.8850050407, 7.401579, 69.183234, -8.544465302); testPosition(799,-16.7638554073596,349.89502702814,"2511-Jul-09 20:53:54", 2638373.370763889,349.9795623, -5.1648548, 356.5717634, -2.3390132, 104.3887,-33.2546, 15.3823212731, 163.944620, 69.184135, -8.389129618); testPosition(499,36.9365912827101,290.06904490141,"1937-Oct-14 03:35:33", 2428820.649687500,281.3504760,-25.2276505, 280.3963020,-25.2922280, 247.0948,-11.7812, 0.4150134634, 9.707970, 24.045111, 5.721926665); testPosition(799,58.2932245085865,292.235088721046,"2249-Jan-10 01:45:38", 2542499.573356481,306.1416346,-19.8776590, 309.7166666,-19.0289038, 284.3647,-30.9744, 4.5494851412, 172.421507, 69.184056, 7.901707370); testPosition(799,-56.2092664872158,339.611722261991,"2000-Jan-19 19:35:44", 2451563.316481481,318.4639716,-16.7253393, 318.4551724,-16.7268843, 274.0235, 22.9269, 2.1371451875, 173.535689, 64.184427, 4.906800361); testPosition(499,65.6452001400513,147.258440656558,"1622-Aug-02 21:34:25", 2313697.398900463,131.3866377, 19.1925987, 125.9612785, 20.5052896, 105.4945, 29.3361, 4.1471373310, 21.996224, 82.253008, -4.250281236); testPosition(599,75.7667118417564,53.8262402593658,"2290-Apr-13 23:00:51", 2557568.458923611,202.3353484, -7.6885230, 206.1658313, -9.1646562, 214.6100, 2.5361, 16.0832800885, 37.012831, 69.185638, 2.338891338); testPosition(10,73.4123943492039,284.179829223956,"1886-Jun-10 22:18:51", 2410068.429756945, 80.7227532, 23.1780722, 78.9948563, 23.0637059, 266.5080, 25.1625, 10.5386523040, 8.446108, -4.240485, 5.272328550); testPosition(10,52.8213983760854,209.146271499917,"2245-Sep-16 12:02:50", 2541288.001967593,171.0242001, 3.8657272, 174.1759562, 2.5138897, 36.0739,-28.8193, 1.6844463614, 8.370263, 69.182459, -9.927284049); testPosition(499,3.02242270735469,265.015174431891,"2230-Sep-13 01:10:05", 2535805.548668982,198.7031737, -7.7288641, 201.7224876, -8.9331274, 259.7250, 16.8006, 18.2791284814, 19.252704, 69.182509, 4.830962640); testPosition(499,-2.34361166805229,2.60281609832006,"1800-Jun-24 01:27:06", 2378670.560486111, 11.9453731, 2.5431049, 9.3809380, 1.4506600, 87.7710, 16.8758, 19.7559289839, 8.894891, 18.111938, -4.869466881); testPosition(899,-21.4665851990768,98.3674591281149,"1955-Jun-09 03:07:53", 2435267.630474537,205.0264426, -8.5119091, 204.4479194, -8.2892626, 148.0141,-55.5882, 2.8037930094, 246.863545, 30.536065, -10.826068286); testPosition(10,80.9835916064613,160.976716045141,"3614-May-09 20:57:45", 3041175.373437500, 25.4264383, 10.4101645, 47.5724307, 17.5768104, 113.1265, 21.3346, 22.9067820212, 8.335517, 69.185558, -4.264713359); testPosition(10,58.3007747092572,21.1691248384335,"3268-Feb-04 22:50:16", 2914707.451574074,300.0075668,-20.4446625, 318.1245214,-16.02 ``` -------------------------------- ### Initialize and Test VSOP87 Planetary Calculations Source: https://github.com/gmiller123456/vsop87-multilang/blob/master/Languages/Binary/JavaScript/test.html Initializes binary data files and validates planetary position calculations against known values. Requires the VSOP87_Binary module. ```javascript import {VSOP87_Binary} from "./VSOP87_Binary.js"; let pass=true; function jd2et( jd){ return (jd - 2451545.0) / 365250.0; } function check2(a,b){ let t1 = a % Math.PI; let t2 = b % Math.PI; if (t1 < 0) t1 += Math.PI; if (t2 < 0) t2 += Math.PI; if (Math.abs(t1-t2) > .0000000009 || isNaN(t1) || isNaN(t2)) { console.log("Fail:"+a+" "+b); pass=false; }else{ //console.log("Pass"); } } function check6(r,a,k,q,l,h,p){ check2(r[0],a); check2(r[1],h); check2(r[2],k); check2(r[3],l); check2(r[4],p); check2(r[5],q); } function check3(r,a,b,c){ check2(r[0], a); check2(r[1], b); check2(r[2], c); } function checkv(r,a,b,c){ check2(r[3], a); check2(r[4], b); check2(r[5], c); } async function test(){ const vsop87=await new VSOP87_Binary("vsop87.bin").init(); const vsop87a=await new VSOP87_Binary("vsop87a.bin").init(); const vsop87b=await new VSOP87_Binary("vsop87b.bin").init(); const vsop87c=await new VSOP87_Binary("vsop87c.bin").init(); const vsop87d=await new VSOP87_Binary("vsop87d.bin").init(); const vsop87e=await new VSOP87_Binary("vsop87e.bin").init(); check6(vsop87.getMercury(jd2et(2451545.0)),.3870982122,.0446647518,.0406161541,4.4026057779,.2007208958,.0456355031); check6(vsop87.getMercury(jd2et(2415020.0)),.3870977206,.0452159418,.0405500078,3.1341564065,.2005915794,.0457636622); check6(vsop87.getMercury(jd2et(2378495.0)),.3870988718,.0457588298,.0404841231,1.8657954073,.2004369024,.0458905455); check6(vsop87.getMercury(jd2et(2341970.0)),.3870981592,.0462989389,.0404178810,.5973516890,.2002875699,.0460171832); check6(vsop87.getMercury(jd2et(2305445.0)),.3870993315,.0468597370,.0403519526,5.6121176789,.2001268146,.0461440822); check6(vsop87.getMercury(jd2et(2268920.0)),.3870987715,.0474175874,.0402856291,4.3437933704,.1999792560,.0462713710); check6(vsop87.getMercury(jd2et(2232395.0)),.3870987733,.0479739903,.0402194431,3.0753253705,.1998210217,.0463978782); check6(vsop87.getMercury(jd2et(2195870.0)),.3870975283,.0485220075,.0401524550,1.8068957210,.1996800563,.0465244776); check6(vsop87.getMercury(jd2et(2159345.0)),.3870977789,.0490792962,.0400854729,.5385405030,.1995293400,.0466514562); check6(vsop87.getMercury(jd2et(2122820.0)),.3870983087,.0496101939,.0400177912,5.5532501234,.1993701567,.0467766328); check6(vsop87.getVenus(jd2et(2451545.0)),.7233269304,-.0045086077,.0068248058,3.1761350910,.0050312182,.0288221481); check6(vsop87.getVenus(jd2et(2415020.0)),.7233254387,-.0044945272,.0066855874,6.0067809876,.0051121733,.0288637007); check6(vsop87.getVenus(jd2et(2378495.0)),.7233259624,-.0045347113,.0065487273,2.5541924033,.0051153686,.0289015623); check6(vsop87.getVenus(jd2et(2341970.0)),.7233336010,-.0045714046,.0064078362,5.3848916850,.0052085666,.0289381365); check6(vsop87.getVenus(jd2et(2305445.0)),.7233444128,-.0046106821,.0062695296,1.9323601820,.0052198095,.0289747589); check6(vsop87.getVenus(jd2et(2268920.0)),.7233295421,-.0046705686,.0061312556,4.7630365987,.0052905838,.0290086794); check6(vsop87.getVenus(jd2et(2232395.0)),.7233288477,-.0046816592,.0059904848,1.3105445955,.0052685214,.0290424556); check6(vsop87.getVenus(jd2et(2195870.0)),.7233301132,-.0047512383,.0058529532,4.1411623839,.0053213979,.0290755722); check6(vsop87.getVenus(jd2et(2159345.0)),.7233280698,-.0047241639,.0057132257,.6886289925,.0053523286,.0291056458); check6(vsop87.getVenus(jd2et(2122820.0)),.7233247251,-.0047739162,.0055732704,3.5192700749,.0053755162,.0291355398); check6(vsop87.getMars(jd2et(2451545.0)),1.5236789887,.0853133078,.0104705229,6.2038757099,-.0378067117,.0122862593); check6(vsop87.getMars(jd2et(2415020.0)),1.5236463472,.0849023067,.0104523543,5.1511909417,-.0384449185,.0123926641); check6(vsop87.getMars(jd2et(2378495.0)),1.5236769795,.0846457412,.0104339358,4.0987790797,-.0392454967,.0124994658); check6(vsop87.getMars(jd2et(2341970.0)),1.5236301764,.0842278893,.0104148075,3.0462792685,-.0396982629,.0126070949); check6(vsop87.getMars(jd2et(2305445.0)),1.5237744505,.0837767413,.0103948927,1.9938502931,-.0403804191,.0127126597); check6(vsop87.getMars(jd2et(2268920.0)),1.5236102237,.0833757044,.0103755322,.9412449947,-.0410377666,.0128192550); check6(vsop87.getMars(jd2et(2232395.0)),1.5237000651,.0831244748,.0103538429,6.1719713983,-.0415495114,.0129255291); check6(vsop87.getMars(jd2et(2195870.0)),1.5236148015,.0825058311,.0103313655,5.1194225688,-.0421055436,.0130315956); check6(vsop87.getMars(jd2et(2159345.0)),1.5237578878,.0821906317,.0103081046,4.0669853279,-.0427917582,.0131364565); check6(vsop87.getMars(jd2et(2122820.0)),1.5236045525,.0818247408,.0102833001,3.0145860938,-.0434649474,.0132404725); check6(vsop87.getJupiter(jd2et(2451545.0)),5.2042662908,.0469877116,-.0020729462,.5999772955,.0130817658,.0111943279); check6(vsop87.getJupiter(jd2et(2415020.0)),5.2028202641,.0473151973,-.0020327888,4.1841549084,.0115865096,.0112155194); c ``` -------------------------------- ### Get Mercury Ephemeris Data Source: https://github.com/gmiller123456/vsop87-multilang/blob/master/Languages/JSON/javaScriptVsop87json.html Retrieves Mercury's ephemeris data using the `vsop87b_full` dataset. Requires `jd2et`. ```python check3(vsop87b_full.getMercury(jd2et(2451545.0)), 4.4293481043, -.0527573411, .4664714751, .0479088415, -.0053005994, .0003551593) ``` ```python check3(vsop87b_full.getMercury(jd2et(2415020.0)), 3.5095041512, .0564907883, .4183426276, .0595900338, -.0064868219, .0048383515) ``` ```python check3(vsop87b_full.getMercury(jd2et(2378495.0)), 2.1225631484, .1171864614, .3233909531, .1007792689, .0035704944, .0040779555) ``` ```python check3(vsop87b_full.getMercury(jd2et(2341970.0)), .2641557554, -.0680150537, .3381563139, .0913316347, .0093309731, -.0051301892) ``` ```python check3(vsop87b_full.getMercury(jd2et(2305445.0)), 5.2811474961, -.1178238226, .4326517759, .0563131138, -.0019152855, -.0041687376) ``` ```python check3(vsop87b_full.getMercury(jd2et(2268920.0)), 4.3854123464, -.0468100865, .4661523937, .0479440925, -.0054614651, .0005305578) ``` ```python check3(vsop87b_full.getMercury(jd2et(2232395.0)), 3.4577380614, .0634626330, .4152385207, .0605327941, -.0063848195, .0049542248) ``` ```python check3(vsop87b_full.getMercury(jd2et(2195870.0)), 2.0443901595, .1140574170, .3209366231, .1022477370, .0046873828, .0038043935) ``` -------------------------------- ### Initialize and Print VSOP87 Data Source: https://github.com/gmiller123456/vsop87-multilang/blob/master/utility/indexgen.html Retrieves VSOP87 data and initiates the printing process for all versions and planets. Ensure the getArray() function correctly loads the data. ```javascript const data=getArray(); const versions=["vsop87","vsop87a","vsop87b","vsop87c","vsop87d","vsop87e"]; const planets= ['earth','emb', 'jupiter', 'mars', 'mercury', 'neptune', 'saturn', 'uranus', 'venus', 'sun']; print(data); ``` -------------------------------- ### Get Planet Velocities (JavaScript) Source: https://context7.com/gmiller123456/vsop87-multilang/llms.txt Calculates heliocentric velocity components in AU per Julian millennium. Requires vsop87a_full_velocities.js. ```javascript // Include vsop87a_full_velocities.js const t = (2451545.0 - 2451545.0) / 365250.0; // Get Earth velocity (AU per Julian millennium) const earthVel = vsop87a_full_velocities.getEarth(t); console.log("Earth Velocity:"); console.log(" dX/dt:", earthVel[0], "AU/millennium"); // -0.0172076240 console.log(" dY/dt:", earthVel[1], "AU/millennium"); // -0.0031587881 console.log(" dZ/dt:", earthVel[2], "AU/millennium"); // 0.0000001069 // Get Mercury velocity const mercuryVel = vsop87a_full_velocities.getMercury(t); console.log("Mercury Velocity:"); console.log(" dX/dt:", mercuryVel[0], "AU/millennium"); // 0.0213663982 console.log(" dY/dt:", mercuryVel[1], "AU/millennium"); // -0.0064479797 console.log(" dZ/dt:", mercuryVel[2], "AU/millennium"); // -0.0024878668 ``` -------------------------------- ### Get Planet Position (Java) Source: https://context7.com/gmiller123456/vsop87-multilang/llms.txt Retrieves heliocentric coordinates for planets using static methods. Requires the vsop87a_full library. ```java public class PlanetPositions { public static void main(String[] args) { // Time parameter for January 1, 2000 double t = (2451545.0 - 2451545.0) / 365250.0; // Get Venus position double[] venus = vsop87a_full.getVenus(t); System.out.printf("Venus: X=%.10f, Y=%.10f, Z=%.10f AU%n", venus[0], venus[1], venus[2]); // Get Saturn position double[] saturn = vsop87a_full.getSaturn(t); System.out.printf("Saturn: X=%.10f, Y=%.10f, Z=%.10f AU%n", saturn[0], saturn[1], saturn[2]); // Get Moon position double[] earth = vsop87a_full.getEarth(t); double[] emb = vsop87a_full.getEmb(t); double[] moon = vsop87a_full.getMoon(earth, emb); System.out.printf("Moon: X=%.10f, Y=%.10f, Z=%.10f AU%n", moon[0], moon[1], moon[2]); } } ``` -------------------------------- ### General Usage Parameters for VSOP87 Source: https://github.com/gmiller123456/vsop87-multilang/blob/master/Languages/BASIC/readme.md Defines the input variables for planet selection and time calculation required before calling the subroutine at line 1000. ```BASIC p= 1=mercury 2=venus 3=earth (or emb) 4=mars 5=jupiter 6=saturn 7=uranus 8=neptune 9=emb or sun t=(jd - 2451545.0) / 365250.0 gosub 1000 result in r() array Order of variables in r(), depend on version: vsop87: a, l, k, h, q, p vsop87 A,C,E=x, y, z vsop87 B,D: l, b, r ``` -------------------------------- ### Get Planet Position (C) Source: https://context7.com/gmiller123456/vsop87-multilang/llms.txt C implementation utilizing function calls to retrieve planetary positions, storing results in provided output arrays. ```APIDOC ## Get Planet Position (C) ### Description C implementation using function-based API with output arrays for storing position vectors. ### Method N/A (Library Function) ### Endpoint N/A (Library Function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```c #include #include "vsop87a_full.c" int main() { // Time parameter for January 1, 2000 (JD 2451545.0) double t = (2451545.0 - 2451545.0) / 365250.0; // Position arrays [x, y, z] in AU double earth[3], mars[3], moon[3], emb[3]; // Get Earth position vsop87a_full_getEarth(t, earth); printf("Earth: X=%.10f, Y=%.10f, Z=%.10f AU\n", earth[0], earth[1], earth[2]); // Get Mars position vsop87a_full_getMars(t, mars); printf("Mars: X=%.10f, Y=%.10f, Z=%.10f AU\n", mars[0], mars[1], mars[2]); // Get Moon position from Earth and EMB vsop87a_full_getEmb(t, emb); vsop87a_full_getMoon(earth, emb, moon); printf("Moon: X=%.10f, Y=%.10f, Z=%.10f AU\n", moon[0], moon[1], moon[2]); return 0; } ``` ### Response #### Success Response (200) - **void** - The function populates the provided double arrays with X, Y, and Z coordinates in AU. #### Response Example ```json { "example": "Earth: X=-0.1771354586, Y=0.9672416237, Z=-0.0000039000 AU\nMars: X=1.3907159264, Y=-0.0134157043, Z=-0.0344677967 AU\nMoon: X=..., Y=..., Z=... AU" } ``` ``` -------------------------------- ### Get Moon Position (JavaScript) Source: https://context7.com/gmiller123456/vsop87-multilang/llms.txt Calculates the Moon's position using Earth and Earth-Moon Barycenter (EMB) coordinates. ```javascript // Get Moon position for January 1, 2000 const t = (2451545.0 - 2451545.0) / 365250.0; const earth = vsop87a_full.getEarth(t); const emb = vsop87a_full.getEmb(t); const moon = vsop87a_full.getMoon(earth, emb); console.log("Moon X:", moon[0], "AU"); console.log("Moon Y:", moon[1], "AU"); console.log("Moon Z:", moon[2], "AU"); // Moon position is calculated using the mass ratio formula: // moon = (emb - earth) * (1 + 1 / 0.01230073677) + earth ```