Ad
  • Custom User Avatar

    as newbie i could have an aproach. I think the key to understand this, is know that Math.sign() return an integer ; -1 (negative), 0(zero), 1(positive). Then uses this to calculate the proper index of the list [3,4,2,1][index] where index = (0,5 if x is pos OR -0,5 if x is neg) + (0,5 if Y is neg OR 2,5 if Y is pos) it always result into an integer form 0 to 3 that selects the value in the arbitrary order is set.