diff --git a/plugin/contents/ui/constellation-art/LICENSE.md b/plugin/contents/ui/constellation-art/LICENSE.md new file mode 100644 index 0000000..dafcb4e --- /dev/null +++ b/plugin/contents/ui/constellation-art/LICENSE.md @@ -0,0 +1,11 @@ +# Stellarium Modern constellation illustrations + +The twelve PNG illustrations in this directory are taken from the +[Stellarium Modern sky culture](https://github.com/Stellarium/stellarium/tree/master/skycultures/modern/illustrations). + +The Stellarium sky-culture description licenses the illustrations under the +[Free Art License 1.3](https://artlibre.org/licence/lal/en/). + +The images are redistributed here with their original names and are rendered +with an affine transformation so their three Hipparcos anchor stars remain +aligned with the simulated sky. diff --git a/plugin/contents/ui/constellation-art/aquarius.png b/plugin/contents/ui/constellation-art/aquarius.png new file mode 100644 index 0000000..025dc01 Binary files /dev/null and b/plugin/contents/ui/constellation-art/aquarius.png differ diff --git a/plugin/contents/ui/constellation-art/aries.png b/plugin/contents/ui/constellation-art/aries.png new file mode 100644 index 0000000..53acad7 Binary files /dev/null and b/plugin/contents/ui/constellation-art/aries.png differ diff --git a/plugin/contents/ui/constellation-art/cancer.png b/plugin/contents/ui/constellation-art/cancer.png new file mode 100644 index 0000000..c8a7b7c Binary files /dev/null and b/plugin/contents/ui/constellation-art/cancer.png differ diff --git a/plugin/contents/ui/constellation-art/capricornus.png b/plugin/contents/ui/constellation-art/capricornus.png new file mode 100644 index 0000000..45e6711 Binary files /dev/null and b/plugin/contents/ui/constellation-art/capricornus.png differ diff --git a/plugin/contents/ui/constellation-art/gemini.png b/plugin/contents/ui/constellation-art/gemini.png new file mode 100644 index 0000000..ad355cd Binary files /dev/null and b/plugin/contents/ui/constellation-art/gemini.png differ diff --git a/plugin/contents/ui/constellation-art/leo.png b/plugin/contents/ui/constellation-art/leo.png new file mode 100644 index 0000000..80abe97 Binary files /dev/null and b/plugin/contents/ui/constellation-art/leo.png differ diff --git a/plugin/contents/ui/constellation-art/libra.png b/plugin/contents/ui/constellation-art/libra.png new file mode 100644 index 0000000..93ff885 Binary files /dev/null and b/plugin/contents/ui/constellation-art/libra.png differ diff --git a/plugin/contents/ui/constellation-art/pisces.png b/plugin/contents/ui/constellation-art/pisces.png new file mode 100644 index 0000000..8570c22 Binary files /dev/null and b/plugin/contents/ui/constellation-art/pisces.png differ diff --git a/plugin/contents/ui/constellation-art/sagittarius.png b/plugin/contents/ui/constellation-art/sagittarius.png new file mode 100644 index 0000000..7b1faee Binary files /dev/null and b/plugin/contents/ui/constellation-art/sagittarius.png differ diff --git a/plugin/contents/ui/constellation-art/scorpius.png b/plugin/contents/ui/constellation-art/scorpius.png new file mode 100644 index 0000000..9a50e22 Binary files /dev/null and b/plugin/contents/ui/constellation-art/scorpius.png differ diff --git a/plugin/contents/ui/constellation-art/taurus.png b/plugin/contents/ui/constellation-art/taurus.png new file mode 100644 index 0000000..323b0b5 Binary files /dev/null and b/plugin/contents/ui/constellation-art/taurus.png differ diff --git a/plugin/contents/ui/constellation-art/virgo.png b/plugin/contents/ui/constellation-art/virgo.png new file mode 100644 index 0000000..f2b6b4c Binary files /dev/null and b/plugin/contents/ui/constellation-art/virgo.png differ diff --git a/plugin/contents/ui/constellations.js b/plugin/contents/ui/constellations.js index 0204c22..8093c6a 100644 --- a/plugin/contents/ui/constellations.js +++ b/plugin/contents/ui/constellations.js @@ -22,4 +22,4 @@ AND ANY EXPRESS OR IMPLIED WARRANTIES ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE. */ -const CONSTELLATIONS=[{"id":"Ari","name":"Áries","rank":1,"label":[42.0,22.0],"lines":[[[42.496,27.2605],[31.7934,23.4624],[28.66,20.808],[28.3826,19.2939]]]},{"id":"Tau","name":"Touro","rank":1,"label":[54.0,15.0],"lines":[[[81.573,28.6075],[70.5613,22.9569],[67.1542,19.1804]],[[68.9802,16.5093],[84.4112,21.1425]],[[64.9483,15.6276],[65.7337,17.5425]],[[64.9483,15.6276],[60.1701,12.4903],[51.2033,9.0289]],[[68.9802,16.5093],[67.1542,19.1804]],[[68.9802,16.5093],[67.1656,15.8709],[64.9483,15.6276]],[[67.1542,19.1804],[66.3724,17.9279],[65.7337,17.5425],[57.2906,24.0534]]]},{"id":"Gem","name":"Gêmeos","rank":1,"label":[107.25,23.5],"lines":[[[99.4279,16.3993],[106.0272,20.5703],[110.0307,21.9823],[109.5232,16.5404],[101.3224,12.8956]],[[110.0307,21.9823],[113.9806,26.8957],[116.1119,24.398]],[[113.9806,26.8957],[116.329,28.0262]],[[113.9806,26.8957],[111.4317,27.7981],[107.7849,30.2452],[113.6494,31.8883]],[[107.7849,30.2452],[103.1972,33.9613]],[[107.7849,30.2452],[100.983,25.1311],[97.2408,20.2121]],[[100.983,25.1311],[95.7401,22.5136],[93.7194,22.5068],[91.0301,23.2633]]]},{"id":"Cnc","name":"Câncer","rank":2,"label":[128.25,27.0],"lines":[[[131.6743,28.7599],[130.8214,21.4685],[125.0161,27.2177]],[[130.8214,21.4685],[131.1712,18.1543],[124.1288,9.1855]],[[131.1712,18.1543],[134.6218,11.8577]]]},{"id":"Leo","name":"Leão","rank":1,"label":[159.0,15.0],"lines":[[[177.2649,14.5721],[168.56,15.4296],[152.093,11.9672],[151.8331,16.7627],[154.9931,19.8415],[168.5271,20.5237],[177.2649,14.5721]],[[154.9931,19.8415],[154.1726,23.4173],[148.1909,26.007],[146.4628,23.7743]],[[168.5271,20.5237],[168.56,15.4296]]]},{"id":"Vir","name":"Virgem","rank":1,"label":[-160.5,-4.0],"lines":[[[176.4648,6.5294],[-175.0235,-0.6668],[-169.5848,-1.4494],[-158.7018,-11.1613],[-146.7761,-10.2737],[-145.9964,-6.0005],[-139.2349,-5.6582]],[[-158.7018,-11.1613],[-156.3267,-0.5958],[-149.5884,1.5445],[-138.4378,1.8929]],[[-156.3267,-0.5958],[-166.0991,3.3975],[-164.4558,10.9592]],[[-166.0991,3.3975],[-169.5848,-1.4494]]]},{"id":"Lib","name":"Libra","rank":2,"label":[-129.0,-26.0],"lines":[[[-121.5436,-16.7293],[-126.1184,-14.7895],[-130.7483,-9.3829],[-137.2804,-16.0418],[-133.9824,-25.282],[-126.1184,-14.7895]]]},{"id":"Sco","name":"Escorpião","rank":1,"label":[-111.0,-38.0],"lines":[[[-96.5978,-37.1038],[-94.378,-39.03],[-93.1038,-40.127],[-95.6703,-42.9978],[-101.9617,-43.2392],[-106.5011,-42.362],[-107.0324,-38.0474],[-107.4591,-34.2932],[-111.0294,-28.216],[-112.6481,-26.432],[-119.9166,-22.6217]],[[-112.6481,-26.432],[-120.287,-26.1141]],[[-112.6481,-26.432],[-118.6407,-19.8055]]]},{"id":"Sgr","name":"Sagitário","rank":1,"label":[-67.5,-34.0],"lines":[[[-84.7515,-29.8281],[-83.0073,-25.4217]],[[-85.5932,-36.7617],[-83.957,-34.3846],[-88.548,-30.4241],[-93.1099,-27.8308]],[[-88.548,-30.4241],[-84.7515,-29.8281],[-83.957,-34.3846],[-74.347,-29.8801],[-78.5859,-26.9908],[-84.7515,-29.8281]],[[-78.5859,-26.9908],[-83.0073,-25.4217],[-86.5591,-21.0588]],[[-74.347,-29.8801],[-73.265,-27.6704],[-76.1836,-26.2967],[-78.5859,-26.9908]],[[-76.1836,-26.2967],[-75.5675,-21.1067],[-73.8292,-21.7415],[-70.5913,-18.9529],[-69.5818,-17.8472]],[[-73.265,-27.6704],[-65.9931,-24.7191],[-59.3355,-27.7098],[-60.0659,-35.2763],[-61.1846,-41.8683],[-69.0284,-40.6159]],[[-61.1846,-41.8683],[-69.1953,-44.7998]]]},{"id":"Cap","name":"Capricórnio","rank":2,"label":[-45.0,-22.0],"lines":[[[-55.4864,-12.5449],[-54.7472,-14.7814],[-43.5132,-17.2329],[-39.4383,-16.8345],[-34.9773,-16.6623],[-33.2398,-16.1273]],[[-39.4383,-16.8345],[-38.3332,-22.4113],[-43.5132,-17.2329]],[[-54.7472,-14.7814],[-48.4761,-25.2709]],[[-43.5132,-17.2329],[-47.0446,-26.9191]]]},{"id":"Aqr","name":"Aquário","rank":2,"label":[-22.5,-5.0],"lines":[[[-37.1103,-5.5712],[-28.554,-0.3199],[-24.5859,-1.3873],[-22.792,-0.02],[-21.1609,-0.1175],[-16.8464,-7.5796],[-11.0271,-9.0877],[-9.2574,-20.1006]],[[-28.554,-0.3199],[-25.7915,-7.7833],[-28.3907,-13.8697]],[[-25.7915,-7.7833],[-22.3383,-10.678],[-17.6021,-13.5926],[-16.3374,-15.8208],[-12.6383,-21.1724]],[[-48.081,-9.4958],[-37.1103,-5.5712]]]},{"id":"Psc","name":"Peixes","rank":2,"label":[19.5,15.0],"lines":[[[15.7046,31.8043],[18.4373,24.5837]],[[15.7046,31.8043],[19.8666,27.2641],[18.4373,24.5837],[22.8709,15.3458],[26.3485,9.1577],[30.5118,2.7638],[28.389,3.1875],[25.3579,5.4876],[22.5463,6.1438],[15.7359,7.8901],[12.0725,7.2999],[5.1494,8.1903],[-0.1721,6.8633],[-5.0123,5.6263],[-3.402,3.4868],[-4.4883,1.78],[-8.2669,1.2556],[-10.7086,3.2823],[-9.9142,5.3813],[-8.0079,6.379],[-5.0123,5.6263]]]}]; +const CONSTELLATIONS=[{"id":"Ari","name":"Áries","rank":1,"label":[42.0,22.0],"lines":[[[42.496,27.2605],[31.7934,23.4624],[28.66,20.808],[28.3826,19.2939]]],"art":{"file":"constellation-art/aries.png","size":[256,256],"anchors":[{"pos":[12,130],"sky":[42.496,27.2605]},{"pos":[58,206],"sky":[44.803,21.3404]},{"pos":[210,47],"sky":[28.3826,19.2939]}]}},{"id":"Tau","name":"Touro","rank":1,"label":[54.0,15.0],"lines":[[[81.573,28.6075],[70.5613,22.9569],[67.1542,19.1804]],[[68.9802,16.5093],[84.4112,21.1425]],[[64.9483,15.6276],[65.7337,17.5425]],[[64.9483,15.6276],[60.1701,12.4903],[51.2033,9.0289]],[[68.9802,16.5093],[67.1542,19.1804]],[[68.9802,16.5093],[67.1656,15.8709],[64.9483,15.6276]],[[67.1542,19.1804],[66.3724,17.9279],[65.7337,17.5425],[57.2906,24.0534]]],"art":{"file":"constellation-art/taurus.png","size":[512,512],"anchors":[{"pos":[13,92],"sky":[84.4112,21.1425]},{"pos":[399,438],"sky":[51.2033,9.0289]},{"pos":[382,192],"sky":[57.7184,23.9615]}]}},{"id":"Gem","name":"Gêmeos","rank":1,"label":[107.25,23.5],"lines":[[[99.4279,16.3993],[106.0272,20.5703],[110.0307,21.9823],[109.5232,16.5404],[101.3224,12.8956]],[[110.0307,21.9823],[113.9806,26.8957],[116.1119,24.398]],[[113.9806,26.8957],[116.329,28.0262]],[[113.9806,26.8957],[111.4317,27.7981],[107.7849,30.2452],[113.6494,31.8883]],[[107.7849,30.2452],[103.1972,33.9613]],[[107.7849,30.2452],[100.983,25.1311],[97.2408,20.2121]],[[100.983,25.1311],[95.7401,22.5136],[93.7194,22.5068],[91.0301,23.2633]]],"art":{"file":"constellation-art/gemini.png","size":[256,256],"anchors":[{"pos":[14,81],"sky":[116.1119,24.398]},{"pos":[117,252],"sky":[101.3224,12.8956]},{"pos":[249,165],"sky":[91.0301,23.2633]}]}},{"id":"Cnc","name":"Câncer","rank":2,"label":[128.25,27.0],"lines":[[[131.6743,28.7599],[130.8214,21.4685],[125.0161,27.2177]],[[130.8214,21.4685],[131.1712,18.1543],[124.1288,9.1855]],[[131.1712,18.1543],[134.6218,11.8577]]],"art":{"file":"constellation-art/cancer.png","size":[256,256],"anchors":[{"pos":[29,166],"sky":[134.6218,11.8577]},{"pos":[101,255],"sky":[124.1288,9.1855]},{"pos":[206,91],"sky":[125.0161,27.2177]}]}},{"id":"Leo","name":"Leão","rank":1,"label":[159.0,15.0],"lines":[[[177.2649,14.5721],[168.56,15.4296],[152.093,11.9672],[151.8331,16.7627],[154.9931,19.8415],[168.5271,20.5237],[177.2649,14.5721]],[[154.9931,19.8415],[154.1726,23.4173],[148.1909,26.007],[146.4628,23.7743]],[[168.5271,20.5237],[168.56,15.4296]]],"art":{"file":"constellation-art/leo.png","size":[512,512],"anchors":[{"pos":[69,411],"sky":[177.2649,14.5721]},{"pos":[383,186],"sky":[152.093,11.9672]},{"pos":[321,32],"sky":[146.4628,23.7743]}]}},{"id":"Vir","name":"Virgem","rank":1,"label":[-160.5,-4.0],"lines":[[[176.4648,6.5294],[-175.0235,-0.6668],[-169.5848,-1.4494],[-158.7018,-11.1613],[-146.7761,-10.2737],[-145.9964,-6.0005],[-139.2349,-5.6582]],[[-158.7018,-11.1613],[-156.3267,-0.5958],[-149.5884,1.5445],[-138.4378,1.8929]],[[-156.3267,-0.5958],[-166.0991,3.3975],[-164.4558,10.9592]],[[-166.0991,3.3975],[-169.5848,-1.4494]]],"art":{"file":"constellation-art/virgo.png","size":[512,512],"anchors":[{"pos":[65,389],"sky":[-138.4378,1.8929]},{"pos":[454,57],"sky":[176.4648,6.5294]},{"pos":[338,382],"sky":[-158.7018,-11.1613]}]}},{"id":"Lib","name":"Libra","rank":2,"label":[-129.0,-26.0],"lines":[[[-121.5436,-16.7293],[-126.1184,-14.7895],[-130.7483,-9.3829],[-137.2804,-16.0418],[-133.9824,-25.282],[-126.1184,-14.7895]]],"art":{"file":"constellation-art/libra.png","size":[256,256],"anchors":[{"pos":[41,27],"sky":[-130.7483,-9.3829]},{"pos":[58,170],"sky":[-121.5436,-16.7293]},{"pos":[224,107],"sky":[-133.9824,-25.282]}]}},{"id":"Sco","name":"Escorpião","rank":1,"label":[-111.0,-38.0],"lines":[[[-96.5978,-37.1038],[-94.378,-39.03],[-93.1038,-40.127],[-95.6703,-42.9978],[-101.9617,-43.2392],[-106.5011,-42.362],[-107.0324,-38.0474],[-107.4591,-34.2932],[-111.0294,-28.216],[-112.6481,-26.432],[-119.9166,-22.6217]],[[-112.6481,-26.432],[-120.287,-26.1141]],[[-112.6481,-26.432],[-118.6407,-19.8055]]],"art":{"file":"constellation-art/scorpius.png","size":[512,512],"anchors":[{"pos":[447,29],"sky":[-118.6407,-19.8055]},{"pos":[62,365],"sky":[-96.5978,-37.1038]},{"pos":[217,462],"sky":[-106.3541,-42.3613]}]}},{"id":"Sgr","name":"Sagitário","rank":1,"label":[-67.5,-34.0],"lines":[[[-84.7515,-29.8281],[-83.0073,-25.4217]],[[-85.5932,-36.7617],[-83.957,-34.3846],[-88.548,-30.4241],[-93.1099,-27.8308]],[[-88.548,-30.4241],[-84.7515,-29.8281],[-83.957,-34.3846],[-74.347,-29.8801],[-78.5859,-26.9908],[-84.7515,-29.8281]],[[-78.5859,-26.9908],[-83.0073,-25.4217],[-86.5591,-21.0588]],[[-74.347,-29.8801],[-73.265,-27.6704],[-76.1836,-26.2967],[-78.5859,-26.9908]],[[-76.1836,-26.2967],[-75.5675,-21.1067],[-73.8292,-21.7415],[-70.5913,-18.9529],[-69.5818,-17.8472]],[[-73.265,-27.6704],[-65.9931,-24.7191],[-59.3355,-27.7098],[-60.0659,-35.2763],[-61.1846,-41.8683],[-69.0284,-40.6159]],[[-61.1846,-41.8683],[-69.1953,-44.7998]]],"art":{"file":"constellation-art/sagittarius.png","size":[512,512],"anchors":[{"pos":[96,82],"sky":[-69.5818,-17.8472]},{"pos":[307,492],"sky":[-69.1953,-44.7998]},{"pos":[506,100],"sky":[-93.1099,-27.8308]}]}},{"id":"Cap","name":"Capricórnio","rank":2,"label":[-45.0,-22.0],"lines":[[[-55.4864,-12.5449],[-54.7472,-14.7814],[-43.5132,-17.2329],[-39.4383,-16.8345],[-34.9773,-16.6623],[-33.2398,-16.1273]],[[-39.4383,-16.8345],[-38.3332,-22.4113],[-43.5132,-17.2329]],[[-54.7472,-14.7814],[-48.4761,-25.2709]],[[-43.5132,-17.2329],[-47.0446,-26.9191]]],"art":{"file":"constellation-art/capricornus.png","size":[512,512],"anchors":[{"pos":[15,436],"sky":[-33.2398,-16.1273]},{"pos":[403,7],"sky":[-55.4864,-12.5449]},{"pos":[460,438],"sky":[-47.0446,-26.9191]}]}},{"id":"Aqr","name":"Aquário","rank":2,"label":[-22.5,-5.0],"lines":[[[-37.1103,-5.5712],[-28.554,-0.3199],[-24.5859,-1.3873],[-22.792,-0.02],[-21.1609,-0.1175],[-16.8464,-7.5796],[-11.0271,-9.0877],[-9.2574,-20.1006]],[[-28.554,-0.3199],[-25.7915,-7.7833],[-28.3907,-13.8697]],[[-25.7915,-7.7833],[-22.3383,-10.678],[-17.6021,-13.5926],[-16.3374,-15.8208],[-12.6383,-21.1724]],[[-48.081,-9.4958],[-37.1103,-5.5712]]],"art":{"file":"constellation-art/aquarius.png","size":[512,512],"anchors":[{"pos":[144,464],"sky":[-9.2574,-20.1006]},{"pos":[179,98],"sky":[-28.554,-0.3199]},{"pos":[465,49],"sky":[-48.081,-9.4958]}]}},{"id":"Psc","name":"Peixes","rank":2,"label":[19.5,15.0],"lines":[[[15.7046,31.8043],[18.4373,24.5837]],[[15.7046,31.8043],[19.8666,27.2641],[18.4373,24.5837],[22.8709,15.3458],[26.3485,9.1577],[30.5118,2.7638],[28.389,3.1875],[25.3579,5.4876],[22.5463,6.1438],[15.7359,7.8901],[12.0725,7.2999],[5.1494,8.1903],[-0.1721,6.8633],[-5.0123,5.6263],[-3.402,3.4868],[-4.4883,1.78],[-8.2669,1.2556],[-10.7086,3.2823],[-9.9142,5.3813],[-8.0079,6.379],[-5.0123,5.6263]]],"art":{"file":"constellation-art/pisces.png","size":[512,512],"anchors":[{"pos":[24,104],"sky":[15.7046,31.8043]},{"pos":[111,489],"sky":[30.5118,2.7638]},{"pos":[481,155],"sky":[-10.7086,3.2823]}]}}]; diff --git a/plugin/contents/ui/dancer.html b/plugin/contents/ui/dancer.html index 07ac146..3d83afe 100644 --- a/plugin/contents/ui/dancer.html +++ b/plugin/contents/ui/dancer.html @@ -1219,6 +1219,17 @@ const ctx = canvas.getContext('2d'); let obsLat = -24.72, obsLon = -53.74; // Toledo-PR; sobrescrito pela config let showConstellations = false; +const constellationArtImages = new Map(); +if (typeof CONSTELLATIONS !== 'undefined') { + for (const constellation of CONSTELLATIONS) { + if (!constellation.art) continue; + const img = new Image(); + img.onload = () => projectSky(); + img.onerror = () => console.error('[skeledance] falha na arte de ' + constellation.name); + img.src = constellation.art.file; + constellationArtImages.set(constellation.id, img); + } +} const VIEW_AZ = 90; // centro da tela olha para o LESTE — a tela física do // usuário está voltada p/ leste, então o wallpaper age // como janela: estrelas nascem subindo dentro da cena @@ -1400,8 +1411,62 @@ function renderMilkyWay(lstDeg, glareOn) { return true; } +/* Resolve a transformação afim que prende três pixels da ilustração às suas + três estrelas Hipparcos projetadas. */ +function constellationArtTransform(source, target) { + const [p1, p2, p3] = source; + const [q1, q2, q3] = target; + const den = p1[0] * (p2[1] - p3[1]) + p2[0] * (p3[1] - p1[1]) + + p3[0] * (p1[1] - p2[1]); + if (Math.abs(den) < 1e-6) return null; + const solve = (v1, v2, v3) => ({ + x: (v1 * (p2[1] - p3[1]) + v2 * (p3[1] - p1[1]) + + v3 * (p1[1] - p2[1])) / den, + y: (v1 * (p3[0] - p2[0]) + v2 * (p1[0] - p3[0]) + + v3 * (p2[0] - p1[0])) / den, + t: (v1 * (p2[0] * p3[1] - p3[0] * p2[1]) + + v2 * (p3[0] * p1[1] - p1[0] * p3[1]) + + v3 * (p1[0] * p2[1] - p2[0] * p1[1])) / den, + }); + const x = solve(q1.x, q2.x, q3.x); + const y = solve(q1.y, q2.y, q3.y); + return [x.x, y.x, x.y, y.y, x.t, y.t]; +} + +function drawConstellationArt(c, constellation, lst, W, horizonPx) { + const art = constellation.art; + const img = constellationArtImages.get(constellation.id); + if (!art || !img || !img.complete || !img.naturalWidth) return; + + const target = art.anchors.map(anchor => { + const aa = altAz(anchor.sky[0], anchor.sky[1], lst); + const daz = ((aa.az - VIEW_AZ) % 360 + 540) % 360 - 180; + return { + x: (0.5 + daz / FOV_AZ) * W, + y: horizonPx * (1 - aa.alt / ALT_TOP), + alt: aa.alt, + }; + }); + if (target.every(p => p.alt < -8) || target.every(p => p.alt > ALT_TOP + 8)) return; + + const matrix = constellationArtTransform( + art.anchors.map(anchor => anchor.pos), target + ); + if (!matrix || matrix.some(v => !Number.isFinite(v))) return; + + c.save(); + c.beginPath(); + c.rect(0, 0, W, horizonPx); + c.clip(); + c.globalCompositeOperation = 'screen'; + c.globalAlpha = 0.19; + c.setTransform(...matrix); + c.drawImage(img, 0, 0, art.size[0], art.size[1]); + c.restore(); +} + /* Figuras convencionais dos 12 signos zodiacais, ancoradas em RA/Dec J2000. - São desenhadas antes das estrelas para os pontos reais ficarem por cima. */ + Arte, linhas e estrelas reais ficam sobrepostas nesta ordem. */ function drawConstellations(c, lst, W, H, horizonPx) { if (!showConstellations || typeof CONSTELLATIONS === 'undefined') return; const rankAlpha = [0, 0.52, 0.38, 0.25]; @@ -1412,6 +1477,9 @@ function drawConstellations(c, lst, W, H, horizonPx) { c.lineJoin = 'round'; c.shadowColor = 'rgba(60,185,255,0.65)'; c.shadowBlur = 7; + for (const constellation of CONSTELLATIONS) { + drawConstellationArt(c, constellation, lst, W, horizonPx); + } for (const constellation of CONSTELLATIONS) { const rank = Math.max(1, Math.min(3, constellation.rank || 3)); c.strokeStyle = `rgba(105,205,255,${rankAlpha[rank]})`; diff --git a/tools/build_constellations.py b/tools/build_constellations.py index 8e228fd..f36f9d9 100644 --- a/tools/build_constellations.py +++ b/tools/build_constellations.py @@ -68,7 +68,7 @@ def rounded_point(point: list[float]) -> list[float]: def main() -> None: sky_culture = fetch(STELLARIUM_URL) - star_data = fetch(D3_BASE + "stars.6.json")["features"] + star_data = fetch(D3_BASE + "stars.8.json")["features"] name_data = fetch(D3_BASE + "constellations.json")["features"] stars = { int(feature["id"]): rounded_point(feature["geometry"]["coordinates"]) @@ -93,12 +93,27 @@ def main() -> None: if missing: raise RuntimeError(f"{ident}: HIP ausente no catálogo: {missing}") lines.append([stars[hip] for hip in hip_line]) + image = constellation.get("image") + art = None + if image: + anchors = [] + for anchor in image["anchors"]: + hip = int(anchor["hip"]) + if hip not in stars: + raise RuntimeError(f"{ident}: âncora HIP ausente: {hip}") + anchors.append({"pos": anchor["pos"], "sky": stars[hip]}) + art = { + "file": "constellation-art/" + Path(image["file"]).name, + "size": image["size"], + "anchors": anchors, + } merged[ident] = { "id": ident, "name": ZODIAC[ident], "rank": 1 if ident in {"Ari", "Tau", "Gem", "Leo", "Vir", "Sco", "Sgr"} else 2, "label": metadata.get(ident, {}).get("label"), "lines": lines, + "art": art, } payload = json.dumps(