1

I have heard there is an algorithm that can do this, but I have searched over the internet a good bit and have come up with nothing. I want to have a function that I can give an x,y coordinate and get an integer back that is the number of iterations of the curve that must be drawn before the curve passes through that point.

user3810965
  • 367
  • 3
  • 15
  • 1
    I don't think this is a bad question _per se_, but not quite right for SO, maybe SE.Math. From a programming perspective, you should check that the input points are **rational**, otherwise I don't think you'll be able to give a practical answer. – Hooked Nov 25 '14 at 16:00
  • 2
    This question appears to be off-topic because it belongs on Math.SE, http://math.stackexchange.com/ – Hooked Nov 25 '14 at 16:01
  • This seems quite tricky, because some points never get covered by the curve, even if they're rational. For example, if you're drawing the curve in a unit square, then (0.5, 0.5) will never get drawn through. – Kevin Nov 25 '14 at 16:04

1 Answers1

0

You can simply translate the x-and y co-ordinate to a binary and interleave it. Then treat it as base-10 number or base-4 number. You can find a JS for quadkeys here:http://msdn.microsoft.com/en-us/library/bb259689.aspx. A hilbert curve is way more expensive:Implementing a Hilbert map of the Internet.

Community
  • 1
  • 1
Micromega
  • 12,486
  • 7
  • 35
  • 72