Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
161 changes: 81 additions & 80 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,86 +35,87 @@ or minified file
日本語: [usage.ja.md](/usage.ja.md)

## Example
var date = new Date();

// Position of planets
var mars = new Orb.VSOP("Mars");
var xyz = mars.xyz(date); // ecliptic rectangular coordinates(x, y, z)
var radec = mars.radec(date); // equatorial spherical coordinates(ra, dec, distance)

// Position of the moon
var luna = new Orb.Luna();
var xyz = luna.xyz(date); // Earth centered ecliptic rectangular coordinates (x, y, z)
var radec = luna.radec(date); // equatorial spherical coordinates(ra, dec, distance)

// Apparent position of the Sun
var sun = new Orb.Sun();
var xyz = sun.xyz(date); // Earth centered equatorial rectangular coordinates (x, y, z)
var radec = sun.radec(date); // equatorial spherical coordinates(ra, dec, distance)

// Kepler orbital elements
var asteroid = new Orb.Kepler({
"gm": 2.9591220828559093*Math.pow(10,-4), //(au^3/d^2) default value is the sun, so you can omit this line.
"eccentricity":"0.08728849329001058",
"inclination":"6.812676631845272",
"longitude_of_ascending_node":"250.5660658100269",
"argument_of_periapsis":"95.63473165761138",
"time_of_periapsis":"2456918.756066796",
"semi_major_axis":"1.001911878091084"
});
var xyz = asteroid.xyz(date); // ecliptic rectangular coordinates(x, y, z, xdot, ydot, zdot)
var radec = asteroid.radec(date); // equatorial spherical coordinates(ra, dec, distance)

// Cartesian state vectors to Kepler orbital elements
var orbital_elements = new Orb.CartesianToKeplerian(xyz)

// Position of artificial satellites from Two Line Elements(TLE)
var tle = {
first_line:"1 25544U 98067A 15012.59173611 .00014829 00000-0 23845-3 0 7179",
second_line:"2 25544 051.6466 140.7335 0006107 243.2909 291.5211 15.53213268923827"
}
var satellite = new Orb.SGP4(tle);
var xyz = satellite.xyz(date); // Earth centered equatorial rectangular coordinates (x, y, z, xdot, ydot, zdot)
var latlng = satellite.latlng(date); // geographic spherical coordinates(latitude, longitude, altitude, velocity)

// Azimuth and Elevation
var your_location = {
"latitude":35.658,
"longitude":139.741,
"altitude":0
}

var observe_mars = new Orb.Observation({"observer":your_location,"target":mars});
var horizontal = observe_mars.azel(date); // horizontal coordinates(azimuth, elevation)

var observe_satellite = new Orb.Observation({"observer":your_location,"target":satellite});
var horizontal = observe_satellite.azel(date); // horizontal coordinates(azimuth, elevation)

var sirius = {
"ra":6.75257,
"dec":-16.7131,
"distance":543300
}

var observe_star = new Orb.Observation({
"observer":your_location ,
"target":sirius
});
var horizontal = observe_star.azel(date); // horizontal coordinates(azimuth, elevation)

// Time conversion
var time = new Orb.Time(date);
var gmst = time.gmst();
var julian_date = time.jd();
var time_in_day = time.time_in_day();
var day_of_year = time.doy();

// Coordinates conversion
var equatorial_rectangular = Orb.RadecToXYZ(sirius)
var ecliptic_rectangular = Orb.EquatorialToEcliptic({"date":date,"equatorial":equatorial_rectangular})
var equatorial_rectangular = Orb.EclipticToEquatorial({"date":date,"ecliptic":ecliptic_rectangular})
var equatorial_spherical = Orb.XYZtoRadec(equatorial_rectangular)

```js
var date = new Date();

// Position of planets
var mars = new Orb.VSOP("Mars");
var xyz = mars.xyz(date); // ecliptic rectangular coordinates(x, y, z)
var radec = mars.radec(date); // equatorial spherical coordinates(ra, dec, distance)

// Position of the moon
var luna = new Orb.Luna();
var xyz = luna.xyz(date); // Earth centered ecliptic rectangular coordinates (x, y, z)
var radec = luna.radec(date); // equatorial spherical coordinates(ra, dec, distance)

// Apparent position of the Sun
var sun = new Orb.Sun();
var xyz = sun.xyz(date); // Earth centered equatorial rectangular coordinates (x, y, z)
var radec = sun.radec(date); // equatorial spherical coordinates(ra, dec, distance)

// Kepler orbital elements
var asteroid = new Orb.Kepler({
"gm": 2.9591220828559093*Math.pow(10,-4), //(au^3/d^2) default value is the sun, so you can omit this line.
"eccentricity":"0.08728849329001058",
"inclination":"6.812676631845272",
"longitude_of_ascending_node":"250.5660658100269",
"argument_of_periapsis":"95.63473165761138",
"time_of_periapsis":"2456918.756066796",
"semi_major_axis":"1.001911878091084"
});
var xyz = asteroid.xyz(date); // ecliptic rectangular coordinates(x, y, z, xdot, ydot, zdot)
var radec = asteroid.radec(date); // equatorial spherical coordinates(ra, dec, distance)

// Cartesian state vectors to Kepler orbital elements
var orbital_elements = new Orb.CartesianToKeplerian(xyz)

// Position of artificial satellites from Two Line Elements(TLE)
var tle = {
first_line:"1 25544U 98067A 15012.59173611 .00014829 00000-0 23845-3 0 7179",
second_line:"2 25544 051.6466 140.7335 0006107 243.2909 291.5211 15.53213268923827"
}
var satellite = new Orb.SGP4(tle);
var xyz = satellite.xyz(date); // Earth centered equatorial rectangular coordinates (x, y, z, xdot, ydot, zdot)
var latlng = satellite.latlng(date); // geographic spherical coordinates(latitude, longitude, altitude, velocity)

// Azimuth and Elevation
var your_location = {
"latitude":35.658,
"longitude":139.741,
"altitude":0
}

var observe_mars = new Orb.Observation({"observer":your_location,"target":mars});
var horizontal = observe_mars.azel(date); // horizontal coordinates(azimuth, elevation)

var observe_satellite = new Orb.Observation({"observer":your_location,"target":satellite});
var horizontal = observe_satellite.azel(date); // horizontal coordinates(azimuth, elevation)

var sirius = {
"ra":6.75257,
"dec":-16.7131,
"distance":543300
}

var observe_star = new Orb.Observation({
"observer":your_location ,
"target":sirius
});
var horizontal = observe_star.azel(date); // horizontal coordinates(azimuth, elevation)

// Time conversion
var time = new Orb.Time(date);
var gmst = time.gmst();
var julian_date = time.jd();
var time_in_day = time.time_in_day();
var day_of_year = time.doy();

// Coordinates conversion
var equatorial_rectangular = Orb.RadecToXYZ(sirius)
var ecliptic_rectangular = Orb.EquatorialToEcliptic({"date":date,"equatorial":equatorial_rectangular})
var equatorial_rectangular = Orb.EclipticToEquatorial({"date":date,"ecliptic":ecliptic_rectangular})
var equatorial_spherical = Orb.XYZtoRadec(equatorial_rectangular)
```

## License
Copyright (c) 2012-2017 Isana Kashiwai
Expand Down