Vector2

Inheritance: java.lang.Object

All Implemented Interfaces: java.lang.Comparable, com.aspose.csporter.helpers.Struct, java.io.Serializable

public final class Vector2 implements Comparable<Vector2>, Struct<Vector2>, Serializable

A vector with two components.

Constructors

ConstructorDescription
Vector2(double s)Initializes a new instance of the Vector2 struct.
Vector2(Vector3 s)Initializes a new instance of the Vector2 struct.
Vector2(FVector2 vec)Initializes a new instance of the Vector2 struct.
Vector2(double x, double y)Initializes a new instance of the Vector2 struct.
Vector2()

Fields

FieldDescription
xThe x component.
yThe y component.

Methods

MethodDescription
add(Vector2 lhs, Vector2 rhs)Addition operator for Vector2
clone()
compareTo(Vector2 other)Compare current vector to another instance.
copyFrom(Vector2 src)
create(Vector2 v)Explicit conversion operator to cast Vector2 to FVector2
cross(Vector2 v)Cross product of two vectors
div(Vector2 lhs, double rhs)Division operator for Vector2
dot(Vector2 rhs)Gets the dot product of two vectors
equals(Vector2 rhs)Check if two vector2 equals
equals(Object obj)Check if two vector2 equals
getClass()
getLength()Gets the length.
getU()Gets the U component if the Vector2 is used as a mapping coordinate.
getV()Gets the V component if the Vector2 is used as a mapping coordinate.
hashCode()Gets the hash code of Vector2
mul(Vector2 lhs, double rhs)Multiply operator for Vector2
mul(double lhs, Vector2 rhs)Multiply operator for Vector2
normalize()Normalizes this instance.
notify()
notifyAll()
op_eq(Vector2 lhs, Vector2 rhs)Equal operator for Vector2
op_ne(Vector2 lhs, Vector2 rhs)Not-equal operator for Vector2
setU(double value)Sets the U component if the Vector2 is used as a mapping coordinate.
setV(double value)Sets the V component if the Vector2 is used as a mapping coordinate.
sub(Vector2 lhs, Vector2 rhs)Subtraction operator for Vector2
toString()Returns a java.lang.String that represents the current Vector2.
wait()
wait(long arg0)
wait(long arg0, int arg1)

Vector2(double s)

public Vector2(double s)

Initializes a new instance of the Vector2 struct.

Parameters:

ParameterTypeDescription
sdoubleS.

Vector2(Vector3 s)

public Vector2(Vector3 s)

Initializes a new instance of the Vector2 struct.

Parameters:

ParameterTypeDescription
sVector3S.

Vector2(FVector2 vec)

public Vector2(FVector2 vec)

Initializes a new instance of the Vector2 struct.

Parameters:

ParameterTypeDescription
vecFVector2Vector in float.

Vector2(double x, double y)

public Vector2(double x, double y)

Initializes a new instance of the Vector2 struct.

Parameters:

ParameterTypeDescription
xdoubleThe x coordinate.
ydoubleThe y coordinate.

Vector2()

public Vector2()

x

public double x

The x component.

y

public double y

The y component.

add(Vector2 lhs, Vector2 rhs)

public static Vector2 add(Vector2 lhs, Vector2 rhs)

Addition operator for Vector2

Parameters:

ParameterTypeDescription
lhsVector2Left hand side value.
rhsVector2Right hand side value.

Returns: Vector2 - The result of addition.

clone()

public Vector2 clone()

Returns: Vector2

compareTo(Vector2 other)

public int compareTo(Vector2 other)

Compare current vector to another instance.

Parameters:

ParameterTypeDescription
otherVector2

Returns: int

copyFrom(Vector2 src)

public void copyFrom(Vector2 src)

Parameters:

ParameterTypeDescription
srcVector2

create(Vector2 v)

public static FVector2 create(Vector2 v)

Explicit conversion operator to cast Vector2 to FVector2

Parameters:

ParameterTypeDescription
vVector2

Returns: FVector2

cross(Vector2 v)

public double cross(Vector2 v)

Cross product of two vectors

Parameters:

