LoginSignup
12
12

More than 5 years have passed since last update.

経度、緯度、時刻から、太陽、月の方角を計算する

Last updated at Posted at 2013-10-06

前に書いたもの。

日の出・日の入りの計算 : 天体の出没時刻の求め方 / 長沢工著, 東京 : 地人書館, 1999.12
と言う本に書いてあった近似式を用いている。

例えば、

[[[CMMoon instance] azimuthAngleAtDate:[NSDate date] inLocation:location TimeZone:[NSTimeZone defaultTimeZone]]

で現時点での月の方位角が、

[[[CMSun instance] declinationAtDate:[NSDate date] inLocation:location TimeZone:[NSTimeZone defaultTimeZone]]

で現時点での太陽の赤緯が計算される。

CMCelestialObjectの適当な関数をオーバーライドすればどんな天体でもサブクラス化できるつもりで作ったが、天文の知識は無いので実際の計算過程で問題が出ないのかは不明。

月の近似式は非常に複雑で、400個強の係数を使っている。

また、名前は忘れたが反復法によって経緯から経緯までの方位を計算するものも入っている。


@interface CMLocationUtility : NSObject

+(CLLocationDegrees)angleFromCoordinate:(CLLocationCoordinate2D)from toCoordinate:(CLLocationCoordinate2D)to;

@end

何かの参考になれば。

12
12
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
12