From dc8e745ed497679a12b76ffa7721331bed64e94b Mon Sep 17 00:00:00 2001 From: Richard Zink Date: Tue, 6 Oct 2026 15:53:09 +0200 Subject: [PATCH] Rotate landscape 180 degrees --- assets/index.html | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/assets/index.html b/assets/index.html index 4458813..0ccb187 100644 --- a/assets/index.html +++ b/assets/index.html @@ -37,6 +37,15 @@ height = canvas.height = window.innerHeight; } + function rotatePoint(point, angle) { + const cos = Math.cos(angle); + const sin = Math.sin(angle); + return { + x: point.x * cos - point.z * sin, + z: point.x * sin + point.z * cos + }; + } + window.addEventListener('resize', resize); resize(); @@ -52,9 +61,10 @@ } project() { + const rotated = rotatePoint(this, Math.PI); const scale = camera.fov / (camera.fov + this.z); - const xIso = this.x - this.z; - const yIso = (this.x + this.z) * 0.5; + const xIso = rotated.x - rotated.z; + const yIso = (rotated.x + rotated.z) * 0.5; const x2d = xIso * scale + width / 2; const y2d = yIso * scale + height / 2; return { x: x2d, y: y2d, scale: scale };