From 043552295b30a8ebe253848294aa35c34b861bd4 Mon Sep 17 00:00:00 2001 From: David Manthey Date: Thu, 21 Jun 2018 12:22:10 -0400 Subject: [PATCH] Reverse the winding of marching triangles. --- src/isolineFeature.js | 12 ++++++------ tests/cases/isolineFeature.js | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/isolineFeature.js b/src/isolineFeature.js index ebd94e1b46..a0a4b8ef29 100644 --- a/src/isolineFeature.js +++ b/src/isolineFeature.js @@ -134,13 +134,13 @@ var util = require('./util'); */ var patternLineTable = { /* triangles with one high vertex */ - 17 /* 001 */: [{l0: 0, h0: 2, l1: 1, h1: 2}], - 18 /* 010 */: [{l0: 2, h0: 1, l1: 0, h1: 1}], - 20 /* 100 */: [{l0: 1, h0: 0, l1: 2, h1: 0}], + 17 /* 001 */: [{l0: 1, h0: 2, l1: 0, h1: 2}], + 18 /* 010 */: [{l0: 0, h0: 1, l1: 2, h1: 1}], + 20 /* 100 */: [{l0: 2, h0: 0, l1: 1, h1: 0}], /* triangles with one low vertex */ - 22 /* 110 */: [{l0: 2, h0: 1, l1: 2, h1: 0}], - 21 /* 101 */: [{l0: 1, h0: 0, l1: 1, h1: 2}], - 19 /* 011 */: [{l0: 0, h0: 2, l1: 0, h1: 1}], + 22 /* 110 */: [{l0: 2, h0: 0, l1: 2, h1: 1}], + 21 /* 101 */: [{l0: 1, h0: 2, l1: 1, h1: 0}], + 19 /* 011 */: [{l0: 0, h0: 1, l1: 0, h1: 2}], /* squares with one high vertex */ 1 /* 0001 */: [{l0: 2, h0: 3, l1: 1, h1: 3}], 2 /* 0010 */: [{l0: 0, h0: 2, l1: 3, h1: 2}], diff --git a/tests/cases/isolineFeature.js b/tests/cases/isolineFeature.js index f3585348fd..9daa122d6d 100644 --- a/tests/cases/isolineFeature.js +++ b/tests/cases/isolineFeature.js @@ -363,16 +363,16 @@ describe('Isoline Feature', function () { // we slice each element of the result to ignore the properties that // are added to it. expect(result.map(function (d) { return d.slice(); })).toEqual([[ - {x: 10, y: 0, z: 0}, {x: 9, y: 1, z: 0}, {x: 7, y: 1, z: 0}, - {x: 5, y: 1, z: 0}, {x: 4, y: 2, z: 0} + {x: 4, y: 2, z: 0}, {x: 5, y: 1, z: 0}, {x: 7, y: 1, z: 0}, + {x: 9, y: 1, z: 0}, {x: 10, y: 0, z: 0} ], [ - {x: 12, y: 2, z: 0}, {x: 13, y: 1, z: 0}, {x: 14, y: 0, z: 0} + {x: 14, y: 0, z: 0}, {x: 13, y: 1, z: 0}, {x: 12, y: 2, z: 0} ], [ - {x: 18, y: 0, z: 0}, {x: 17, y: 1, z: 0}, {x: 16, y: 2, z: 0} + {x: 16, y: 2, z: 0}, {x: 17, y: 1, z: 0}, {x: 18, y: 0, z: 0} ], [ - {x: 24, y: 2, z: 0}, {x: 23, y: 1, z: 0}, {x: 22, y: 0, z: 0} + {x: 22, y: 0, z: 0}, {x: 23, y: 1, z: 0}, {x: 24, y: 2, z: 0} ], [ - {x: 26, y: 0, z: 0}, {x: 27, y: 1, z: 0} + {x: 27, y: 1, z: 0}, {x: 26, y: 0, z: 0} ]]); }); });