Bedingungen
🌑
Mondalter: -
Beleuchtung: -%
📍 Standort: Berlin
📅 Datum:
🌫️ Bortle: -
👁️ Seeing: -
☁️ Bewölkung: -
🌧️ Regenwahrscheinlichkeit: -
Bitte immer vorab die örtlichen Gegebenheiten prüfen. Bäume oder Gebäude können die Sichtbarkeit einschränken.
// Klick auf Objekte
document.querySelectorAll(".astro-item").forEach(el=>{
el.addEventListener("click", ()=>{
const obj = objects.find(o=>o.id===el.dataset.id);
setObject(obj);
});
});
// LOCATION + DATE BUTTON
document.getElementById("locBtn").addEventListener("click", async ()=>{
const place = document.getElementById("locationInput").value;
const dateVal = document.getElementById("dateInput").value;
const res = await fetch(`https://nominatim.openstreetmap.org/search?format=json&q=${place}`);
const data = await res.json();
if(!data.length){ alert("Ort nicht gefunden"); return; }
observer.lat = parseFloat(data[0].lat);
observer.lon = parseFloat(data[0].lon);
document.getElementById("locationName").innerText = place;
if(dateVal){ currentDate = new Date(dateVal); }
document.getElementById("currentDate").innerText = currentDate.toLocaleDateString();
const obj = objects.find(o => document.querySelector(".astro-item.active").dataset.id===o.id);
if(obj) updateChart(obj);
updateMoon();
});
// CHART.JS
const ctx = document.getElementById("chart").getContext("2d");
let chart = new Chart(ctx,{
type:'line',
data:{
labels:[],
datasets:[]
},
options:{
responsive: true,
plugins:{
title:{
display: true,
text: 'Objekthöhe',
font:{ size:16 }
},
legend:{
display: true,
position: 'bottom',
align: 'center',
labels:{
usePointStyle: true,
pointStyle: 'line', // 🔹 statt Kästchen → Linie
boxWidth: 40
}
}
},
elements:{
line:{
borderWidth: 2
},
point:{
radius: 0 // 🔹 keine Punkte → nur Linien
}
},
scales:{
y:{
max:90,
min:0,
title:{display:true,text:'Höhe [°]'}
},
x:{
title:{display:true,text:'Zeit'}
}
}
}
});
// BERECHNUNG DER HÖHE
function updateChart(obj){
const hours = Array.from({length:24},(_,i)=>i);
const altitude = hours.map(h=>{
const date = new Date(currentDate.getTime());
date.setHours(h);
const JD = (date/86400000) + 2440587.5;
const GMST = (280.46061837 + 360.98564736629*(JD - 2451545) + observer.lon) % 360;
const HA = ((GMST - obj.ra + 360) % 360) * Math.PI/180;
return Math.asin(Math.sin(observer.lat*Math.PI/180)*Math.sin(obj.dec*Math.PI/180) +
Math.cos(observer.lat*Math.PI/180)*Math.cos(obj.dec*Math.PI/180)*Math.cos(HA)) * 180/Math.PI;
});
const moonRA = 134.688, moonDec = 13.768;
const moon = hours.map(h=>{
const date = new Date(currentDate.getTime());
date.setHours(h);
const JD = (date/86400000) + 2440587.5;
const GMST = (280.46061837 + 360.98564736629*(JD - 2451545) + observer.lon) % 360;
const HA = ((GMST - moonRA + 360) % 360) * Math.PI/180;
return Math.asin(Math.sin(observer.lat*Math.PI/180)*Math.sin(moonDec*Math.PI/180) +
Math.cos(observer.lat*Math.PI/180)*Math.cos(moonDec*Math.PI/180)*Math.cos(HA)) * 180/Math.PI;
});
chart.data.labels = hours.map(h=>`${h}:00`);
chart.data.datasets = [
{label: obj.label, data: altitude, borderColor:'#4da3ff', fill:false},
{label: 'Mond', data: moon, borderColor:'#ff6600', fill:false}
];
chart.update();
updateMoon();
}
// MOND
const icons = ["🌑","🌒","🌓","🌔","🌕","🌖","🌗","🌘"];
function updateMoon(){
const synodicMonth = 29.53058867;
const newMoon = new Date(Date.UTC(2000,0,6,18,14));
const age = (currentDate - newMoon)/86400000 % synodicMonth;
const illum = (1 - Math.cos((age/synodicMonth)*2*Math.PI))/2;
document.getElementById("moonAge").innerText = `Mondalter: ${age.toFixed(1)} Tage`;
document.getElementById("moonIllum").innerText = `Beleuchtung: ${(illum*100).toFixed(0)}%`;
// 🔹 Emoji nach Alter wählen
const index = Math.floor(age / synodicMonth * 8);
document.getElementById("moonIcon").innerText = icons[index % 8];
}
// SENSOR FRAME (Advanced Planning)
function updateSensorFrame() {
const apAladinDiv = document.getElementById("apAladin");
apAladinDiv.innerHTML="";
const obj = objects.find(o=>document.querySelector(".astro-item.active").dataset.id===o.id);
if(!obj) return;
const focal = parseFloat(document.getElementById("focalLength").value);
const pixel = parseFloat(document.getElementById("pixelSize").value);
const sw = parseFloat(document.getElementById("sensorWidth").value);
const sh = parseFloat(document.getElementById("sensorHeight").value);
const rot = parseFloat(document.getElementById("rotation").value);
const fovX = (sw/focal)*57.2958*1.2;
const fovY = (sh/focal)*57.2958*1.2;
const res = (206.265*pixel)/focal;
document.getElementById("apOutput").innerText = `Theoretische Auflösung: ${res.toFixed(2)} arcsec\nFoV: ${fovX.toFixed(2)}° x ${fovY.toFixed(2)}°`;
const apAladinMap = A.aladin('#apAladin',{survey:"P/DSS2/color", fov: Math.max(fovX,fovY)*1.1, target:`${obj.ra} ${obj.dec}`, showReticle:false, showLayersControl:false, showCooGridControl:false, showGotoControl:false, showFullscreenControl:false, showZoomControl:false, mouseWheelZoom:false});
const frame = document.getElementById("sensorFrame");
const containerRatio = apAladinDiv.clientWidth / apAladinDiv.clientHeight;
const sensorRatio = fovX / fovY;
let scaleX, scaleY;
if(sensorRatio > containerRatio){ scaleX = 80; scaleY = 80 / sensorRatio * containerRatio; } else { scaleY = 80; scaleX = 80 * sensorRatio / containerRatio; }
frame.style.width = scaleX+"%";
frame.style.height = scaleY+"%";
frame.style.transform = `translate(-50%,-50%) rotate(${rot}deg)`;
apAladinDiv.style.pointerEvents = "auto";
}
// Enter-Taste Update
document.querySelectorAll('#advancedPlanning input').forEach(input=>{
input.addEventListener('keydown', (e)=>{ if(e.key==='Enter') updateSensorFrame(); });
});
// Initial render
updateMoon();
updateSensorFrame();