Struggling here! It seems that one reason we’re fiddling with pointers and pass-by-reference is to get around the fact that functions in C can only return a single value, is that correct? if we could define cartesianToPolar to return 2 floats (which we can’t) then PBR here wouldn’t be necessary?
Also, really, cartesian to polar co-ordinates? I would guess many of us are struggling with pointers etc and this cannot be the best type of example to use, adding trigonometry into the mix as well. I know in theory we could ‘abstract that away’ and just focus on the PBR etc but honestly it does make this even harder
Finally What IS M_PI_2? It just appears in the code for cartesianToPolar but I can’t see it defined or explained anywhere?