From 5351ec84cbcf1bf32177c16f39bbfe4b2cd1c5c4 Mon Sep 17 00:00:00 2001 From: TreetopFlyer Date: Wed, 7 Jul 2021 15:12:39 -0400 Subject: [PATCH] only neighbors --- index.html | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/index.html b/index.html index c6a82a8..c6c2502 100644 --- a/index.html +++ b/index.html @@ -25,23 +25,19 @@ let average = (inArray, inPointInd, ...inOthersInd) => { - let pointX = inPointInd*3 + 0; - let pointY = inPointInd*3 + 1; - let pointZ = inPointInd*3 + 2; - - let centerX = Math.round(inArray[pointX]); - let centerY = Math.round(inArray[pointY]); - let centerZ = Math.round(inArray[pointZ]); - + let sum = [0, 0, 0]; for(let i=0; i { var limit; @@ -58,10 +54,9 @@ return inPoint; } - - inArray[pointX] = limit(centerX, inArray[pointX]/reducer); - inArray[pointY] = limit(centerY, inArray[pointY]/reducer); - inArray[pointZ] = limit(centerZ, inArray[pointZ]/reducer); + inArray[pointX] = limit(Math.round(inArray[pointX]), sum[0]/reducer); + inArray[pointY] = limit(Math.round(inArray[pointY]), sum[1]/reducer); + inArray[pointZ] = limit(Math.round(inArray[pointZ]), sum[2]/reducer); }; let smooth = (inArray, inTimes) => { @@ -146,7 +141,7 @@ Init(inScene) { inScene.add(path(points, 0, 0xFF0000)); - inScene.add(path(points, 50, 0x00ff00)); + inScene.add(path(points, 10, 0x00ff00)); }, Update(scene, delta) {