public Vector2f transform(float x, float y) { return new Vector2f( m00 * x + m01 * y, m10 * x + m11 * y); }
public Vector2f transform(float x, float y) { return new Vector2f( m00 * x + m01 * y, m10 * x + m11 * y); }
@Override public Vector2f toFloat() { return new Vector2f(x, y); }
@Override public Vector2f negate() { return new Vector2f(-x, -y); }
@Override public Vector2f negate() { return new Vector2f(-x, -y); }
@Override public Vector2f toFloat() { return new Vector2f(x, y); }
public Vector2f toVector2() { return new Vector2f(this); }
public Vector2f project(float x, float y) { final float lengthSquared = x * x + y * y; if (Math.abs(lengthSquared) < GenericMath.FLT_EPSILON) { throw new ArithmeticException("Cannot project onto the zero vector"); } final float a = dot(x, y) / lengthSquared; return new Vector2f(a * x, a * y); }
/** * Returns a unit vector pointing in the same direction as this complex on the complex plane. * * @return The vector representing the direction this complex is pointing to */ public Vector2f getDirection() { return new Vector2f(x, y).normalize(); }
/** * Returns a unit vector pointing in the same direction as this complex on the complex plane. * * @return The vector representing the direction this complex is pointing to */ public Vector2f getDirection() { return new Vector2f(x, y).normalize(); }
@Override public Vector2f normalize() { final float length = length(); if (Math.abs(length) < GenericMath.FLT_EPSILON) { throw new ArithmeticException("Cannot normalize the zero vector"); } return new Vector2f(x / length, y / length); }
public Vector2f project(float x, float y) { final float lengthSquared = x * x + y * y; if (Math.abs(lengthSquared) < GenericMath.FLT_EPSILON) { throw new ArithmeticException("Cannot project onto the zero vector"); } final float a = dot(x, y) / lengthSquared; return new Vector2f(a * x, a * y); }
@Override public Vector2f normalize() { final float length = length(); if (Math.abs(length) < GenericMath.FLT_EPSILON) { throw new ArithmeticException("Cannot normalize the zero vector"); } return new Vector2f(x / length, y / length); }
public static Vector2f deserialize2f(JsonElement element) { return new Vector2f( element.getAsJsonObject().get("x").getAsFloat(), element.getAsJsonObject().get("y").getAsFloat() ); }
public static Vector2f deserialize2f(JsonElement element) { return new Vector2f( element.getAsJsonObject().get("x").getAsFloat(), element.getAsJsonObject().get("y").getAsFloat() ); }
/** * Gets the direction vector of a certain angle in radians. * * @param angle in radians * @return the direction vector */ public static Vector2f createDirectionRad(float angle) { return new Vector2f(TrigMath.cos(angle), TrigMath.sin(angle)); } }
@Override public Vector2f getColumn(int col) { return new Vector2f(get(0, col), get(1, col)); }
@Override public Vector2f getRow(int row) { return new Vector2f(get(row, 0), get(row, 1)); }
/** * Gets the direction vector of a certain angle in radians. * * @param angle in radians * @return the direction vector */ public static Vector2f createDirectionRad(float angle) { return new Vector2f(TrigMath.cos(angle), TrigMath.sin(angle)); } }
@Override public Vector2f getColumn(int col) { return new Vector2f(get(0, col), get(1, col)); }