hilbert-curve

Hilbert curve using turtle graphics and recursion

杀马特。学长 韩版系。学妹 提交于 2020-01-25 11:15:06
问题 I'm trying to implement an L-System generated Hilbert curve ,making use of python turtle graphics and recursion. My code seems to be working for the first two levels of recursion n=1 and n=2 but beyond that , the graphics just entangled (although I´m able to observe further modules within them), and I can´t seem to grasp what might be wrong here, do I need some intermediate steps to regenerate the Hilbert modules for deeper levels of recursion? Please see my code below , its relatively simple

Hilbert Curve in Applet with Matrix of coordinates

余生颓废 提交于 2019-12-23 04:28:25
问题 I am trying to approximate a solution of the Traveling Salesman Problem with a Hilbert Curve program. I have to do it by using an applet. How would I add the Matrix in my code, and how would I display the coordinates in the Applet. I don't need to have more than one frame. The code is below: import java.awt.*; import java.applet.*; // Background images (put a map in the back of the applet) public class HilbertCurve extends Applet{ private SimpleGraphics sg = null; private final int dist0=512;

Implementing a Hilbert map of the Internet

[亡魂溺海] 提交于 2019-12-20 08:19:14
问题 In the XKCD comic 195 a design for a map of the Internet address space is suggested using a Hilbert curve so that items from a similar IP adresses will be clustered together. Given an IP address, how would I calculate its 2D coordinates (in the range zero to one) on such a map? 回答1: This is pretty easy, since the Hilbert curve is a fractal, that is, it is recursive. It works by bisecting each square horizontally and vertically, dividing it into four pieces. So you take two bits of the IP

How to call Hilbert curve encode C routines

瘦欲@ 提交于 2019-12-08 14:23:39
问题 I was trying to run a Hilbert curve code written in C, which I found here http://www.tddft.org/svn/octopus/trunk/src/grid/hilbert.c The code runs, but the results I get form the output are not correct. I made a simple driver routine, that takes 3 values as arguments from the command line and passes them to a Hilbert curve encode, decode routines. More precisely, I can't decode back the original coordinates (x,y,z). One of my problems was to understand what the variable nbits is doing. I

Mapping Hilbert values to 3D points

与世无争的帅哥 提交于 2019-12-04 22:02:57
问题 I have a set of Hilbert values (length from the start of the Hilbert curve to the given point). What is the best way to convert these values to 3D points? Original Hilbert curve was not in 3D, so I guess I have to pick by myself the Hilbert curve rank I need. I do have total curve length though (that is, the maximum value in the set). Perhaps there is an existing implementation? Some library that would allow me to work with Hilbert curve / values? Language does not matter much. 回答1: Not an

Mapping Hilbert values to 3D points

删除回忆录丶 提交于 2019-12-03 12:52:38
I have a set of Hilbert values (length from the start of the Hilbert curve to the given point). What is the best way to convert these values to 3D points? Original Hilbert curve was not in 3D, so I guess I have to pick by myself the Hilbert curve rank I need. I do have total curve length though (that is, the maximum value in the set). Perhaps there is an existing implementation? Some library that would allow me to work with Hilbert curve / values? Language does not matter much. Not an answer about 3D conversion, but there is a nice algorithm and discussion of Hilbert values here Two

Implementing a Hilbert map of the Internet

淺唱寂寞╮ 提交于 2019-12-02 14:56:43
In the XKCD comic 195 a design for a map of the Internet address space is suggested using a Hilbert curve so that items from a similar IP adresses will be clustered together. Given an IP address, how would I calculate its 2D coordinates (in the range zero to one) on such a map? This is pretty easy, since the Hilbert curve is a fractal, that is, it is recursive. It works by bisecting each square horizontally and vertically, dividing it into four pieces. So you take two bits of the IP address at a time, starting from the left, and use those to determine the quadrant, then continue, using the

Algorithm for generating a 3D Hilbert space-filling curve in Python

穿精又带淫゛_ 提交于 2019-11-27 02:46:14
问题 I'd like to map points in a RGB color cube to a one-dimensional list in Python, in a way that makes the list of colors look nice and continuous. I believe using a 3D Hilbert space-filling curve would be a good way to do this, but I've searched and haven't found very helpful resources for this problem. Wikipedia in particular only provides example code for generating 2D curves. 回答1: This paper seems to have quite a discussion: An inventory of three-dimensional Hilbert space-filling curves.

Mapping N-dimensional value to a point on Hilbert curve

痞子三分冷 提交于 2019-11-26 17:04:40
I have a huge set of N-dimensional points (tens of millions; N is close to 100). I need to map these points to a single dimension while preserving spatial locality. I want to use Hilbert space-filling curve to do it. For each point I want to pick the closest point on the curve. The Hilbert value of the point (curve length from the start of curve to the picked point) is the single dimension value I seek. Computation does not have to be instant, but I expect it to be no more than several hours on decent modern home PC hardware. Any suggestions on implementation? Are there any libraries that

Mapping N-dimensional value to a point on Hilbert curve

隐身守侯 提交于 2019-11-26 05:15:53
问题 I have a huge set of N-dimensional points (tens of millions; N is close to 100). I need to map these points to a single dimension while preserving spatial locality. I want to use Hilbert space-filling curve to do it. For each point I want to pick the closest point on the curve. The Hilbert value of the point (curve length from the start of curve to the picked point) is the single dimension value I seek. Computation does not have to be instant, but I expect it to be no more than several hours