@ferrengi said:
Looks like Py does not get set to anything unless the if statement if ( Pz < ( 1 - Px ) ) is true
I guess it would return 0 in that case?
I might be wrong but I think Py will be handled by the else block that was snipped out by the original poster. As for the WTF, yes I also think it is the slightly weird calc of the reminder of Px and Pz. And the function should at least check for negative values.