Quarter-globe dial, restore wedge shadow with gnomon base at its origin, center the clepsydra pointer on the drum

This commit is contained in:
zyphlar committed 2026-10-10 00:53:41 -07:00
1 parent 76635ff73a
commit 76bdd2db87
1 file changed
+30 -43
+30 -43
View File
@@ -156,7 +156,6 @@
.hit { stroke: transparent; stroke-width: 16; fill: none; pointer-events: stroke; cursor: pointer; -webkit-tap-highlight-color: transparent; } .hit { stroke: transparent; stroke-width: 16; fill: none; pointer-events: stroke; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.hit:focus { outline: none; } .hit:focus { outline: none; }
.horizon-line { stroke: var(--dial-line); stroke-width: 1; opacity: .6; } .horizon-line { stroke: var(--dial-line); stroke-width: 1; opacity: .6; }
.rod-shadow { stroke: var(--shadow-hand); stroke-width: 3.5; stroke-linecap: round; fill: none; filter: url(#soft); }
.curve-info { min-height: 2.6em; margin: 2px 8px 0; text-align: center; font-size: 13px; line-height: 1.35; color: var(--muted); } .curve-info { min-height: 2.6em; margin: 2px 8px 0; text-align: center; font-size: 13px; line-height: 1.35; color: var(--muted); }
.curve-info b { color: var(--text); font-weight: 600; } .curve-info b { color: var(--text); font-weight: 600; }
.drum-shade { pointer-events: none; } .drum-shade { pointer-events: none; }
@@ -351,46 +350,39 @@
</header> </header>
<div class="dial-wrap"> <div class="dial-wrap">
<svg id="sundial" viewBox="0 0 400 372" role="img" aria-labelledby="dialTitle"> <svg id="sundial" viewBox="0 0 400 240" role="img" aria-labelledby="dialTitle">
<title id="dialTitle">Spherical sundial</title> <title id="dialTitle">Spherical sundial</title>
<defs> <defs>
<filter id="soft" x="-20%" y="-20%" width="140%" height="140%"> <filter id="soft" x="-20%" y="-20%" width="140%" height="140%">
<feGaussianBlur stdDeviation="1.2"/> <feGaussianBlur stdDeviation="1.2"/>
</filter> </filter>
<linearGradient id="bowlGrad" x1="0" y1="0" x2="0" y2="1"> <radialGradient id="bowlGrad" cx="200" cy="150" r="190" gradientUnits="userSpaceOnUse">
<stop offset="0" class="g-rim"/> <stop offset="0" class="g-deep"/>
<stop offset=".45" class="g-rim" stop-opacity=".9"/> <stop offset="1" class="g-rim"/>
<stop offset="1" class="g-deep"/>
</linearGradient>
<radialGradient id="rimShade" cx=".5" cy=".5" r=".5">
<stop offset=".7" stop-color="#000" stop-opacity="0"/>
<stop offset="1" stop-color="#000" stop-opacity=".22"/>
</radialGradient> </radialGradient>
<radialGradient id="globeShade" cx=".38" cy=".3" r=".75"> <radialGradient id="globeShade" cx="200" cy="40" r="180" gradientUnits="userSpaceOnUse">
<stop offset="0" stop-color="#fff" stop-opacity=".18"/> <stop offset="0" stop-color="#fff" stop-opacity=".15"/>
<stop offset="1" stop-color="#000" stop-opacity=".18"/> <stop offset="1" stop-color="#000" stop-opacity=".2"/>
</radialGradient> </radialGradient>
</defs> </defs>
<!-- pedestal --> <!-- pedestal -->
<path class="stone-dark" d="M 112 362 L 120 348 H 280 L 288 362 Z"/> <path class="stone-dark" d="M 112 236 L 120 224 H 280 L 288 236 Z"/>
<path class="stone" d="M 136 348 L 150 330 H 250 L 264 348 Z"/> <path class="stone" d="M 136 224 L 150 208 H 250 L 264 224 Z"/>
<rect class="stone-dark" x="168" y="314" width="64" height="18" rx="4"/> <rect class="stone-dark" x="170" y="190" width="60" height="20" rx="4"/>
<!-- hollow globe, cut open on its equator-facing side --> <!-- the lower quarter of a hollow globe, cut level at its centre and open to the equator -->
<circle class="stone-top" cx="200" cy="166" r="157"/> <path class="stone-top" d="M 34 30 A 166 166 0 0 0 366 30 Z"/>
<circle fill="url(#globeShade)" cx="200" cy="166" r="157"/> <path fill="url(#globeShade)" d="M 34 30 A 166 166 0 0 0 366 30 Z"/>
<circle class="bowl" fill="url(#bowlGrad)" cx="200" cy="166" r="140"/> <path class="bowl" fill="url(#bowlGrad)" d="M 50 30 A 150 150 0 0 0 350 30 Z"/>
<circle fill="url(#rimShade)" cx="200" cy="166" r="140"/> <path class="stone-dark" d="M 32 27 H 368 V 31 H 32 Z"/>
<line class="horizon-line" x1="60" y1="166" x2="340" y2="166"/>
<g id="bands"></g> <g id="bands"></g>
<g id="dialLines"></g> <g id="dialLines"></g>
<path id="todayCurve" class="today"/> <path id="todayCurve" class="today"/>
<g id="numerals"></g> <g id="numerals"></g>
<path id="shadow" class="rod-shadow"/> <path id="shadow" class="shadow"/>
<circle id="tip" class="tip" r="3.5" cx="200" cy="166"/> <circle id="tip" class="tip" r="3.5" cx="200" cy="30"/>
<!-- gnomon hangs from the top of the opening; its tip is the centre of the sphere --> <!-- gnomon: its base sits where the shadow begins -->
<path class="bronze-dark" d="M 192 24 H 208 L 204 30 H 196 Z"/> <path class="bronze" d="M 197 30 L 203 30 L 201.5 52 L 198.5 52 Z"/>
<path class="bronze" d="M 198 28 H 202 L 201 166 H 199 Z"/> <circle class="bronze-dark" cx="200" cy="52" r="2.5"/>
<circle class="bronze-dark" cx="200" cy="166" r="3"/>
<g id="hits"></g> <g id="hits"></g>
</svg> </svg>
@@ -435,8 +427,8 @@
<rect class="bronze" x="158.5" y="214" width="3" height="156"/> <rect class="bronze" x="158.5" y="214" width="3" height="156"/>
<circle class="bronze" cx="160" cy="184" r="6"/> <circle class="bronze" cx="160" cy="184" r="6"/>
<path class="bronze" d="M 154 214 L 156 192 H 164 L 166 214 Z"/> <path class="bronze" d="M 154 214 L 156 192 H 164 L 166 214 Z"/>
<path class="bronze-line" stroke-width="2" d="M 162 198 L 262 200"/> <path class="bronze-line" stroke-width="2" d="M 162 198 L 284 200"/>
<circle class="tip" cx="262" cy="200" r="3"/> <circle class="tip" cx="284" cy="200" r="2.5"/>
</g> </g>
</svg> </svg>
</div> </div>
@@ -477,9 +469,9 @@
Romans split the daylight, from sunrise to sunset, into twelve equal Romans split the daylight, from sunrise to sunset, into twelve equal
<a href="https://en.wikipedia.org/wiki/Roman_timekeeping">horae</a>, and the night into twelve more, <a href="https://en.wikipedia.org/wiki/Roman_timekeeping">horae</a>, and the night into twelve more,
grouped into four watches (<i>vigiliae</i>). So an hour stretched in summer and shrank in winter. grouped into four watches (<i>vigiliae</i>). So an hour stretched in summer and shrank in winter.
By day this page draws a spherical sundial, a hollow stone globe cut open toward the equator, By day this page draws a spherical sundial: the lower quarter of a hollow stone globe, open toward the equator,
laid out for your latitude. A bronze gnomon hangs from the top of the opening to the centre of the sphere, laid out for your latitude. A bronze gnomon points out from the centre of its upper edge,
and its tip's shadow marks the hour. The three curves are the winter solstice (<i>bruma</i>), the and its shadow marks the hour. The three curves are the winter solstice (<i>bruma</i>), the
equinox (<i>aequinoctium</i>) and the summer solstice (<i>solstitium</i>); the dashed line is today's path. equinox (<i>aequinoctium</i>) and the summer solstice (<i>solstitium</i>); the dashed line is today's path.
By night, when a sundial is useless, it switches to the water clock of Ctesibius (Vitruvius IX.8): By night, when a sundial is useless, it switches to the water clock of Ctesibius (Vitruvius IX.8):
water drips at a steady rate into a cylinder, and a float lifts a figure whose wand points to the hour water drips at a steady rate into a cylinder, and a float lifts a figure whose wand points to the hour
@@ -577,7 +569,7 @@
// of the tip lands diametrically opposite the sun. Everything works in a "dial frame": latitude is // of the tip lands diametrically opposite the sun. Everything works in a "dial frame": latitude is
// taken as |lat| and, south of the equator, declination and east-west are mirrored so the dial faces north. // taken as |lat| and, south of the equator, declination and east-west are mirrored so the dial faces north.
const svgNS = "http://www.w3.org/2000/svg"; const svgNS = "http://www.w3.org/2000/svg";
const CX = 200, CY = 166, R = 140, SOLSTICE = 23.44 * rad, REFRACTION = -0.833 * rad; const CX = 200, CY = 30, R = 150, SOLSTICE = 23.44 * rad, REFRACTION = -0.833 * rad;
const el = (tag, attrs, parent) => { const el = (tag, attrs, parent) => {
const e = document.createElementNS(svgNS, tag); const e = document.createElementNS(svgNS, tag);
for (const k in attrs) e.setAttribute(k, attrs[k]); for (const k in attrs) e.setAttribute(k, attrs[k]);
@@ -602,13 +594,6 @@
const s = sunVec(lat, dec, f, halfDay); const s = sunVec(lat, dec, f, halfDay);
return toScreen(-s.e, Math.min(0, -s.u)); return toScreen(-s.e, Math.min(0, -s.u));
} }
// Shadow of the hanging rod (from the top of the opening down to the centre) on the inner sphere.
function rodShadow(s) {
return range(0, 1, 24).map(h => {
const b = h * s.u, t = b + Math.sqrt(Math.max(0, b * b - h * h + 1));
return toScreen(-t * s.e, h - t * s.u);
});
}
const toPath = pts => 'M' + pts.map(p => p[0].toFixed(1) + ',' + p[1].toFixed(1)).join('L'); const toPath = pts => 'M' + pts.map(p => p[0].toFixed(1) + ',' + p[1].toFixed(1)).join('L');
const range = (a, b, n) => Array.from({ length: n + 1 }, (_, i) => a + (b - a) * i / n); const range = (a, b, n) => Array.from({ length: n + 1 }, (_, i) => a + (b - a) * i / n);
const romanHourMin = (lat, dec) => { const romanHourMin = (lat, dec) => {
@@ -792,8 +777,10 @@
if (activeCurve === 'today') $('curveInfo').innerHTML = curveText('today'); if (activeCurve === 'today') $('curveInfo').innerHTML = curveText('today');
const sun = sunVec(place.lat, dec, frac, Math.PI * (per.end - per.start) / dayMs); const sun = sunVec(place.lat, dec, frac, Math.PI * (per.end - per.start) / dayMs);
sun.u = Math.max(0, sun.u); sun.u = Math.max(0, sun.u);
$('shadow').setAttribute('d', toPath(rodShadow(sun)));
const [tx, ty] = toScreen(-sun.e, -sun.u); const [tx, ty] = toScreen(-sun.e, -sun.u);
const dx = tx - CX, dy = ty - CY, len = Math.hypot(dx, dy) || 1;
const nx = -dy / len, ny = dx / len;
$('shadow').setAttribute('d', `M${CX + nx * 2.5},${CY + ny * 2.5} L${tx + nx * .8},${ty + ny * .8} L${tx - nx * .8},${ty - ny * .8} L${CX - nx * 2.5},${CY - ny * 2.5}Z`);
$('shadow').style.display = $('tip').style.display = ''; $('shadow').style.display = $('tip').style.display = '';
$('tip').setAttribute('cx', tx); $('tip').setAttribute('cx', tx);
$('tip').setAttribute('cy', ty); $('tip').setAttribute('cy', ty);
@@ -804,7 +791,7 @@
function drawNight(now, frac, idx) { function drawNight(now, frac, idx) {
$('sundial').toggleAttribute('hidden', true); $('sundial').toggleAttribute('hidden', true);
$('clepsydra').toggleAttribute('hidden', false); $('clepsydra').toggleAttribute('hidden', false);
$('curveInfo').innerHTML = 'The drum turns once a year; today faces the pointer'; $('curveInfo').innerHTML = '';
buildDrum(place.lat, now); buildDrum(place.lat, now);
const rise = Math.min(TRAVEL, frac * nightFrac(place.lat, now) / maxNight * TRAVEL); const rise = Math.min(TRAVEL, frac * nightFrac(place.lat, now) / maxNight * TRAVEL);
waterY = 380 - rise; waterY = 380 - rise;