From b1936bdcb02194c49d3261f8907c3404a2c83919 Mon Sep 17 00:00:00 2001 From: John Breaux Date: Thu, 23 Jun 2022 15:54:01 -0500 Subject: [PATCH] Center in clip space --- ChaosGame/ChaosGame.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ChaosGame/ChaosGame.js b/ChaosGame/ChaosGame.js index 2083c00..aa84d6f 100644 --- a/ChaosGame/ChaosGame.js +++ b/ChaosGame/ChaosGame.js @@ -114,8 +114,9 @@ function main() { gl.clearColor(0.0, 0.0, 0.0, 1.0); gl.clear(gl.COLOR_BUFFER_BIT); - // make an equilateral triangle of radius 0.8 - var triangle = new triangle2({type: "equilateral", radius: 0.8}); + // make an equilateral triangle of radius 0.8, centered in the clip space + const radius = 0.8; + var triangle = new triangle2({type: "equilateral", radius: radius, center: {x: 0, y: -radius/4}}); // initialize point p to a copy of one of the vectors var i, p = triangle.get_vertex(0)?.copy(); // loop for ten thousand years