@Override // from interface IVector public float lengthSq () { float x = x(), y = y(); return (x*x + y*y); }
@Override // from interface IVector public float lengthSq () { float x = x(), y = y(); return (x*x + y*y); }
@Override public String toString () { return Vectors.vectorToString(x(), y()); } }
@Override public String toString () { return Vectors.vectorToString(x(), y()); } }
@Override // from interface IVector public Vector negate (Vector result) { return result.set(-x(), -y()); }
@Override // from interface IVector public float angle () { return FloatMath.atan2(y(), x()); }
@Override // from interface IVector public Vector subtract (float x, float y, Vector result) { return result.set(x() - x, y() - y); }
@Override // from interface IVector public float distanceSq (IVector other) { float dx = x() - other.x(), dy = y() - other.y(); return dx*dx + dy*dy; }
@Override // from interface IVector public Vector lerp (IVector other, float t, Vector result) { float x = x(), y = y(); float dx = other.x() - x, dy = other.y() - y; return result.set(x + t*dx, y + t*dy); }
@Override // from interface IVector public Vector rotate (float angle, Vector result) { float x = x(), y = y(); float sina = FloatMath.sin(angle), cosa = FloatMath.cos(angle); return result.set(x*cosa - y*sina, x*sina + y*cosa); }
@Override // from interface IVector public Vector lerp (IVector other, float t, Vector result) { float x = x(), y = y(); float dx = other.x() - x, dy = other.y() - y; return result.set(x + t*dx, y + t*dy); }
@Override // from interface IVector public Vector cross (IVector other, Vector result) { float x = x(), y = y(), ox = other.x(), oy = other.y(); return result.set(y*ox - x*oy, x*oy - y*ox); }
@Override // from interface IVector public Vector rotate (float angle, Vector result) { float x = x(), y = y(); float sina = FloatMath.sin(angle), cosa = FloatMath.cos(angle); return result.set(x*cosa - y*sina, x*sina + y*cosa); }
@Override // from interface IVector public Vector cross (IVector other, Vector result) { float x = x(), y = y(), ox = other.x(), oy = other.y(); return result.set(y*ox - x*oy, x*oy - y*ox); }
@Override // from interface IVector public Vector scale (IVector other, Vector result) { return result.set(x()*other.x(), y()*other.y()); }
@Override // from interface IVector public Vector rotateScaleAndAdd (float angle, float scale, IVector add, Vector result) { float x = x(), y = y(); float sina = FloatMath.sin(angle), cosa = FloatMath.cos(angle); return result.set((x*cosa - y*sina)*scale + add.x(), (x*sina + y*cosa)*scale + add.y()); }
@Override // from interface IVector public Vector rotateAndAdd (float angle, IVector add, Vector result) { float x = x(), y = y(); float sina = FloatMath.sin(angle), cosa = FloatMath.cos(angle); return result.set(x*cosa - y*sina + add.x(), x*sina + y*cosa + add.y()); }
@Override // from interface IVector public Vector rotateAndAdd (float angle, IVector add, Vector result) { float x = x(), y = y(); float sina = FloatMath.sin(angle), cosa = FloatMath.cos(angle); return result.set(x*cosa - y*sina + add.x(), x*sina + y*cosa + add.y()); }
@Override // from interface IVector public Vector rotateScaleAndAdd (float angle, float scale, IVector add, Vector result) { float x = x(), y = y(); float sina = FloatMath.sin(angle), cosa = FloatMath.cos(angle); return result.set((x*cosa - y*sina)*scale + add.x(), (x*sina + y*cosa)*scale + add.y()); }