Object
天体の座標
オブジェクトの生成
引数パターン 1 x : x 座標 y : y 座標 z : z 座標 引数パターン 2 ll : 経度 / CIRCLE tb : 緯度 / CIRCLE rr : 距離 c : 周回数 両パターン共通 c : 周回数(デフォルト - ll から生成) z軸の周りを何週して現在の位置にあるかを保持する options : Hash :system => :rectangular - 引数パターン 1 :system => その他 - 引数パターン 2
# File when/ephemeris.rb, line 628 628: def initialize(*args) 629: @options = args[1].kind_of?(Hash) ? args.pop.dup : {} 630: if @options[:system] == :rectangular 631: @x, @y, @z, @c = args 632: @x ||= 0.0 # X座標 633: @y ||= 0.0 # Y座標 634: @z ||= 0.0 # Z座標 635: else 636: @ll, @tb, @rr, @c = args 637: @ll ||= 0.0 # 経度 638: @tb ||= 0.0 # 緯度 639: @rr ||= 1.0 # 距離 640: @c ||= @ll # 周期番号 641: @ll -= (@ll - @c + 0.5) % 1 642: end 643: end
加法
# File when/ephemeris.rb, line 403 403: def +(other) 404: raise TypeError, 'operand should be When::Ephemeris::Coords' unless Coords === other 405: self.class.rectangular(x+other.x, y+other.y, z+other.z, c+other.c) 406: end
減法
# File when/ephemeris.rb, line 409 409: def -(other) 410: raise TypeError, 'operand should be When::Ephemeris::Coords' unless Coords === other 411: self.class.rectangular(x-other.x, y-other.y, z-other.z, c-other.c) 412: end
点対称の反転
# File when/ephemeris.rb, line 415 415: def -@ 416: self.class.polar(ll+0.5, -tb, rr, c) 417: end
要素参照
z : 要素名('x', 'y', 'z', 'll', 'tb', 'r', 'c', :x, :y, :z, :ll, :tb, :r, :c) returns : 要素の値
# File when/ephemeris.rb, line 398 398: def [](z) 399: send(z.to_sym) 400: end
太陽から見た地球と惑星の視距離の余弦
cosine of angle Earth - Sun - Planet returns : Numeric
地球から見た惑星と太陽の視距離の余弦
cosine of angle Planet - Earth - Sun returns : Numeric
# File when/ephemeris.rb, line 585 585: def cos_pes(planet) 586: spherical_law_of_cosines(self - planet) 587: end
惑星から見た太陽と地球の視距離の余弦(惑星の満ち具合)
cosine of angle Sun - Planet - Earth returns : Numeric
# File when/ephemeris.rb, line 594 594: def cos_spe(planet) 595: planet.spherical_law_of_cosines(planet - self) 596: end
経度 / CIRCLE
# File when/ephemeris.rb, line 382 382: def ll ; @ll || polar[0] ; end
惑星の明るさ
luminosity used cosine of angle Sun - Planet - Earth returns : Numeric
# File when/ephemeris.rb, line 603 603: def luminosity_spe(planet) 604: difference = planet - self 605: (planet.spherical_law_of_cosines(difference) + 1) / ( 2 * planet.rr * planet.rr * difference.rr * difference.rr) 606: end
章動
c : 2000年からの経過世紀 returns : When::Ephemeris::Coords
# File when/ephemeris.rb, line 460 460: def nutation(c) 461: rotate_z(delta_p(c)).rotate_x(delta_e(c)) 462: end
地心視差 (黄道座標) / 地心位置 -> 測心位置(観測地中心位置)
t : ユリウス日(Terrestrial Time)または(Temporal)Positionオブジェクト loc : When::Coordinates::Spatial 観測地 returns : When::Ephemeris::Coords
# File when/ephemeris.rb, line 509 509: def parallax(t, loc) 510: return self if loc.alt==When::Coordinates::Spatial::Center 511: self - loc.coords_diff(t) 512: end
極座標
returns : [ll, tb, rr, c] ll : 経度 / CIRCLE tb : 緯度 / CIRCLE rr : 距離 c : 周回数
# File when/ephemeris.rb, line 374 374: def polar 375: @ll, @tb, @rr = _to_p3(@x, @y, @z) unless @rr 376: @c ||= @ll 377: @ll -= (@ll - @c + 0.5) % 1 378: return [@ll, @tb, @rr, @c] 379: end
歳差
dt : 分点からの経過時間 / ベッセル世紀 t0 : 分点 / ベッセル世紀 returns : When::Ephemeris::Coords
# File when/ephemeris.rb, line 472 472: def precession(dt, t0) 473: return self if (tb.abs>=0.25) 474: 475: b0 = dt / (360 * 3600.0) 476: b1 = [0.302, 0.018] 477: b2 = [0.791, 0.001] 478: b3 = [0.462, 0.042] 479: 480: b1.unshift(2304.250 + 1.396 * t0) 481: b2.unshift(polynomial(dt, b1)) 482: b3.unshift(2004.682 - 0.853 * t0) 483: 484: z0 = b0 * b2[0] 485: zt = b0 * polynomial(dt, b2) 486: th = b0 * polynomial(dt, b3) 487: 488: a = ll + z0 489: b = th / 2 490: cA = cosc(a) 491: sA = sinc(a) 492: tB = tanc(b) 493: q = sinc(th)*(tanc(tb) + tB*cA) 494: 495: dRA = atan2(q*sA, 1-q*cA) / CIRCLE 496: dDC = atan2(tB*(cA-sA*tanc(dRA/2)), 1) / CIRCLE 497: 498: self.class.polar(ll + dRA + z0 + zt, tb + 2*dDC, rr, @c) 499: end
赤道座標 -> 地平座標
t : ユリウス日(Terrestrial Time)または(Temporal)Positionオブジェクト loc : When::Coordinates::Spatial 観測地 returns : When::Ephemeris::Coords
# File when/ephemeris.rb, line 560 560: def r_to_h(t, loc) 561: rotate_z(-loc.local_sidereal_time(t) / 24). 562: rotate_y(loc.lat / (360*DEGREE) - 0.25) 563: end
赤道座標 -> 黄道座標
t : ユリウス日(Terrestrial Time)または(Temporal)Positionオブジェクト loc : When::Coordinates::Spatial or When::Ephemeris::Datum 観測地 returns : When::Ephemeris::Coords
# File when/ephemeris.rb, line 521 521: def r_to_y(t, loc=nil) 522: t = +t 523: loc = loc.datum unless loc.kind_of?(Datum) 524: n = loc.axis_of_rotation(t) if loc 525: if (n) 526: c = rotate_z(0.25 - n.rr). 527: rotate_y(0.25 - n.tb). 528: rotate_z(+n.ll) 529: else 530: c = self 531: end 532: return c.rotate_x(-obl(julian_century_from_2000(t))) 533: end
直交座標
returns : [x, y, z] x : x 座標 y : y 座標 z : z 座標
# File when/ephemeris.rb, line 352 352: def rectangular 353: @x, @y, @z = _to_r3(@ll, @tb, @rr) unless @z 354: return [@x, @y, @z] 355: end
X 軸を軸とする回転
t : 回転角 / CIRCLE returns : When::Ephemeris::Coords
# File when/ephemeris.rb, line 425 425: def rotate_x(t) 426: cos = cosc(t) 427: sin = sinc(t) 428: self.class.rectangular(x, y*cos-z*sin, y*sin+z*cos, c) 429: end
Y 軸を軸とする回転
t : 回転角 / CIRCLE returns : When::Ephemeris::Coords
# File when/ephemeris.rb, line 437 437: def rotate_y(t) 438: cos = cosc(t) 439: sin = sinc(t) 440: self.class.rectangular(z*sin+x*cos, y, z*cos-x*sin, c) 441: end
Z 軸を軸とする回転
t : 回転角 / CIRCLE returns : When::Ephemeris::Coords
# File when/ephemeris.rb, line 449 449: def rotate_z(t) 450: self.class.polar(ll+t, tb, rr, c+t) 451: end
距離
# File when/ephemeris.rb, line 388 388: def rr ; @rr || polar[2] ; end
球面の余弦 spherical law of cosines
returns : Numeric
# File when/ephemeris.rb, line 569 569: def spherical_law_of_cosines(other) 570: sinc(tb)*sinc(other.tb) + cosc(tb)*cosc(other.tb)*cosc(ll-other.ll) 571: end
緯度 / CIRCLE
# File when/ephemeris.rb, line 385 385: def tb ; @tb || polar[1] ; end
x 座標
# File when/ephemeris.rb, line 358 358: def x ; @x || rectangular[0] ; end
y 座標
# File when/ephemeris.rb, line 361 361: def y ; @y || rectangular[1] ; end
黄道座標 -> 赤道座標
t : ユリウス日(Terrestrial Time)または(Temporal)Positionオブジェクト loc : When::Coordinates::Spatial or When::Ephemeris::Datum 観測地 returns : When::Ephemeris::Coords
# File when/ephemeris.rb, line 542 542: def y_to_r(t, loc=nil) 543: t = +t 544: c = rotate_x(+obl(julian_century_from_2000(t))) 545: loc = loc.datum unless loc.kind_of?(Datum) 546: n = loc.axis_of_rotation(t) if loc 547: return c unless n 548: c.rotate_z(-n.ll). 549: rotate_y(0.25 + n.tb). 550: rotate_z(0.25 + n.rr) 551: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.