Skip to main content

Point2

class Point2

Point2 is a Vector with 2 positions, respectively, X and Y, usually used in 2D dimension space, exactly the same as Vector2, but instead of being measured in float, they are measured in int if you need it from an array to 3 positions, use Point3. They are used to map on-screen button positions, on-screen touch position, etc.


public class Point2

— Constructors (2) —

ConstructorDescription
Point2()Creates a new Point2.
Point2(int x, int y)Creates a new Point2 with X and Y setted as "x" and "y" arguments respectively.

— Methods (45) —

NameDescription
int getX()Return the current X value inside of this Point2.
void setX(int value)Sets the current X value inside of this Point2 with a new value.
int getY()Return the current Y value inside of this Point2.
void setY(int value)Sets the current Y value inside of this Point2 with a new value.
Point2 mul(Point2 value)Multiplies the current Point2 values with the input Point2 values and return a new instance with these multiplied values.
Point2 mul(int x, int y)Multiplies the current Point2 values with the input X and Y values and return a new instance with these multiplied values.
Point2 mul(int a)Multiplies the current Point2 values with the input "a" and return a new instance of these multiplied values.
Point2 div(Point2 value)Divides the current Point2 values with the input vector values and return a new instance with these divided values.
Point2 div(int x, int y)Divides the current Point2 values with the input X and Y values and return a new instance with these divided values.
Point2 div(int a)Divides the current Point2 values with the input "a" and return a new instance with these divided values.
Point2 sum(Point2 value)Increments the current Point2 values with the input Point2 values and return a new instance with these incremented values.
Point2 sum(int x, int y)Increments the current Point2 values with the input X and Y values and return a new instance with these incremented values.
Point2 sum(int a)Increments the current Point2 values with the input "a" and return a new instance with these incremented values.
Point2 sub(Point2 value)Subtracts the current Point2 values with the input Point2 values and return a new instance with these subtracted values.
Point2 sub(int x, int y)Subtracts the current Point2 values with the input X and Y and return a new instance with these subtracted values.
Point2 sub(int a)Subtracts the current Point2 values with the input "a" and return a new instance with these subtracted values.
boolean equals(Point2 point2)Compares first Point2 with argument value, returns true if values match.
boolean equals(int x, int y)Compares the Point2 with the value of the arguments respectively x and y, returns true if the values match.
boolean equals(int a)Compares first Point2 with argument value, returns true if values match.
void set(Point2 point2)Sets the current value within this Point2 with a new Point2 of the argument.
void set(int x, int y)Sets the current x and y value within this Point2 to a new value.
void set(int a)Sets the current value within this Point2 to a new value.
void lerp(Point2 point2, int speed)Transforms a Point2 into a smoothed form Point2 based on a velocity.
void lerp(int x, int y, int speed)Smooths one Point2 into another, respectively x and y based on a velocity.
void lerp(int a, int speed)Transforms a Point2 into a smoothed form Point2 based on a velocity.
void lerpInSeconds(Point2 point2, int speed)Smooths one Point2 into another, based on a speed multiplied by "Math.bySecond(1)".
void lerpInSeconds(int x, int y, int speed)Smooths one Point2 into another, respectively x and y based on a velocity multiplied by "Math.bySecond(1)".
void lerpInSeconds(int a, int speed)Smooths one Point2 into another, based on a speed multiplied by "Math.bySecond(1)".
void blend(Point2 point2, int blend)Mix the Point2 with another.
void blend(int x, int y, int blend)Mixes the Point2 with another, respectively, x and y, given a 0-1 percentage.
void blend(int a, int blend)Mix the Point2 with another, given a 0-1 percentage.
Point2 normalize()Makes the Point2 have a magnitude of 1, Point3 keeps the same direction but its length is 1.0, if the Point2 is too small to normalize, it is set to zero.
void normalizeLocal()Makes the Point2 have magnitude 1, the Point2 keeps the same direction, but its length is 1.0, the difference to "normalize" is that this method applies the modification to the Point2 itself, if the Point2 is too small to normalize , is set to zero.
float length()Returns the length of the Point2 with the square root.
float sqrLength()Returns the length of the Point2 without square root.
float distance(Point2 point2)Returns the distance between two Point2 with the square root.
float sqrDistance(Point2 point2)Returns the distance between two Point2 without the square root.
float dot(Point2 point2)Calculates the dot product of this Point2 and the Point2 passed to be "point2" argument and returns the value.
float dot(int x, int y)Calculates the dot product of this Point2 and the values passed, x, and y to be "x" and "y" arguments and returns the value.
float dot(int a)Calculates the dot product of this Point2 and the value passed to be "a" argument and returns the value.
Vector3 cross(Point2 point2)Cross Product of two Point2. The cross product of two Point2 results in a third Point2 which is perpendicular to the two input Point2.The result's magnitude is equal to the magnitudes of the two inputs multiplied together and then multiplied by the sine of the angle between the inputs.
Vector3 cross(int x, int y)Cross product of two Point2, respectively x, and y, the cross product of two Point2 results in a third Point2 that is perpendicular to the two input Point2. The magnitude of the result is equal to the magnitudes of the two inputs multiplied together and then multiplied by the sine of the angle between the inputs.
Point2 copy()Returns the perfect copy of a Point2.
String toString()Returns Point2 values to a String.
[static Point2 zero()Returns a new Point2 with its axes at 0.