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 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) +*/ }) 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) }) 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) -}