Last active
October 3, 2015 07:37
-
-
Save lizard-isana/2418098 to your computer and use it in GitHub Desktop.
Orb.js: How to convert RA/Dec to horizontal coodinates
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// orb.js tips 2012.04.19 | |
// How to convert RA/Dec to horizontal coodinates | |
// https://github.com/lizard-isana/orb.js | |
// demo: http://www.lizard-tail.com/isana/lab/orb/ | |
// RA/Decから天体の今現在見える位置を計算する方法 | |
// 使うのは core.js のみ | |
// https://github.com/lizard-isana/orb.js/blob/master/core.js | |
// JavaScriptのDateオブジェクトから、Orb.Timeオブジェクトを作る | |
// (天体の位置計算に必要な特殊な時刻系への変換を行うためです) | |
var date = new Date(); | |
var time = new Orb.Time(date); | |
// たとえばシリウスを観測するとしましょう | |
var target = { | |
"ra":6.752472222, | |
"dec":-16.71611111 | |
} | |
// 観測者は東京に居るとします | |
var observer = { | |
"latitude":35.658, | |
"longitude":139.741, | |
"altitude":0 | |
} | |
// 目標となる天体と観測者の位置情報で Orb.Observationクラスを初期化、 | |
var observe = new Orb.Observation({ | |
"observer":observer, | |
"target":target | |
}); | |
// 先ほど作ったtimeオブジェクトをhorizontal(地平座標 horizontal coordinates)メソッドに渡すと | |
var look = observe.horizontal(time); | |
look = { | |
azimuth:[方位角], | |
elevation:[高度角] | |
} | |
// というオブジェクトが返ります。 | |
// JSONに変換した星表がありますので、合わせてご利用ください | |
// https://github.com/lizard-isana/orb.js/tree/master/data | |
// それぞれ収録数が違います | |
// bsc_short.json 約1600個 | |
// bsc_mid.json 約5500個 | |
// bsc_long.json 約9000個(フルカタログ) | |
// これはプラネタリウムアプリなどでよく使われるYale Bright Star CatalogueをJSONに変換したものです | |
// http://en.wikipedia.org/wiki/Bright_Star_Catalogue | |
// Have fun! | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment