That’s a visual that’s not math, how do I turn that into math?
The general idea is that I find a way to turn the problem into a 1d interval problem, ALMOST …
The gist:
- intersection with circle is done by projecting the center to the ray line (using a simple dot product)
- that give you an intersection point with the perpendicular of the ray that goes through the center
- because all space are basically the same, the line (the projection line) that goes through the intersection and the center of the circle is the same in all space, it’s constant as it has the same direction and goes through the same point
- by only wrapping one axis (here the vertical axis) I make evident all interval, (here projected on teh horizontal axis), the cell size , the radius and the vertical intercept of the projection line are all nested constant.
- but the vertical rate of the ray casted have differing offset, isn’t tied to the frequency of the cell size BUT the ray vertical rate is constant.
Which mean that the recurrent intersection of the ray with the fixed projection line is the key to solving the problem, IF the delta between intersection is constant, it’s basically just a distance equation from the first intersection to the center of the circle minus the radius and divided by the delta step to get how many step before first hit.
The magic is to find that delta formula, given we have a lot of triangle rectangle, it’s basic trigonometry or Thales theorem … should be … if someone figure it out
