From 412325761f53e200a0b60f8da46eb71cb44b59ef Mon Sep 17 00:00:00 2001 From: Joshua Pelletier Date: Wed, 21 Jan 2015 15:28:54 -0800 Subject: [PATCH 1/4] Add new references about Hilbert Curves. --- diary.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/diary.md b/diary.md index 7091029..95367da 100644 --- a/diary.md +++ b/diary.md @@ -38,3 +38,11 @@ Decoding is very similar, except that at each stage we Gray- decode D index bits N-dimensional mapping. http://www.dcs.bbk.ac.uk/~jkl/pubs/JL1_00a.pdf more spatial indexing info. http://blog.notdot.net/2009/11/Damn-Cool-Algorithms-Spatial-indexing-with-Quadtrees-and-Hilbert-Curves + +Hilbert Curve references: +http://www.tiac.net/~sw/2008/10/Hilbert/ +http://www.dcs.bbk.ac.uk/TriStarp/pubs/JL1_00.pdf +http://people.csail.mit.edu/jaffer/Geometry/HSFC +http://people.csail.mit.edu/jaffer/Geometry/RFMDSFF +https://github.com/jbruestle/aggregate_btree/blob/master/abtree/hilbert.c +https://github.com/jbruestle/aggregate_btree/blob/master/abtree/hilbert.h From 618c4b3d0fc18a015c7f1b27ebcac9603f6529b4 Mon Sep 17 00:00:00 2001 From: Joshua Pelletier Date: Thu, 22 Jan 2015 13:48:36 -0800 Subject: [PATCH 2/4] Add test cases. --- t/xy/1dto2d.t.js | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/t/xy/1dto2d.t.js b/t/xy/1dto2d.t.js index a82a01b..4d7476a 100644 --- a/t/xy/1dto2d.t.js +++ b/t/xy/1dto2d.t.js @@ -3,5 +3,41 @@ require('proof')(1, function (equal) { var hilbert = require('../..') - equal(hilbert.d2xy(16, 2), [4, 0]) + equal(hilbert.d2xy(1, 2), [1000, 7]) + console.log("0:", hilbert.d2xy(0,2)) + console.log("1:", hilbert.d2xy(1,2)) + console.log("2:", hilbert.d2xy(2,2)) + console.log("3:", hilbert.d2xy(3,2)) + console.log("4:", hilbert.d2xy(4,2)) + console.log("5:", hilbert.d2xy(5,2)) + console.log("6:", hilbert.d2xy(6,2)) + console.log("7:", hilbert.d2xy(7,2)) + console.log("8:", hilbert.d2xy(8,2)) + console.log("9:", hilbert.d2xy(9,2)) + console.log("10:", hilbert.d2xy(10,2)) + console.log("11:", hilbert.d2xy(11,2)) + console.log("12:", hilbert.d2xy(12,2)) + console.log("13:", hilbert.d2xy(13,2)) + console.log("14:", hilbert.d2xy(14,2)) + console.log("15:", hilbert.d2xy(15,2)) + console.log("16:", hilbert.d2xy(16,2)) +/* + hilbert.d2xy(0,2) + hilbert.d2xy(1,2) + hilbert.d2xy(2,2) + hilbert.d2xy(3,2) + hilbert.d2xy(4,2) + hilbert.d2xy(5,2) + hilbert.d2xy(6,2) + hilbert.d2xy(7,2) + hilbert.d2xy(8,2) + hilbert.d2xy(9,2) + hilbert.d2xy(10,2) + hilbert.d2xy(11,2) + hilbert.d2xy(12,2) + hilbert.d2xy(13,2) + hilbert.d2xy(14,2) + hilbert.d2xy(15,2) + hilbert.d2xy(16,2) +*/ }) From 0a71874a53fbbfe6e858e627a19cac60ab827480 Mon Sep 17 00:00:00 2001 From: Joshua Pelletier Date: Fri, 23 Jan 2015 14:50:40 -0800 Subject: [PATCH 3/4] Remove duplicate. --- t/xy/2dto1d.js | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 t/xy/2dto1d.js diff --git a/t/xy/2dto1d.js b/t/xy/2dto1d.js deleted file mode 100644 index 5c714d6..0000000 --- a/t/xy/2dto1d.js +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env node - -require('proof')(1, function (equal) { - var hilbert = require('../..') - - equal(hilbert.xy2d(16, 2, 2,), 8) -} From bf24e9cb574f18de81378e895ff7d9ff0ee46705 Mon Sep 17 00:00:00 2001 From: Joshua Pelletier Date: Fri, 23 Jan 2015 14:53:36 -0800 Subject: [PATCH 4/4] Correct typo. --- t/xy/1dto3d.t.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/t/xy/1dto3d.t.js b/t/xy/1dto3d.t.js index fa4e2d1..5b632db 100644 --- a/t/xy/1dto3d.t.js +++ b/t/xy/1dto3d.t.js @@ -1,7 +1,7 @@ #!/usr/bin/env node require('proof')(1, function (equal) { - var hilbert = require('../..') + var hilbert = require('../..') - equal(hilbert.convertPointToDistance(16, 2, 2), 8) + equal(hilbert.convertPointToDistance(16, 2, 2), 8) })