Found in 1 comment on Hacker News
Snawoot · 2018-11-27 · Original thread
One can build arbitrary approximate angles using lattices.

Lets assume we need 50 degrees angle and we have piece of paper with 100x100 cells. We can construct rightangled triangle and seek for closest legs proportion which gives desired angle between one of legs and hypotenuse.

Desired proportion must be rational number closest to tan(50 deg). We can find such rational number by seeking Farey sequence limited with denominator less than 100. So, for this case triangle with 87 and 73 cell legs will give us 50.000644597558434 degrees angle. Looks pretty good result to me.

I think, in case with two non-aligned rays we can reduce it to first case by building two triangles and constructing angle between hypotenuses.

Useful links:

https://en.wikipedia.org/wiki/Farey_sequence

https://www.oreilly.com/library/view/python-cookbook/0596001... - python implementation of search in Farey sequence.