|
@@ -402,7 +402,33 @@ public final class Vector2f implements Savable, Cloneable, java.io.Serializable
|
|
|
product.y = y * scalar;
|
|
|
return product;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Multiplies component-wise by the specified components and returns the
|
|
|
+ * product as a new instance. The current instance is unaffected.
|
|
|
+ *
|
|
|
+ * @param x the scale factor for the X component
|
|
|
+ * @param y the scale factor for the Y component
|
|
|
+ * @return a new Vector2f
|
|
|
+ */
|
|
|
+ public Vector2f mult(float x, float y) {
|
|
|
+ return new Vector2f(this.x * x, this.y * y);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Multiplies component-wise by the specified components and returns the
|
|
|
+ * (modified) current instance.
|
|
|
+ *
|
|
|
+ * @param x the scale factor for the X component
|
|
|
+ * @param y the scale factor for the Y component
|
|
|
+ * @return the (modified) current instance (for chaining)
|
|
|
+ */
|
|
|
+ public Vector2f multLocal(float x, float y) {
|
|
|
+ this.x *= x;
|
|
|
+ this.y *= y;
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Divides by the scalar argument and returns the quotient as a new
|
|
|
* instance. The current instance is unaffected.
|
|
@@ -426,7 +452,33 @@ public final class Vector2f implements Savable, Cloneable, java.io.Serializable
|
|
|
y /= scalar;
|
|
|
return this;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Divides component-wise by the specified components and returns the quotient
|
|
|
+ * as a new instance. The current instance is unaffected.
|
|
|
+ *
|
|
|
+ * @param x the divisor for the X component
|
|
|
+ * @param y the divisor for the Y component
|
|
|
+ * @return a new Vector2f
|
|
|
+ */
|
|
|
+ public Vector2f divide(float x, float y) {
|
|
|
+ return new Vector2f(this.x / x, this.y / y);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Divides component-wise by the specified components returns the (modified)
|
|
|
+ * current instance.
|
|
|
+ *
|
|
|
+ * @param x the divisor for the X component
|
|
|
+ * @param y the divisor for the Y component
|
|
|
+ * @return the (modified) current instance (for chaining)
|
|
|
+ */
|
|
|
+ public Vector2f divideLocal(float x, float y) {
|
|
|
+ this.x /= x;
|
|
|
+ this.y /= y;
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Returns the negative of the vector. The current instance is unaffected.
|
|
|
*
|