From f47d2b7d112ce21461fb441f021dee7f55eb9f8f Mon Sep 17 00:00:00 2001 From: "Fabian @ Blax Software" Date: Tue, 3 Nov 2026 11:04:00 +0100 Subject: [PATCH] feat: map lakes round off their outer corners, shore and shallows following the curve Co-Authored-By: Claude Opus 5.5 --- app/components/map/Land.vue | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/app/components/map/Land.vue b/app/components/map/Land.vue index 2c7de8f..ad32038 100644 --- a/app/components/map/Land.vue +++ b/app/components/map/Land.vue @@ -92,6 +92,9 @@ const fields = computed(() => { const flat: Record = {} let shore = '' let shallows = '' + let corners = '' + let curvedShore = '' + let curvedShallows = '' let ripples = '' for (let y = y0; y < y1; y++) { let run: string | null = null @@ -123,6 +126,22 @@ const fields = computed(() => { } shallows += band(F * 0.08, F * 0.1) shore += band(0, F * 0.09) + // Where land meets the lake on two sides, the corner is land, rounded off with the shore. + const r = F * 0.36 + for (const [sx, sy] of [[0, 0], [1, 0], [1, 1], [0, 1]] as const) { + if (!land(x + (sx ? 1 : -1), y) || !land(x, y + (sy ? 1 : -1))) continue + const cx = (x + sx) * F + const cy = (y + sy) * F + const dx = sx ? -1 : 1 + const dy = sy ? -1 : 1 + // The corner square minus a quarter disc, then the shore and the shallows along the quarter circle. + const sweep = dx * dy > 0 ? 0 : 1 + corners += `M${cx} ${cy}h${dx * r}A${r} ${r} 0 0 ${sweep} ${cx} ${cy + dy * r}z` + const curve = (outer: number, inner: number) => + `M${cx + dx * r} ${cy + dy * (r - outer)}A${outer} ${outer} 0 0 ${sweep} ${cx + dx * (r - outer)} ${cy + dy * r}L${cx + dx * (r - inner)} ${cy + dy * r}A${inner} ${inner} 0 0 ${1 - sweep} ${cx + dx * r} ${cy + dy * (r - inner)}z` + curvedShore += curve(r, r - F * 0.09) + curvedShallows += curve(r - F * 0.08, r - F * 0.18) + } const k = F / 100 ripples += `M${(x * 100 + 28 + fieldHash(x, y) * 30) * k} ${(y * 100 + 50) * k}h${18 * k}M${(x * 100 + 40 + fieldHash(y, x) * 20) * k} ${(y * 100 + 64) * k}h${12 * k}` continue @@ -131,7 +150,7 @@ const fields = computed(() => { out.push({ x, y, ground, forest, peaks: ground === 'mountain' ? peaks(x, y) : null }) } } - return { flat: Object.entries(flat), shore, shallows, ripples, raised: out } + return { flat: Object.entries(flat), shore, shallows, corners, curvedShore, curvedShallows, ripples, raised: out } }) @@ -150,6 +169,9 @@ const fields = computed(() => { + + +