From b1f37089e993b4505d07219b30d2d5435746041d Mon Sep 17 00:00:00 2001 From: zzandy-2 Date: Sat, 20 Dec 2014 12:46:25 +0200 Subject: [PATCH] GridPoint added to distinguish between world and grid coordinates --- forcefield.html | 278 +++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 183 insertions(+), 95 deletions(-) diff --git a/forcefield.html b/forcefield.html index b593899..6d189cc 100644 --- a/forcefield.html +++ b/forcefield.html @@ -1,4 +1,3 @@ - @@ -72,19 +71,47 @@ @@ -318,8 +346,8 @@ }; SuperCell.prototype.contains = function (point) { - var x = point.x - this.x; - var y = point.y - this.y; + var x = point.j - this.x; + var y = point.i - this.y; var a = this.rank * 3 + 1; var b = this.rank * 3; @@ -356,11 +384,11 @@ var k = (1 - Math.abs((h % 2) - 1)); var K = h < 1 ? r + k * g - : h < 2 ? g + k * r - : h < 3 ? g + k * b - : h < 4 ? b + k * g - : h < 5 ? b + k * r - : r + k * b; + : h < 2 ? g + k * r + : h < 3 ? g + k * b + : h < 4 ? b + k * g + : h < 5 ? b + k * r + : r + k * b; var cmax = 1; @@ -371,11 +399,11 @@ var x = c * k; var rgb = h < 1 ? [c, x, 0] - : h < 2 ? [x, c, 0] - : h < 3 ? [0, c, x] - : h < 4 ? [0, x, c] - : h < 5 ? [x, 0, c] - : [c, 0, x]; + : h < 2 ? [x, c, 0] + : h < 3 ? [0, c, x] + : h < 4 ? [0, x, c] + : h < 5 ? [x, 0, c] + : [c, 0, x]; var m = y - (r * rgb[0] + g * rgb[1] + b * rgb[2]); @@ -388,34 +416,26 @@