Modul:Astronomie


-- Version 1.0.0
local isOk, GetConst = pcall( require, "Modul:Astronomie/GetConst" )
if type( GetConst ) == "table" then
    Extern = GetConst.Const()
end

local function signum(x)
	if x > 0 then return 1;
	elseif x < 0 then return -1;
	else return 0; end
end

local function GetAlpha(Rek)
	-- make degrees from de-Wiki "hh/mm/ss"
	local T={}
	local pos;
	local part='';
	local num = 0;
	local str= Rek .."/00/00"
	pos = string.find(str,'/') or 0
	if #str > 0 and  pos > 0 then
		part = string.sub(str,1,pos-1);
		num = tonumber(part) or 0
		table.insert(T, num);
		str = string.sub(str,pos+1);
	else
		num = tonumber(str) or 0
		table.insert(T, num);
		str ="";
	end
	pos = string.find(str,'/') or 0
	if #str > 0 and pos > 0 then
		part = string.sub(str,1,pos-1);
		num = tonumber(part) or 0
		table.insert(T, num);
		str = string.sub(str,pos+1);
	else
		num = tonumber(str) or 0
		table.insert(T, num);
		str ="";
	end
	pos = string.find(str,'/') or 0
	if #str > 0 and pos > 0 then
		part = string.sub(str,1,pos-1);
		num = tonumber(part) or 0
		table.insert(T, num);
		str = string.sub(str,pos+1);
	else
		num = tonumber(str) or 0
		table.insert(T, num);
		str ="";
	end
	local Alp = 15*(T[1]+T[2]/60+T[3]/3600);
	return Alp
end	

local function GetDelta(Dek)
	-- make degrees from de-Wiki "dv/dd/mm/ss"
	local T={}
	local pos;
	local part='';
	local num = 0;
	local sgn = 0;
	local str= Dek .."/00/00"
	if string.sub(str,1,2) == '-/' then
		sgn=-1;
		str = string.sub(str,3) 
	elseif string.sub(str,1,2) == '+/' then
		sgn=1;
		str = string.sub(str,3) 
	elseif string.sub(str,1,1) == '/' then 
		sgn=1;
		str = string.sub(str,2) 
	else
		sgn=1;
	end		
	pos = string.find(str,'/') or 0
	if #str > 0 and  pos > 0 then
		part = string.sub(str,1,pos-1);
		num = tonumber(part) or 0
		table.insert(T, num);
		str = string.sub(str,pos+1);
	else
		num = tonumber(str) or 0
		table.insert(T, num);
		str ="";
	end
	pos = string.find(str,'/') or 0
	if #str > 0 and pos > 0 then
		part = string.sub(str,1,pos-1);
		num = tonumber(part) or 0
		table.insert(T, num);
		str = string.sub(str,pos+1);
	else
		num = tonumber(str) or 0
		table.insert(T, num);
		str ="";
	end
	pos = string.find(str,'/') or 0
	if #str > 0 and pos > 0 then
		part = string.sub(str,1,pos-1);
		num = tonumber(part) or 0
		table.insert(T, num);
		str = string.sub(str,pos+1);
	else
		num = tonumber(str) or 0
		table.insert(T, num);
		str ="";
	end
	local Del = sgn * (T[1]+T[2]/60+T[3]/3600);
	return Del
end	

local function GetKart(alf,del)
	-- make xyz-coordinates on a sphere with radius = 1
	local T = {}
	alf = alf * math.pi /180;
	del = del * math.pi /180; 
	T.x = math.cos(alf)	* math.cos(del);
	T.y = math.sin(alf)	* math.cos(del);
	T.z = math.sin(del)	 
	return T   -- T{ T.x , T.y , T.z}
end

