You can try combining both axes into one vector at the very beginning to have a 2-vector and clamp its length between -1 and 1, and then do everything else. It will eliminate one branch and make it easier to debug.
You can try combining both axes into one vector at the very beginning to have a 2-vector and clamp its length between -1 and 1, and then do everything else. It will eliminate one branch and make it easier to debug.