From 10f363c48c96199a52d1709f33634bd00a0957b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Mon, 13 Apr 2026 09:49:19 +0200 Subject: [PATCH] =?UTF-8?q?Kometenanzeige=20verl=C3=A4ngert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/sternenhimmel.php | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/public/sternenhimmel.php b/public/sternenhimmel.php index e9991e8..9db6cf0 100644 --- a/public/sternenhimmel.php +++ b/public/sternenhimmel.php @@ -1658,16 +1658,14 @@ function cometRaDec(comet, date) { if (ra < 0) ra += 24; const dec = Math.asin(gz / dist) * (180 / Math.PI); - // Helligkeit schätzen (HG-Modell wie in comets.py) + // Helligkeit + heliozentrische Distanz + const rH = Math.sqrt(xEq*xEq + yEq*yEq + zEq*zEq); let mag = null; - if (comet.H !== null && comet.G !== null) { - const rH = Math.sqrt(xEq*xEq + yEq*yEq + zEq*zEq); - if (rH > 0 && dist > 0) { - mag = comet.H + 5*Math.log10(dist) + 2.5*comet.G*Math.log10(rH); - } + if (comet.H !== null && comet.G !== null && rH > 0 && dist > 0) { + mag = comet.H + 5*Math.log10(dist) + 2.5*comet.G*Math.log10(rH); } - return { ra, dec, mag }; + return { ra, dec, mag, rH }; } function drawComets(date) { @@ -1693,7 +1691,8 @@ function drawComets(date) { tailAngle = Math.atan2(pt.y - sunPt.y, pt.x - sunPt.x); } } - const tailLen = 22; + // Schweifläng: sonnennah = lang, sonnenfern = kurz (20/rH AU, Bereich 6–55 px) + const tailLen = pos.rH > 0 ? Math.max(6, Math.min(55, 20 / pos.rH)) : 12; const tx = pt.x + Math.cos(tailAngle) * tailLen; const ty = pt.y + Math.sin(tailAngle) * tailLen; @@ -1731,7 +1730,7 @@ function drawComets(date) { ctx.fillStyle = 'rgba(240,217,144,0.90)'; ctx.textAlign = 'left'; ctx.textBaseline = 'middle'; - ctx.fillText(comet.name + magStr, pt.x + comaR * 2.5 + 4, pt.y - 6); + ctx.fillText(comet.name, pt.x + comaR * 2.5 + 4, pt.y - 6); } } }