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 };