src/renderable/renderable.js
function (target) {
            var a = this.getBounds();
            var dx, dy;

            if (target instanceof me.Renderable) {
                var b = target.getBounds();
                dx = a.centerX - b.centerX;
                dy = a.centerY - b.centerY;
            } else { // vector object
                dx = a.centerX - target.x;
                dy = a.centerY - target.y;
            }

            return Math.sqrt(dx * dx + dy * dy);
        }
function (target) {
            var a = this.getBounds();
            var dx, dy;

            if (target instanceof me.Renderable) {
                var b = target.getBounds();
                dx = a.centerX - b.centerX;
                dy = a.centerY - b.centerY;
            } else { // vector object
                dx = a.centerX - target.x;
                dy = a.centerY - target.y;
            }

            return Math.sqrt(dx * dx + dy * dy);
        }
function ( target ) { var a = this . getBounds ( ) ; var dx , dy ; if ( target instanceof me . Renderable ) { var b = target . getBounds ( ) ; dx = a . centerX - b . centerX ; dy = a . centerY - b . centerY ; } else { // vector object dx = a . centerX - target . x ; dy = a . centerY - target . y ; } return Math . sqrt ( dx * dx + dy * dy ) ; }
return the distance to the specified target
@name distanceTo
@memberOf me.Renderable
@function
@param {me.Renderable|me.Vector2d|me.Vector3d} target
@return {Number} distance
return the distance to the specified target