So I have been reading this wonderful book on ray tracing by Kevin Suffern, Ray tracing from Ground Up. I am reading this book after finishing Peter Shirley's first two book on ray tracing & implementing multi-threaded ray tracer, adding features like Intel's denoiser, assimp integration etc.
What struck me was before I read the third book, it would be good idea to read more on sampling. Which is why am skimming through this current book. At this moment, am stuck on a topic which explains how sample point in unit square is mapped onto unit radius disk.
I am stuck at the part where book mentions how equations are mapped. Radius part is clear to me, however, am not very clear about the angle (phi) part. Is there any derivation as to how this was deduced? Or is it done to avoid atan() calculation and is a neat approximation of it? After putting in test values I have understood how values get converted, however, am very keen to understand how this formulas for Phi was deduced based on different quarters, unless it's very obvious and I have overlooked it :(
EDIT: After more digging, i have understood that if i assume first quadrant value, then second, third & fourth values can be deduced by rotating/adding (Pi/2) to angle phi & switching axis due to quadrant change. However, first quadrant value is still not clear :|