summaryrefslogtreecommitdiff
path: root/src/main.js
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2023-04-01 00:15:05 -0500
committersanine <sanine.not@pm.me>2023-04-01 00:15:05 -0500
commit54c34ca3051743fd3f1c02f73a321299af456b8a (patch)
tree01241e3cb1cdcf8b06245914eb9b6a54ffc52831 /src/main.js
parent18ed948462bd71e4cb3b1e8fa3f55df84ef0ff33 (diff)
attempt implementing convex hull algorithmtectonics
Diffstat (limited to 'src/main.js')
-rw-r--r--src/main.js24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/main.js b/src/main.js
index db8963d..8ed95d1 100644
--- a/src/main.js
+++ b/src/main.js
@@ -1,6 +1,7 @@
import Canvas from './Canvas.js';
-import { Mat3, Vec3, Point, Shape } from './Geometry.js';
+import { Mat3, Vec3, Point, Shape, RandomNormal } from './Geometry.js';
import { MapGrid, MapView } from './MapView.js';
+import { RandomPoints, Plate, PlateManager } from './Terrain.js';
const $ = id => document.getElementById(id)
@@ -14,6 +15,17 @@ window.onload = () => {
const grid = new MapGrid(30, 30);
const map = new MapView(canvas);
+ const points = [];
+ for (let i=0; i<100; i++) {
+ points.push(
+ new Point(Math.random() * 0.2 * Math.PI, Math.random() * 0.2 * Math.PI).normal()
+ );
+ }
+ const plate = new Plate(points);
+
+// const points = RandomPoints(100);
+// const mgr = new PlateManager(points, 10);
+
map.onDraw = (ct, view) => {
ct.fillStyle = "#01162B"
ct.fillRect(-10,-10, 100, 100);
@@ -22,6 +34,16 @@ window.onload = () => {
ct.fillStyle = "blue";
grid.render(ct, view);
+
+ //mgr.render(ct, view);
+ plate.render(ct, view);
+ ct.fillStyle = "blue";
+ plate.hull.normals[0].render(ct, view);
};
canvas.draw();
+
+// setInterval(() => {
+// mgr.update();
+// canvas.draw();
+// }, 100);
}