local function Vector_x_Matrix(M,V)
--[=[ Multiplication of 3x3-matrix with 3-Vector
needad to change J2000 coordinates into B1875 coordinates

 M = {m11,m12,m13, m21,m22,m23, m31,m32,m33)
 V = (v1, v2,v3)
 calculating:         
    v1       m11,m12,m13       x'
   (v2) * M( m21,m22,m23 ) = R(y')
    v3       m31,m32,m33       z'
]=]
	local m11 = tonumber(M[1]) or 0
	local m12 = tonumber(M[2]) or 0
	local m13 = tonumber(M[3]) or 0
	local m21 = tonumber(M[4]) or 0
	local m22 = tonumber(M[5]) or 0
	local m23 = tonumber(M[6]) or 0
	local m31 = tonumber(M[7]) or 0
	local m32 = tonumber(M[8]) or 0
	local m33 = tonumber(M[9]) or 0
	local x = tonumber(V[1]) or 0
	local y = tonumber(V[2]) or 0
	local z = tonumber(V[3]) or 0
	local R={}
	R.x =  x * m11 + y* m12 + z* m13;
	R.y =  x * m21 + y* m22 + z* m23;  
	R.z =  x * m31 + y* m32 + z* m33; 
	return R;
end

local function GetEquat(T)
	local x = T.x or 0;
	local y = T.y or 0;
	local z = T.z or 0;
	local hypot = math.sqrt(x*x+y*y)
	local 	alf = 0
	local 	del = 0

	if hypot ~= 0 then
		alf = signum(y) * x / hypot;
	else
		alf = 0; -- Ein Himmelspol; undefiniert = Null
	end
	alf = alf / math.pi *180; 
	del = math.asin(z) or 0;
	del = del / math.pi *180; 
	return alf, del
end

local function J2000toB1875(alfJ,delJ)
	-- alf = rect. in degrees
	-- del = decl. in degrees
	local T = {0.999535925, 0.027933851, 0.012146003,
		-0.027935279, 0.999609760, -0.000170004,
		-0.012147193, -0.000169297, 0.999926220 }
	local J2000 = GetKart(alfJ,delJ); 
	local B1875 = Vector_x_Matrix(T,J2000)
	local alfB, delB = GetEquat(B1875) 
	return alfB, delB
end


local Ast = {}

-- GetRek: Converting right ascension from format "hh/mm/ss" to decimal degrees
function Ast.GetRek(frame)
	local Data = frame.args[1] or '';
	local Alpha =  GetAlpha(Data)
	return Alpha
end

-- GetDek: Converting declination from format "v/dd/mm/ss" to decimal degrees
function Ast.GetDek(frame)
	local Data = frame.args[1] or '';
	local Delta =  GetDelta(Data)
	return Delta
end

-- GetConstellation: Getting the Constellation, where a given point belongs to.
-- yet not complete!
function Ast.GetConstellation(frame)
	local RA = frame.args(1) or "";
	local DE = frame.args(2) or "";
	local Epoch = frame.args(3) or "J2000";
	Epoch = string.upper(Epoch);
	local pos = string.find(RA,'/') or 0; -- Slash -> deWiki-Notation
	local Iswiki = pos > 0;
	local alf=0;
	local del=0;
	local alfB=0;
	local delB=0;
	if IsWiki then
		alf = GetAlpha(RA)
		del = GetDelta(DE)
	else
		alf = tonumber(RA) or 0;
		del = tonumber(DE) or 0;
	end
	if Epoch == 'J2000'	then
		alfB, delB = J2000toB1875(alf,del);
	else 
		alfB = alf;
		delB = del;
	end
	-- here the coordinates are given in B1875 as alfB, delB
--[=[ Data from VizieR catalog VI/42
columns:
recno	number of table row
DE_min  declination of lower border in degrees
RA_low  rectascension the border starts in degrees (!)
RA_up   rectascension the border ends in degrees (!)
const   abbrevasion of the constellation
recno	DE_min	RA_low	RA_up	Const
1	88	0.00	360.00	UMi
2	86.5	120.00	217.50	UMi
3	86.166667	315.00	345.00	UMi
4	86	270.00	315.00	UMi
5	85	0.00	120.00	Cep
6	82	137.50	160.00	Cam
7	80	0.00	75.00	Cep
8	80	160.00	217.50	Cam
9	80	262.50	270.00	UMi
10	80	302.50	315.00	Dra
11	77	0.00	52.50	Cep
12	77	172.50	203.75	Cam
13	75	248.00	262.50	UMi
14	75	302.50	310.00	Cep
15	73.5	119.50	137.50	Cam
16	73.5	137.50	170.00	Dra
17	70	195.00	248.00	UMi
18	68	46.50	51.25	Cas
19	67	306.25	310.00	Dra
20	66.5	170.00	180.00	Dra
21	66	0.00	5.00	Cep
22	66	210.00	235.00	UMi
23	66	353.75	360.00	Cep
24	64	180.00	202.50	Dra
25	63	202.50	216.25	Dra
26	63	347.50	353.75	Cep
27	62	91.50	105.00	Cam
28	61.5	300.00	306.25	Dra
29	60.916667	308.00	309.00	Cep
30	60	105.00	119.50	Cam
31	60	119.50	126.25	UMa
32	59.5	296.50	300.00	Dra
33	59.5	300.00	308.00	Cep
34	59.083333	343.00	347.50	Cep
35	58.5	0.00	36.50	Cas
36	58	291.25	296.50	Dra
37	57.5	25.50	28.50	Cas
38	57	36.50	46.50	Cas
39	57	46.50	47.50	Cam
40	56.25	334.75	343.00	Cep
41	56	75.00	91.50	Cam
42	55.5	210.50	216.25	UMa
43	55.5	216.25	291.25	Dra
44	55	47.50	50.00	Cam
45	55	332.00	334.75	Cep
46	54.833333	309.00	329.50	Cep
47	54	0.00	25.50	Cas
48	54	91.50	97.50	Lyn
49	53	181.25	202.50	UMa
50	53	228.75	236.25	Dra
51	52.75	329.50	332.00	Cep
52	52.5	50.00	75.00	Cam
53	52.5	343.00	350.00	Cas
54	51.5	236.25	255.00	Dra
55	50.5	30.75	37.75	Per
56	50.5	255.00	273.50	Dra
57	50	0.00	20.50	Cas
58	50	20.50	25.00	Per
59	50	97.50	102.00	Lyn
60	50	350.00	360.00	Cas
61	48.5	202.50	210.50	UMa
62	48	0.00	16.75	Cas
63	48	353.75	360.00	Cas
64	47.5	272.75	273.50	Her
65	47.5	273.50	286.25	Dra
66	47.5	286.25	287.50	Cyg
67	47	25.00	30.75	Per
68	47	126.25	137.50	UMa
69	46	2.50	13.00	Cas
70	45	180.00	181.25	UMa
71	44.5	102.00	110.50	Lyn
72	44	328.50	329.50	Cyg
73	43.75	328.25	328.50	Cyg
74	43.5	287.50	291.00	Cyg
75	42	137.50	152.50	UMa
76	40	152.50	161.75	UMa
77	40	231.50	236.25	Boo
78	40	236.25	245.00	Her
79	39.75	138.75	143.75	Lyn
80	36.75	0.00	37.75	And
81	36.75	37.75	38.50	Per
82	36.5	290.25	291.00	Lyr
83	36	67.50	70.50	Per
84	36	326.00	328.25	Cyg
85	36	328.25	330.00	Lac
86	35.5	98.00	110.50	Aur
87	35.5	110.50	116.25	Lyn
88	35	0.00	30.00	And
89	35	330.00	342.25	Lac
90	34.5	342.25	343.00	Lac
91	34.5	343.00	352.50	And
92	34	38.50	40.75	Per
93	34	161.75	165.00	UMa
94	34	180.00	185.00	CVn
95	33.5	116.25	138.75	Lyn
96	33.5	138.75	148.25	LMi
97	33	10.75	21.00	And
98	33	227.75	231.50	Boo
99	32.083333	352.50	356.25	And
100	32	185.00	198.75	CVn
101	31.333333	356.25	360.00	And
102	30.75	209.25	210.50	CVn
103	30.666667	36.25	40.75	Tri
104	30.666667	40.75	67.50	Per
105	30	67.50	71.25	Aur
106	30	272.75	290.25	Lyr
107	29	165.00	180.00	UMa
108	29	295.00	313.75	Cyg
109	28.5	71.25	88.25	Aur
110	28.5	148.25	157.50	LMi
111	28.5	198.75	209.25	CVn
112	28	0.00	1.00	And
113	28	21.00	25.00	Tri
114	28	88.25	98.00	Aur
115	28	118.25	120.00	Gem
116	28	313.75	326.00	Cyg
117	27.5	288.75	295.00	Cyg
118	27.25	28.75	36.25	Tri
119	27	242.50	245.00	CrB
120	26	226.25	227.75	Boo
121	26	227.75	242.50	CrB
122	26	275.50	283.00	Lyr
123	25.5	161.25	165.00	LMi
124	25.5	283.00	288.75	Lyr
125	25	25.00	28.75	Tri
126	23.75	10.75	12.75	Psc
127	23.5	157.50	161.25	LMi
128	23.5	318.75	321.25	Vul
129	22.833333	85.50	88.25	Tau
130	22	1.00	2.25	And
131	22	238.75	240.50	Ser
132	21.5	88.25	93.25	Gem
133	21.25	297.50	303.75	Vul
134	21.083333	283.00	288.75	Vul
135	21	2.25	12.75	And
136	20.5	303.75	308.50	Vul
137	20	117.00	118.25	Gem
138	19.5	308.50	318.75	Vul
139	19.166667	288.75	297.50	Vul
140	19	49.25	50.50	Ari
141	18.5	283.00	285.00	Sge
142	18	85.50	86.50	Ori
143	17.5	93.25	94.50	Gem
144	16.166667	285.00	297.50	Sge
145	16	74.50	80.00	Tau
146	16	238.75	241.25	Her
147	15.75	297.50	303.75	Sge
148	15.5	69.25	74.50	Tau
149	15.5	80.00	84.00	Tau
150	15	192.50	202.50	Com
151	14.333333	258.75	273.75	Her
152	14	178.00	192.50	Com
153	13.5	112.50	117.00	Gem
154	12.833333	251.25	258.75	Her
155	12.5	0.00	2.25	Peg
156	12.5	84.00	86.50	Tau
157	12.5	105.00	112.50	Gem
158	12.5	316.75	320.00	Peg
159	12	94.50	104.00	Gem
160	12	273.75	283.00	Her
161	11.833333	313.25	315.75	Del
162	11.833333	315.75	316.75	Peg
163	11	172.75	178.00	Leo
164	10	93.75	94.50	Ori
165	10	104.00	105.00	Gem
166	10	117.00	119.00	Cnc
167	10	357.50	360.00	Peg
168	9.916667	25.00	49.25	Ari
169	8.5	302.25	304.50	Del
170	8	202.50	226.25	Boo
171	7.5	341.25	357.50	Peg
172	7	119.00	138.75	Cnc
173	7	138.75	161.25	Leo
174	6.25	273.75	280.00	Oph
175	6.25	280.00	283.00	Aql
176	6	312.50	313.25	Del
177	5.5	105.00	105.25	CMi
178	4.5	273.75	276.50	Ser
179	4	241.25	251.25	Her
180	3	273.75	276.50	Oph
181	2.75	322.00	325.00	Peg
182	2	0.00	30.00	Psc
183	2	278.75	283.00	Ser
184	2	304.50	312.50	Del
185	2	312.50	320.00	Equ
186	2	320.00	322.00	Peg
187	2	330.00	341.25	Peg
188	1.75	325.00	330.00	Peg
189	1.5	105.25	108.00	CMi
190	0	53.75	69.25	Tau
191	0	69.25	70.00	Ori
192	0	108.00	121.25	CMi
193	0	220.00	226.25	Vir
194	0	267.50	273.75	Oph
195	-1.75	39.75	49.25	Cet
196	-1.75	49.25	53.75	Tau
197	-3.25	226.25	244.00	Ser
198	-4	70.00	76.25	Ori
199	-4	87.50	93.75	Ori
200	-4	267.50	269.50	Ser
201	-4	273.75	278.75	Ser
202	-4	278.75	283.00	Aql
203	-4	341.25	357.50	Psc
204	-6	161.25	172.75	Leo
205	-6	172.75	177.50	Vir
206	-7	0.00	5.00	Psc
207	-7	357.50	360.00	Psc
208	-8	213.75	220.00	Vir
209	-8	238.75	244.00	Oph
210	-9	300.00	308.00	Aql
211	-9	320.00	328.00	Aqr
212	-10	257.50	269.50	Oph
213	-11	87.50	121.25	Mon
214	-11	73.75	76.25	Eri
215	-11	76.25	87.50	Ori
216	-11	121.25	125.50	Hya
217	-11	143.75	161.25	Sex
218	-11	177.50	192.50	Vir
219	-11.666667	263.75	265.00	Oph
220	-12.033333	283.00	300.00	Aql
221	-14.5	72.50	73.75	Eri
222	-15	308.00	320.00	Aqr
223	-16	257.50	273.75	Ser
224	-16	273.75	283.00	Sct
225	-17	125.50	128.75	Hya
226	-18.25	244.00	245.75	Oph
227	-19	128.75	136.25	Hya
228	-19	161.25	162.50	Crt
229	-19.25	244.00	245.75	Sco
230	-20	235.00	238.75	Lib
231	-22	188.75	192.50	Crv
232	-22	192.50	213.75	Vir
233	-24	136.25	146.25	Hya
234	-24.383333	25.00	39.75	Cet
235	-24.383333	39.75	56.25	Eri
236	-24.5	162.50	177.50	Crt
237	-24.5	177.50	188.75	Crv
238	-24.5	213.75	223.75	Lib
239	-24.583333	244.00	251.25	Oph
240	-25.5	0.00	25.00	Cet
241	-25.5	320.00	328.00	Cap
242	-25.5	328.00	357.50	Aqr
243	-25.5	357.50	360.00	Cet
244	-26.5	146.25	153.75	Hya
245	-27.25	70.50	72.50	Eri
246	-27.25	72.50	91.75	Lep
247	-28	300.00	320.00	Cap
248	-29.166667	153.75	158.75	Hya
249	-29.5	188.75	223.75	Hya
250	-29.5	223.75	235.00	Lib
251	-29.5	235.00	240.00	Sco
252	-30	68.75	70.50	Eri
253	-30	251.25	264.00	Oph
254	-30	264.00	267.50	Sgr
255	-31.166667	158.75	162.50	Hya
256	-33	91.75	110.50	CMa
257	-33	183.75	188.75	Hya
258	-35	162.50	183.75	Hya
259	-36	52.50	56.25	For
260	-36.75	125.50	140.50	Pyx
261	-37	64.00	68.75	Eri
262	-37	267.50	287.50	Sgr
263	-37	320.00	345.00	PsA
264	-37	345.00	350.00	Scl
265	-39.583333	45.00	52.50	For
266	-39.75	140.50	165.00	Ant
267	-40	0.00	25.00	Scl
268	-40	25.00	45.00	For
269	-40	58.00	64.00	Eri
270	-40	350.00	360.00	Scl
271	-42	212.50	223.75	Cen
272	-42	235.00	240.00	Lup
273	-42	240.00	246.25	Sco
274	-43	72.50	75.00	Cae
275	-43	75.00	98.75	Col
276	-43	120.00	125.50	Pup
277	-44	51.25	58.00	Eri
278	-45.5	246.25	267.50	Sco
279	-45.5	267.50	287.50	CrA
280	-45.5	287.50	305.00	Sgr
281	-45.5	305.00	320.00	Mic
282	-46	45.00	51.25	Eri
283	-46.5	67.50	72.50	Cae
284	-48	230.00	235.00	Lup
285	-48.166667	0.00	35.00	Phe
286	-49	40.00	45.00	Eri
287	-49	61.25	64.00	Hor
288	-49	64.00	67.50	Cae
289	-50	320.00	330.00	Gru
290	-50.75	90.00	120.00	Pup
291	-50.75	120.00	122.50	Vel
292	-51	36.25	40.00	Eri
293	-51	57.50	61.25	Hor
294	-51.5	0.00	27.50	Phe
295	-52.5	90.00	92.50	Car
296	-53	122.50	126.75	Vel
297	-53.166667	52.50	57.50	Hor
298	-53.166667	57.50	60.00	Dor
299	-53.5	0.00	23.75	Phe
300	-54	32.50	36.25	Eri
301	-54	67.50	75.00	Pic
302	-54	225.75	230.00	Lup
303	-54.5	126.75	132.50	Vel
304	-55	92.50	97.50	Car
305	-55	177.50	192.50	Cen
306	-55	212.50	225.75	Lup
307	-55	225.75	230.00	Nor
308	-56.5	60.00	65.00	Dor
309	-56.5	132.50	165.00	Vel
310	-56.5	165.00	168.75	Cen
311	-57	262.50	270.00	Ara
312	-57	270.00	305.00	Tel
313	-57	330.00	350.00	Gru
314	-57.5	48.00	52.50	Hor
315	-57.5	75.00	82.50	Pic
316	-58	97.50	102.50	Car
317	-58.5	0.00	20.00	Phe
318	-58.5	20.00	32.50	Eri
319	-58.5	350.00	360.00	Phe
320	-59	65.00	68.75	Dor
321	-60	230.00	246.25	Nor
322	-60	305.00	320.00	Ind
323	-61	82.50	90.00	Pic
324	-61	227.50	230.00	Cir
325	-61	246.25	248.75	Ara
326	-63.583333	223.75	227.50	Cir
327	-63.583333	248.75	251.25	Ara
328	-64	90.00	102.50	Pic
329	-64	102.50	135.50	Car
330	-64	168.75	177.50	Cen
331	-64	177.50	192.50	Cru
332	-64	192.50	218.00	Cen
333	-65	202.50	205.00	Cir
334	-65	251.25	252.50	Ara
335	-67.5	32.50	48.00	Hor
336	-67.5	48.00	68.75	Ret
337	-67.5	221.25	223.75	Cir
338	-67.5	252.50	262.50	Ara
339	-67.5	262.50	270.00	Pav
340	-67.5	330.00	350.00	Tuc
341	-70	68.75	98.75	Dor
342	-70	205.00	221.25	Cir
343	-70	221.25	255.00	TrA
344	-75	0.00	20.00	Tuc
345	-75	52.50	68.75	Hyi
346	-75	98.75	135.50	Vol
347	-75	135.50	168.75	Car
348	-75	168.75	205.00	Mus
349	-75	270.00	320.00	Pav
350	-75	320.00	350.00	Ind
351	-75	350.00	360.00	Tuc
352	-76	11.25	20.00	Tuc
353	-82.5	0.00	52.50	Hyi
354	-82.5	115.00	205.00	Cha
355	-82.5	205.00	270.00	Aps
356	-85	52.50	115.00	Men
357	-90	0.00	360.00	Oct
]=]
--[=[ 
Description of the algorithm

1. Search the rows downward until you find in column DE_low 
   the first number lower or equal to the given declination.
2. Check, if the given rectascension lies between 	RA_low and RA_up.
2.1. Case yes: Read in column "const" the abbrevation of the found constellation. (end of algorithm)
2.2. Case no: take the next row and repeat the check.
]=]

end

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.