mk_coord 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -6
- data/exe/mk_coord +18 -18
- data/lib/mk_coord.rb +5 -3
- data/lib/mk_coord/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 49d9b793b0ce97d37ecbc6a8e99ed9f70b3a85cd
|
4
|
+
data.tar.gz: 77cd70b9faa59ac7c69b0cfc9c94671acc4b94c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
11
|
-
- Ecliptic coordinates -> Equator coordinates
|
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
|
14
|
-
- Ecliptic coordinates -> Equator coordinates
|
15
|
-
* Rectangular coordinates -> Polar coordinates
|
16
|
-
* Polar coordinates -> Rectangular coordinates
|
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
|
|
data/exe/mk_coord
CHANGED
@@ -2,25 +2,25 @@
|
|
2
2
|
|
3
3
|
require "mk_coord"
|
4
4
|
|
5
|
-
|
6
|
-
|
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
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
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
|
|
data/lib/mk_coord.rb
CHANGED
@@ -51,9 +51,11 @@ module MkCoord
|
|
51
51
|
|
52
52
|
def self.pol2rect(pol, r)
|
53
53
|
lambda, phi = pol
|
54
|
-
|
55
|
-
|
56
|
-
|
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
|
data/lib/mk_coord/version.rb
CHANGED