public float distanceSquared ( Vector2f other ) { float dx = other . getX ( ) - getX ( ) ; float dy = other . getY ( ) - getY ( ) ; return ( float ) ( dx * dx ) + ( dy * dy ) ; }
Get the distance from this point to another squared . This can sometimes be used in place of distance and avoids the additional sqrt .