Ported C++ Xbox360 code to Java. Local erros with Math.atan and Math.pow