mk_coord 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 451081436547389e45091b7adcab22e947cdb76c
4
- data.tar.gz: eab308c3f24fa860d2f11f085c8b0b06a56a8937
3
+ metadata.gz: 49d9b793b0ce97d37ecbc6a8e99ed9f70b3a85cd
4
+ data.tar.gz: 77cd70b9faa59ac7c69b0cfc9c94671acc4b94c5
5
5
  SHA512:
6
- metadata.gz: e2cd1fe9192b8fb1ef3bc6b17f4cc7501e0e62afc0621a016122568f0c2caabb3c337c7a3d780269aecba8e447e0b99b7f188d4cc4fc418e2aadf59b13c58adc
7
- data.tar.gz: 7fc42eade1085223bdcabce2562733a183532d43a928d502bbb56ad178f65dc9fe989288b59f12aa80ea60e81081878ed300e2424d24b96c21e674fecd3c00c3
6
+ metadata.gz: 53ce409cbe830acd77dade928a2663f14a1b75c0819946c487693f2cc31f95a1b9a687b0b475d91995a463a291a331ea6d15c5d47d82297ed4297bd37c67fe4b
7
+ data.tar.gz: 1c0c2679e84a164a9d29e4191d1f4f82a771e4fc78511e5fe623838d2ed7c5f4ecc82984ca7fe0666b1cd9d154c6815e18d01bac5b23a4feb0ec82df10dfdf51
data/README.md CHANGED
@@ -7,13 +7,13 @@ This is the gem library which converts coordinates.
7
7
  ## Computable items
8
8
 
9
9
  * Rectangular position:
10
- - Equator coordinates -> Ecliptic coordinates (x, y, z)
11
- - Ecliptic coordinates -> Equator coordinates (x, y, z)
10
+ - Equator coordinates -> Ecliptic coordinates [x, y, z]
11
+ - Ecliptic coordinates -> Equator coordinates [x, y, z]
12
12
  * Polar position:
13
- - Equator coordinates -> Ecliptic coordinates (lambda, beta)
14
- - Ecliptic coordinates -> Equator coordinates (alpha, delta)
15
- * Rectangular coordinates -> Polar coordinates (lambda, phi, r)
16
- * Polar coordinates -> Rectangular coordinates (x, y, z)
13
+ - Equator coordinates -> Ecliptic coordinates [lambda, beta]
14
+ - Ecliptic coordinates -> Equator coordinates [alpha, delta]
15
+ * Rectangular coordinates -> Polar coordinates [lambda, phi, r]
16
+ * Polar coordinates -> Rectangular coordinates [x, y, z]
17
17
 
18
18
  ## Installation
19
19
 
@@ -2,25 +2,25 @@
2
2
 
3
3
  require "mk_coord"
4
4
 
5
- eps = 23.43929 * MkCoord::Const::PI / 180.0
6
- pos_rect = [
5
+ EPS = 23.43929 * MkCoord::Const::PI / 180.0 # 黄道傾斜角(単位: rad)
6
+ # 元の赤道直交座標
7
+ POS = [
7
8
  0.99443659220700997281,
8
9
  -0.03816291768957833647,
9
10
  -0.01655177670960058384
10
- ]
11
- pos_pol = [
12
- 6.24482770879939,
13
- -0.016630599800372015
14
- ]
15
- r = 0.9951686008947793
16
- p pos_rect
17
- p pos_pol
18
- p r
19
- puts "---"
20
- p MkCoord.rect_eq2ec(pos_rect, eps)
21
- p MkCoord.rect_ec2eq(pos_rect, eps)
22
- p MkCoord.pol_eq2ec(pos_pol, eps)
23
- p MkCoord.pol_ec2eq(pos_pol, eps)
24
- p MkCoord.rect2pol(pos_rect)
25
- p MkCoord.pol2rect(pos_pol, r)
11
+ ] # <= ある日の地球重心から見た太陽重心の位置(単位: AU)
12
+
13
+ puts "RECT_EQ = #{POS}"
14
+ rect_ec = MkCoord.rect_eq2ec(POS, EPS)
15
+ puts "RECT_EC = #{rect_ec}"
16
+ rect_eq = MkCoord.rect_ec2eq(rect_ec, EPS)
17
+ puts "RECT_EQ = #{rect_eq}"
18
+ *pol_eq, r = MkCoord.rect2pol(rect_eq)
19
+ puts " POL_EQ = #{pol_eq[0, 2]} (R = #{r})"
20
+ pol_ec = MkCoord.pol_eq2ec(pol_eq[0, 2], EPS)
21
+ puts " POL_EC = #{pol_ec[0, 2]}"
22
+ pol_eq = MkCoord.pol_ec2eq(pol_ec, EPS)
23
+ puts " POL_EQ = #{pol_eq[0, 2]}"
24
+ rect_eq = MkCoord.pol2rect(pol_eq[0, 2], r)
25
+ puts "RECT_EQ = #{rect_eq}"
26
26
 
@@ -51,9 +51,11 @@ module MkCoord
51
51
 
52
52
  def self.pol2rect(pol, r)
53
53
  lambda, phi = pol
54
- mtx = r_y(phi)
55
- mtx = r_z(lambda, mtx)
56
- return rotate(mtx, [r, 0.0, 0.0])
54
+ return [
55
+ r * Math.cos(lambda) * Math.cos(phi),
56
+ r * Math.sin(lambda) * Math.cos(phi),
57
+ r * Math.sin(phi)
58
+ ]
57
59
  rescue => e
58
60
  raise
59
61
  end
@@ -1,3 +1,3 @@
1
1
  module MkCoord
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mk_coord
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - komasaru