Example #1
0
 /** Returns the distance from this vector to (px,py) */
 public float dist(float px, float py) {
   float dx = x - px;
   float dy = y - py;
   return (float) Math.sqrt(dx * dx + dy * dy);
 }
Example #2
0
 /** Returns the distance from this vector to b */
 public float dist(Vec2 b) {
   float dx = x - b.x;
   float dy = y - b.y;
   return (float) Math.sqrt(dx * dx + dy * dy);
 }