Example #1
0
 public float computeLength() {
   return FMath.sqrt(x * x + y * y);
 }
Example #2
0
 public float manhattan(Vector2 v) {
   return FMath.abs(x - v.x) + FMath.abs(y - v.y);
 }
Example #3
0
 public float normalize_ip() {
   float l = FMath.sqrt(x * x + y * y);
   x /= l;
   y /= l;
   return l;
 }
Example #4
0
 public float distance(Vector2 v) {
   return FMath.sqrt((x - v.x) * (x - v.x) + (y - v.y) * (y - v.y));
 }
Example #5
0
 public void setFromAngle(float a) {
   x = FMath.cos(a);
   y = FMath.sin(a);
 }