|
Dev - Sort these by name
|
how to convert co-ordinates into spiral# thing.?
Posted on July 12, 2010 at 13:36
\~There's a way to convert an integral co-ordinate field into a spiral index number..
I want to convert 10,000 different co-ordinates with a range of over 1000 ( from (0,0) to more than (1000,1000) ) into single integers (just 'cause :P). The number and maximum range of the co-ordinates is variable. Does anyone know what this is called or how to do this efficiently? So (2,1) would become 9, (1,1)-->8, (2,2)-->24, etc. reminder: http://fuldans.se/
+0
Dev - Er, any ideas how to make this work?
Related Posts Dev - Warning Dev - After editing rating, make rating display change Dev - When editing, update "edited" column Dev - Restore deleted comments Dev - Display deleted comments if mod (hidden, then with dropdown) Dev - After deletion or during edit, make rating dropdown appear again Dev - Stricter rating rules. Prevent user from rating again Dev - Pages Dev - Reporting
0 lies at co-ordinate (0,0)
1 lies at co-ordinate (1,0) 2 lies at co-ordinate (1,1) The numbers 1 to 8 inclusive lie on ring 1. The numbers 9 to 24 inclusive lie on ring 2. The numbers along the x-axis (that is: 1, 10, 27, 52, 85 et cetera) are defined by 4n^2 - 3n where n is the ring number. The formula for working out which ring n a number x lies on is as follows: n = ipart( ( 3 + sqrt(9 + 16x) ) / 8 ) Mathematical ipart() is the same as programming floor() That's the maths behind it anyway. sirXemic has got the implementation. |



