how to convert co-ordinates into spiral# thing.?

Posted by noshenim on July 12, 2010, 12:36 p.m.

\~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/

Comments

Juju 14 years, 4 months ago

To both of you - work it out yourselves. You're not gonna get better at this unless you do some work.

sirxemic 14 years, 4 months ago

Quote:
I wonder how to make this work in 3 dimensions.
I wonder how you would make a 3D spiral similar to that 2D one.

Quote:
Just wondering, does the x-3 need to be in parentheses or not? Otherwise, you could have -12*x*x*x-y.
Of course not. They would be there if they needed to.

noshenim 14 years, 4 months ago

Maybe I could run the function twice:

Quote:

f(f(x,y),z)

Ross 14 years, 4 months ago

Ingenious! Juju, I applaud your ingenuity.