diff --git a/src/main/java/com/tiggerbiggo/primaplay/calculation/Vector2.java b/src/main/java/com/tiggerbiggo/primaplay/calculation/Vector2.java index c23305b..20c6694 100644 --- a/src/main/java/com/tiggerbiggo/primaplay/calculation/Vector2.java +++ b/src/main/java/com/tiggerbiggo/primaplay/calculation/Vector2.java @@ -3,13 +3,13 @@ import java.io.Serializable; import java.util.Random; -/** Represents real vector in 2D space. Also contains various methods for calculation. */ +/** Represents a vector in 2D space. Also contains various methods for calculation. */ public class Vector2 implements Serializable { private double x, y; /** - * Constructs real new vector with X and Y components + * Constructs a new vector with X and Y components * * @param x The X component of the vector * @param y The Y component of the vector @@ -50,8 +50,8 @@ public Vector2 clone() { /** * Overridden toString with more descriptive info about this vector * - * @return String in the format "[@hash code] -- X: - * X, Y: <3b>Y". + * @return String in the format "[@hash code] -- X: + * X, Y: <3b>Y". */ @Override public String toString() { @@ -143,7 +143,7 @@ public double sqMagnitude() { } /** - * Applies real modulo operation on both components of the input vector given real value + * Applies a modulo operation on both components of the input vector given a value * * @param mod The modulo value * @return The calculated number @@ -156,7 +156,7 @@ public Vector2 mod(float mod) { * Calculates the dot product of 2 vectors * * @param other The vector to dot with - * @return The dot product: ax*bx + ay*by + * @return The dot product: ax*bx + ay*by */ public double dot(Vector2 other) { return (this.x * other.x) + (this.y * other.y); @@ -166,14 +166,14 @@ public double dot(Vector2 other) { * Calculates the determinant of 2 vectors * * @param other The vector to det with - * @return The determinant: ax*by - ay*bx + * @return The determinant: ax*by - ay*bx */ public double det(Vector2 other) { return (this.x * other.y) - (this.y * other.x); } /** - * Linearly interpolates between 2 vectors given real percentage + * Linearly interpolates between 2 vectors given a percentage * * @param other The vector to lerp with * @param p A double representing the percentage. @@ -187,7 +187,7 @@ public Vector2 lerpVector(Vector2 other, double p) { /** * Gets the distance between 2 vectors * - * @param b The second vector + * @param other The second vector * @return The distance between the 2 vectors */ public double distanceBetween(Vector2 other) { @@ -217,7 +217,7 @@ public double angleBetween(Vector2 other) { } /** - * Generates real random vector which lies on real given circle, the center of which is this + * Generates a random vector which lies on a given circle, the center of which is this * . * * @param r The radius of the circle @@ -226,7 +226,7 @@ public double angleBetween(Vector2 other) { public Vector2 randomOnCircle(double r) { // Generate random angle double rand = new Random().nextDouble() * Math.PI * 2; - // Make real new vector with length of the radius of the circle which we then rotate + // Make a new vector with length of the radius of the circle which we then rotate Vector2 toReturn = Vector2.UP.multiply(new Vector2(r)); toReturn = toReturn.rotateAround(Vector2.ZERO, rand); // Add the center point to offset it @@ -237,7 +237,7 @@ public Vector2 randomOnCircle(double r) { * Multiplies this vector by another * * @param other Second vector - * @return real*imaginary + * @return a*b */ public Vector2 multiply(Vector2 other) { return new Vector2(this.X() * other.X(), this.Y() * other.Y()); @@ -247,7 +247,7 @@ public Vector2 multiply(Vector2 other) { * Divides this vector by another * * @param other Second vector - * @return real/imaginary + * @return a/b */ public Vector2 divide(Vector2 other) { return new Vector2(this.X() / other.X(), this.Y() / other.Y()); @@ -257,7 +257,7 @@ public Vector2 divide(Vector2 other) { * Adds this vector to another * * @param other Second vector - * @return real+imaginary + * @return a+b */ public Vector2 add(Vector2 other) { return new Vector2(this.X() + other.X(), this.Y() + other.Y()); @@ -267,7 +267,7 @@ public Vector2 add(Vector2 other) { * Subtracts this vector from another * * @param other Second vector - * @return real-imaginary + * @return a-b */ public Vector2 subtract(Vector2 other) { return new Vector2(this.X() - other.X(), this.Y() - other.Y()); @@ -279,7 +279,7 @@ public Vector2 abs() { } /** - * Returns real normalized (magnitude = 1) copy of real given Vector + * Returns a normalized (magnitude = 1) copy of a given Vector * *

Special Cases: * @@ -298,7 +298,7 @@ public Vector2 normalize() { } /** - * Rotates real given vector around real point and returns the result + * Rotates a given vector around a point and returns the result * * @param rotatePoint The point to rotate around * @param angleRadians The angle to rotate in radians diff --git a/src/main/java/com/tiggerbiggo/primaplay/graphics/ImageTools.java b/src/main/java/com/tiggerbiggo/primaplay/graphics/ImageTools.java index c8e1f12..7988f38 100644 --- a/src/main/java/com/tiggerbiggo/primaplay/graphics/ImageTools.java +++ b/src/main/java/com/tiggerbiggo/primaplay/graphics/ImageTools.java @@ -7,7 +7,7 @@ public class ImageTools { public static Color colorFromPosition(SafeImage img, Vector2 pos){ //denormalise the input vector - pos = Vector2.multiply(pos, img.getDimensions()); + pos = pos.multiply(img.getDimensions()); //get x and y int x, y; diff --git a/src/main/java/com/tiggerbiggo/primaplay/graphics/SafeImage.java b/src/main/java/com/tiggerbiggo/primaplay/graphics/SafeImage.java index 35a3c56..41971af 100644 --- a/src/main/java/com/tiggerbiggo/primaplay/graphics/SafeImage.java +++ b/src/main/java/com/tiggerbiggo/primaplay/graphics/SafeImage.java @@ -52,7 +52,7 @@ public SafeImage(int width, int height) throws IllegalArgumentException { public Vector2 sizeAsVector(){return new Vector2(width, height);} public Vector2 denormVector(Vector2 in){ - return Vector2.multiply(in, sizeAsVector()); + return in.multiply(sizeAsVector()); } /** diff --git a/src/main/java/com/tiggerbiggo/primaplay/node/implemented/io/DualAnimateNode.java b/src/main/java/com/tiggerbiggo/primaplay/node/implemented/io/DualAnimateNode.java index d2d9fd8..57a8a85 100644 --- a/src/main/java/com/tiggerbiggo/primaplay/node/implemented/io/DualAnimateNode.java +++ b/src/main/java/com/tiggerbiggo/primaplay/node/implemented/io/DualAnimateNode.java @@ -27,9 +27,9 @@ public Vector2[] get(RenderParams p) { Vector2 A, B; A = inA.get(p); B = inB.get(p); - Vector2[] toReturn = new Vector2[p.n()]; - for (int i = 0; i < p.n(); i++) { - toReturn[i] = A.lerpVector(B, func.apply((double) i / p.n())); + Vector2[] toReturn = new Vector2[p.frameNum()]; + for (int i = 0; i < p.frameNum(); i++) { + toReturn[i] = A.lerpVector(B, func.apply((double) i / p.frameNum())); } return toReturn; }