public final class Vector2 extends java.lang.Object implements java.lang.Comparable<Vector2>, Struct<Vector2>, java.io.Serializable
| Modifier and Type | Field and Description |
|---|---|
double |
x
The x component.
|
double |
y
The y component.
|
| Constructor and Description |
|---|
Vector2() |
Vector2(double s)
Initializes a new instance of the
Vector2 struct. |
Vector2(double x,
double y)
Initializes a new instance of the
Vector2 struct. |
Vector2(FVector2 vec)
Initializes a new instance of the
Vector2 struct. |
Vector2(Vector3 s)
Initializes a new instance of the
Vector2 struct. |
| Modifier and Type | Method and Description |
|---|---|
static Vector2 |
add(Vector2 lhs,
Vector2 rhs)
Addition operator for Vector2
|
Vector2 |
clone()
Clone current instance
|
int |
compareTo(Vector2 other)
Compare current vector to another instance.
|
void |
copyFrom(Vector2 src)
Copy internal state from argument t
|
static FVector2 |
create(Vector2 v)
Explicit conversion operator to cast Vector2 to FVector2
|
double |
cross(Vector2 v)
Cross product of two vectors
|
static Vector2 |
div(Vector2 lhs,
double rhs)
Division operator for Vector2
|
double |
dot(Vector2 rhs)
Gets the dot product of two vectors
|
boolean |
equals(java.lang.Object obj)
Check if two vector2 equals
|
boolean |
equals(Vector2 rhs)
Check if two vector2 equals
|
double |
getLength()
Gets the length.
|
double |
getU()
Gets the U component if the
Vector2 is used as a mapping coordinate. |
double |
getV()
Gets the V component if the
Vector2 is used as a mapping coordinate. |
int |
hashCode()
Gets the hash code of Vector2
|
static Vector2 |
mul(double lhs,
Vector2 rhs)
Multiply operator for Vector2
|
static Vector2 |
mul(Vector2 lhs,
double rhs)
Multiply operator for Vector2
|
Vector2 |
normalize()
Normalizes this instance.
|
static boolean |
op_eq(Vector2 lhs,
Vector2 rhs)
Equal operator for Vector2
|
static boolean |
op_ne(Vector2 lhs,
Vector2 rhs)
Not-equal operator for Vector2
|
void |
setU(double value)
Sets the U component if the
Vector2 is used as a mapping coordinate. |
void |
setV(double value)
Sets the V component if the
Vector2 is used as a mapping coordinate. |
static Vector2 |
sub(Vector2 lhs,
Vector2 rhs)
Subtraction operator for Vector2
|
java.lang.String |
toString()
Returns a
String that represents the current Vector2. |
public Vector2(double s)
Vector2 struct.s - S.public Vector2(Vector3 s)
Vector2 struct.s - S.public Vector2(FVector2 vec)
Vector2 struct.vec - Vector in float.public Vector2(double x,
double y)
Vector2 struct.x - The x coordinate.y - The y coordinate.public Vector2()
public static FVector2 create(Vector2 v)
public double getU()
Vector2 is used as a mapping coordinate.
It's an alias of x component.Vector2 is used as a mapping coordinate.
It's an alias of x component.public void setU(double value)
Vector2 is used as a mapping coordinate.
It's an alias of x component.value - New valuepublic double getV()
Vector2 is used as a mapping coordinate.
It's an alias of y component.Vector2 is used as a mapping coordinate.
It's an alias of y component.public void setV(double value)
Vector2 is used as a mapping coordinate.
It's an alias of y component.value - New valuepublic double dot(Vector2 rhs)
rhs - Right hand side value.public double getLength()
public static Vector2 add(Vector2 lhs, Vector2 rhs)
lhs - Left hand side value.rhs - Right hand side value.public static Vector2 sub(Vector2 lhs, Vector2 rhs)
lhs - Left hand side value.rhs - Right hand side value.public static Vector2 div(Vector2 lhs, double rhs)
lhs - Left hand side value.rhs - Right hand side value.public static Vector2 mul(Vector2 lhs, double rhs)
lhs - Left hand side value.rhs - Right hand side value.public static Vector2 mul(double lhs, Vector2 rhs)
lhs - Left hand side value.rhs - Right hand side value.public static boolean op_eq(Vector2 lhs, Vector2 rhs)
lhs - Left hand side value.rhs - Right hand side value.public static boolean op_ne(Vector2 lhs, Vector2 rhs)
lhs - Left hand side value.rhs - Right hand side value.public boolean equals(Vector2 rhs)
rhs - The right hand side value.public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectobj - The object to compare.public java.lang.String toString()
String that represents the current Vector2.toString in class java.lang.ObjectString that represents the current Vector2.public double cross(Vector2 v)
public Vector2 normalize()
public int compareTo(Vector2 other)
compareTo in interface java.lang.Comparable<Vector2>public void copyFrom(Vector2 src)
Structpublic int hashCode()
hashCode in class java.lang.ObjectVector2