ParameterTypeDescription
vVector2

Returns: double

div(Vector2 lhs, double rhs)

public static Vector2 div(Vector2 lhs, double rhs)

Division operator for Vector2

Parameters:

ParameterTypeDescription
lhsVector2Left hand side value.
rhsdoubleRight hand side value.

Returns: Vector2 - The result of division.

dot(Vector2 rhs)

public double dot(Vector2 rhs)

Gets the dot product of two vectors

Parameters:

ParameterTypeDescription
rhsVector2Right hand side value.

Returns: double - The dot product of the two vectors.

equals(Vector2 rhs)

public boolean equals(Vector2 rhs)

Check if two vector2 equals

Parameters:

ParameterTypeDescription
rhsVector2The right hand side value.

Returns: boolean - True if all components are identically equal.

equals(Object obj)

public boolean equals(Object obj)

Check if two vector2 equals

Parameters:

ParameterTypeDescription
objjava.lang.ObjectThe object to compare.

Returns: boolean - True if all components are identically equal.

getClass()

public final native Class<?> getClass()

Returns: java.lang.Class

getLength()

public double getLength()

Gets the length.

Returns: double

getU()

public double getU()

Gets the U component if the Vector2 is used as a mapping coordinate. It’s an alias of x component.

Returns: double

getV()

public double getV()

Gets the V component if the Vector2 is used as a mapping coordinate. It’s an alias of y component.

Returns: double

hashCode()

public int hashCode()

Gets the hash code of Vector2

Returns: int - The hash code of the Vector2

mul(Vector2 lhs, double rhs)

public static Vector2 mul(Vector2 lhs, double rhs)

Multiply operator for Vector2

Parameters:

ParameterTypeDescription
lhsVector2Left hand side value.
rhsdoubleRight hand side value.

Returns: Vector2 - The result of multiply.

mul(double lhs, Vector2 rhs)

public static Vector2 mul(double lhs, Vector2 rhs)

Multiply operator for Vector2

Parameters:

ParameterTypeDescription
lhsdoubleLeft hand side value.
rhsVector2Right hand side value.

Returns: Vector2 - The result of multiply.

normalize()

public Vector2 normalize()

Normalizes this instance.

Returns: Vector2 - Normalized vector.

notify()

public final native void notify()

notifyAll()

public final native void notifyAll()

op_eq(Vector2 lhs, Vector2 rhs)

public static boolean op_eq(Vector2 lhs, Vector2 rhs)

Equal operator for Vector2

Parameters:

ParameterTypeDescription
lhsVector2Left hand side value.
rhsVector2Right hand side value.

Returns: boolean - True if all components are identically equal.

op_ne(Vector2 lhs, Vector2 rhs)

public static boolean op_ne(Vector2 lhs, Vector2 rhs)

Not-equal operator for Vector2

Parameters:

ParameterTypeDescription
lhsVector2Left hand side value.
rhsVector2Right hand side value.

Returns: boolean - True if two vectors are not equal.

setU(double value)

public void setU(double value)

Sets the U component if the Vector2 is used as a mapping coordinate. It’s an alias of x component.

Parameters:

ParameterTypeDescription
valuedoubleNew value

setV(double value)

public void setV(double value)

Sets the V component if the Vector2 is used as a mapping coordinate. It’s an alias of y component.

Parameters:

ParameterTypeDescription
valuedoubleNew value

sub(Vector2 lhs, Vector2 rhs)

public static Vector2 sub(Vector2 lhs, Vector2 rhs)

Subtraction operator for Vector2

Parameters:

ParameterTypeDescription
lhsVector2Left hand side value.
rhsVector2Right hand side value.

Returns: Vector2 - The result of substraction.

toString()

public String toString()

Returns a java.lang.String that represents the current Vector2.

Returns: java.lang.String - A java.lang.String that represents the current Vector2.

wait()

public final void wait()

wait(long arg0)

public final void wait(long arg0)

Parameters:

ParameterTypeDescription
arg0long

wait(long arg0, int arg1)

public final void wait(long arg0, int arg1)

Parameters:

ParameterTypeDescription
arg0long
arg1int