diff --git a/config/rechtesystem.json b/config/rechtesystem.json index 3e54956..e1e679d 100644 --- a/config/rechtesystem.json +++ b/config/rechtesystem.json @@ -44,6 +44,10 @@ "label": "Planetensichtbarkeit", "menu_group": "Himmel & Planeten" }, + "astronomical_conversions.php": { + "label": "Astronomical Conversions", + "menu_group": "Himmel & Planeten" + }, "tcrb_lightcurve.php": { "label": "T CrB Lichtkurve", "menu_group": "Himmel & Planeten" @@ -112,6 +116,7 @@ "links": [ "moonphase.php", "planetensichtbarkeit.php", + "astronomical_conversions.php", "tcrb_lightcurve.php", "solarsystem.php", "jupitersystem.php", diff --git a/public/astronomical_conversions.php b/public/astronomical_conversions.php new file mode 100644 index 0000000..8ea5281 --- /dev/null +++ b/public/astronomical_conversions.php @@ -0,0 +1,752 @@ + + + + + +
+
+ + + +
+ +
+

Entfernungs-Umrechner

+ +
+
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+
+ +
+ + + +
+
+ +
+

Rotverschiebung (z)

+ +
+
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+
+ +
+ + + +
+
+ +
+

Zeit-Umrechner

+ +
+
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+
+ +
+ + + +
+
+
+ + + + + diff --git a/public/auth_helpers.php b/public/auth_helpers.php index d54d2a1..2218def 100644 --- a/public/auth_helpers.php +++ b/public/auth_helpers.php @@ -58,6 +58,7 @@ function manageablePublicPages(): array 'my_favorites.php' => 'Favoriten', 'moonphase.php' => 'Mondphase', 'planetensichtbarkeit.php' => 'Planetensichtbarkeit', + 'astronomical_conversions.php' => 'Astronomical Conversions', 'tcrb_lightcurve.php' => 'T CrB Lichtkurve', 'solarsystem.php' => 'Sonnensystem', 'jupitersystem.php' => 'Jupitersystem', diff --git a/public/header.php b/public/header.php index 54ab97d..a63fb47 100644 --- a/public/header.php +++ b/public/header.php @@ -120,6 +120,7 @@ $menuGroups = [ 'links' => [ ['href' => 'moonphase.php', 'label' => 'Mondphase'], ['href' => 'planetensichtbarkeit.php', 'label' => 'Planetensichtbarkeit'], + ['href' => 'astronomical_conversions.php', 'label' => 'Astronomical Conversions'], ['href' => 'tcrb_lightcurve.php', 'label' => 'T CrB Lichtkurve'], ['href' => 'solarsystem.php', 'label' => 'Sonnensystem'], ['href' => 'jupitersystem.php', 'label' => 'Jupitersystem'], diff --git a/public/js/number_to_german_words.js b/public/js/number_to_german_words.js new file mode 100644 index 0000000..024a63c --- /dev/null +++ b/public/js/number_to_german_words.js @@ -0,0 +1,118 @@ +(function (global) { + const ONES = ['', 'eins', 'zwei', 'drei', 'vier', 'fuenf', 'sechs', 'sieben', 'acht', 'neun']; + const ONES_COMPOUND = ['', 'ein', 'zwei', 'drei', 'vier', 'fuenf', 'sechs', 'sieben', 'acht', 'neun']; + const TEENS = ['zehn', 'elf', 'zwoelf', 'dreizehn', 'vierzehn', 'fuenfzehn', 'sechzehn', 'siebzehn', 'achtzehn', 'neunzehn']; + const TENS = ['', '', 'zwanzig', 'dreissig', 'vierzig', 'fuenfzig', 'sechzig', 'siebzig', 'achtzig', 'neunzig']; + const SCALES = [ + { singular: '', plural: '', join: true }, + { singular: 'Tausend', plural: 'Tausend', join: true }, + { singular: 'Million', plural: 'Millionen', join: false }, + { singular: 'Milliarde', plural: 'Milliarden', join: false }, + { singular: 'Billion', plural: 'Billionen', join: false } + ]; + const GROUP_NUMBER_FORMATTER = new Intl.NumberFormat('de-DE'); + + function chunkToWords(value) { + if (value === 0) { + return ''; + } + + if (value === 1) { + return 'eins'; + } + + let text = ''; + const hundreds = Math.floor(value / 100); + const remainder = value % 100; + + if (hundreds > 0) { + text += (hundreds === 1 ? 'ein' : ONES_COMPOUND[hundreds]) + 'hundert'; + } + + if (remainder > 0) { + if (remainder < 10) { + text += ONES[remainder]; + } else if (remainder < 20) { + text += TEENS[remainder - 10]; + } else { + const ones = remainder % 10; + const tens = Math.floor(remainder / 10); + if (ones > 0) { + text += ONES_COMPOUND[ones] + 'und'; + } + text += TENS[tens]; + } + } + + return text; + } + + function integerToWords(value) { + if (!Number.isFinite(value)) { + return ''; + } + + if (value === 0) { + return 'null'; + } + + let number = Math.floor(Math.abs(value)); + const groups = []; + + while (number > 0) { + groups.push(number % 1000); + number = Math.floor(number / 1000); + } + + const parts = []; + + for (let i = groups.length - 1; i >= 0; i -= 1) { + const groupValue = groups[i]; + if (groupValue === 0) { + continue; + } + + const scale = SCALES[i] || { singular: '', plural: '', join: false }; + if (i >= 2) { + const scaleLabel = groupValue === 1 ? scale.singular : scale.plural; + const prefix = groupValue === 1 ? 'eine' : GROUP_NUMBER_FORMATTER.format(groupValue); + parts.push(prefix + ' ' + scaleLabel); + } else if (i === 1) { + parts.push(GROUP_NUMBER_FORMATTER.format(groupValue) + ' ' + scale.singular); + } else { + parts.push(GROUP_NUMBER_FORMATTER.format(groupValue)); + } + } + + const result = parts.join('\n'); + return value < 0 ? 'minus ' + result : result; + } + + function numberToGermanText(value) { + if (!Number.isFinite(value)) { + return ''; + } + + const integerPart = Math.trunc(value); + const fractionalPart = Math.abs(value - integerPart); + const integerText = integerToWords(integerPart); + + if (fractionalPart < 1e-10) { + return integerText; + } + + const decimalDigits = fractionalPart + .toFixed(10) + .replace(/^0\./, '') + .replace(/0+$/, '') + .split('') + .map(function (digit) { + return ['null', 'eins', 'zwei', 'drei', 'vier', 'fuenf', 'sechs', 'sieben', 'acht', 'neun'][Number(digit)]; + }) + .join(' '); + + return integerText + '\nKomma ' + decimalDigits; + } + + global.numberToGermanText = numberToGermanText; +})(window); diff --git a/todo.md b/todo.md index dcb4cd0..fd27c66 100644 --- a/todo.md +++ b/todo.md @@ -3,4 +3,30 @@ - Hesiodusstrahl als eigenes Mondlichtphaenomen fuer die Monatsvorschau ergaenzen - Radiant in die Monatsübersicht - Kometen in die Monatsübersicht -- Kleinplaneten rein (Favoriten!) \ No newline at end of file +- Kleinplaneten rein (Favoriten!) + +Winkel +Grad, Bogenminute, Bogensekunde, Radiant + +Rektaszension / Deklination +Stunden hh:mm:ss in Grad und zurück, Deklination dd:mm:ss + + + +Magnitude / Helligkeit +Magnitudendifferenz in Helligkeitsfaktor und zurück + +Teleskop +Öffnung, Brennweite, Öffnungsverhältnis (f/), Vergrößerung, Austrittspupille, Gesichtsfeld + +Wellenlänge / Frequenz / Energie +nm, Å, Hz, eV + +Temperatur +Kelvin, Celsius, Fahrenheit + +Größe bei gegebener Entfernung +scheinbarer Winkel in reale Größe und zurück + +Geschwindigkeit / Raumfahrt +km/s, AE/Tag, Prozent von c \ No newline at end of file