Hilbert curve functions now available in Javascript.

508 views
Skip to first unread message

Chris Dew

unread,
Jun 14, 2010, 1:22:40 AM6/14/10
to nodejs
Hi, I'm just announcing the availability of a little bit of Javascript
code for transforming 2d coordinates to 1d Hilbert curve distances and
back again.

(Obviously you'd need to add exports.xxx to use in NodeJS.)

http://github.com/chrisdew/jshilbert

All the best,

Chris.

Ben Noordhuis

unread,
Jun 14, 2010, 4:47:25 AM6/14/10
to nod...@googlegroups.com
On Mon, Jun 14, 2010 at 07:22, Chris Dew <cms...@gmail.com> wrote:
> Hi, I'm just announcing the availability of a little bit of Javascript
> code for transforming 2d coordinates to 1d Hilbert curve distances and
> back again.

Neat stuff, Chris, but what is the use case? Apart from drawing pretty
pictures, that is.

Chris Dew

unread,
Jun 14, 2010, 8:14:37 AM6/14/10
to nodejs
Thanks. Use cases include 2d searches. Points which are near in 2d
space are likely to be near on the 1d Hilbert curve.

*FROM CASUAL INSPECTION* it looks like the sections of Hilbert curve
which correspond to a rectangle all lie within the minimum Hilbert
curve point of any of the rectangle's corners and the maximum. That
distance range will include more area than just the area of the
rectangle, but it may be a useful optimisation. Collision detection,
satnav landmarks, etc.

I would be interested if anyone has proven this to be the case.

Also, http://xkcd.com/195/

It could also be used to encode two numbers into one, though half
their precision will be lost.

All the best,

Chris.

barroudjo

unread,
Apr 16, 2014, 10:44:58 AM4/16/14
to nod...@googlegroups.com
Hey there. I realize I'm resurecting an old post, but there's been no further work done on making a library for Hilbert curves/maps. I'm indeed in the case where I need to use it for geohashing. What is the critical bug you're talking about in your git ?

Cheers,

Jonathan

codepilot Account

unread,
Apr 21, 2014, 1:24:13 PM4/21/14
to nod...@googlegroups.com
I used the Hilbert curve to order the nodes for quad tree nodes that stored geographic information and road data. It did not give much improvement over z-curve.


--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com
To unsubscribe from this group, send email to
nodejs+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages