From 673e9c13aea6cd1b11f5ca3e1f6edd474bbb1a19 Mon Sep 17 00:00:00 2001 From: sanine Date: Fri, 31 Mar 2023 17:17:27 -0500 Subject: implement nice map grid --- src/MapView.js | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 src/MapView.js (limited to 'src/MapView.js') diff --git a/src/MapView.js b/src/MapView.js new file mode 100644 index 0000000..a08d6b7 --- /dev/null +++ b/src/MapView.js @@ -0,0 +1,62 @@ +import Canvas from './Canvas.js'; +import { Mat3, Vec3, Point, Shape } from './Geometry.js'; + + +const yAxis = new Vec3(0, 1, 0); +const zAxis = new Vec3(0, 0, 1); + + +function radians(degrees) { + return degrees * (Math.PI/180); +} + +function Circle(p0, axis, subdiv) { + const rotationMatrix = new Mat3().rotation(axis, 2*Math.PI/(subdiv-1)); + const points = [p0]; + for (let i=0; i