Vector3

Inheritance: java.lang.Object

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

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

A vector with three components.

Constructors

ConstructorDescription
Vector3(double x, double y, double z)Initializes a new instance of the Vector3 struct.
Vector3(FVector3 vec)Initializes a new instance of the Vector3 struct.
Vector3(double v)Initializes a new instance of the Vector3 struct.
Vector3(Vector4 vec4)Initializes a new instance of the Vector3 struct.
Vector3()

Fields

FieldDescription
ORIGINGets the origin position.
UNIT_SCALEGets the unit scale vector.
X_AXISGets the X axis.
Y_AXISGets the Y axis.
Z_AXISGets the Z axis.
xThe x component.
yThe y component.
zThe z component.

Methods

MethodDescription
add(Vector3 lhs, Vector3 rhs)Operator overloading for +
angleBetween(Vector3 dir)Calculate the inner angle between two direction Two direction can be non-normalized vectors
angleBetween(Vector3 dir, Vector3 up)Calculate the inner angle between two direction Two direction can be non-normalized vectors
clone()
compareTo(Vector3 other)Compare current vector to another instance.
copyFrom(Vector3 src)
cos()Calculates cosine on each component
create(Vector3 v)Explicit conversion operator to cast Vector3 to FVector3
cross(Vector3 rhs)Cross product of two vectors
div(Vector3 lhs, Vector3 rhs)Operator overloading for /
div(Vector3 lhs, double rhs)Operator overloading for /
dot(Vector3 rhs)Gets the dot product of two vectors
equals(Object obj)Check if two vector3 equals
get(int idx)Gets vector’s component by index.
getClass()
getLength()Gets the length of this vector.
getLength2()Gets the square of the length.
getOne()Gets unit vector (1, 1, 1)
getUnitX()Gets unit vector (1, 0, 0)
getUnitY()Gets unit vector (0, 1, 0)
getUnitZ()Gets unit vector (0, 0, 1)
getZero()Gets unit vector (0, 0, 0)
hashCode()Gets the hash code of Vector3
mul(Vector3 lhs, Vector3 rhs)Operator overloading for *
mul(Vector3 lhs, double rhs)Operator overloading for *
mul(double lhs, Vector3 rhs)Operator overloading for *
negative(Vector3 v)Operator overloading for -
normalize()Normalizes this instance.
notify()
notifyAll()
op_eq(Vector3 lhs, Vector3 rhs)Equal operator for Vector3
op_ne(Vector3 lhs, Vector3 rhs)Not-equal operator for Vector3
set(double newX, double newY, double newZ)Sets the x/y/z component in one call.
set(int idx, double value)Sets vector’s component by index.
sin()Calculates sine on each component
sub(Vector3 lhs, Vector3 rhs)Operator overloading for - (minus)
toString()Returns a java.lang.String that represents the current Vector3.
wait()
wait(long arg0)
wait(long arg0, int arg1)

Vector3(double x, double y, double z)

public Vector3(double x, double y, double z)

Initializes a new instance of the Vector3 struct.

Parameters:

ParameterTypeDescription
xdoubleThe x coordinate.
ydoubleThe y coordinate.
zdoubleThe z coordinate.

Vector3(FVector3 vec)

public Vector3(FVector3 vec)

Initializes a new instance of the Vector3 struct.

Parameters:

ParameterTypeDescription
vecFVector3The x coordinate.

Vector3(double v)

public Vector3(double v)

Initializes a new instance of the Vector3 struct.

Parameters:

ParameterTypeDescription
vdoubleV.

Vector3(Vector4 vec4)

public Vector3(Vector4 vec4)

Initializes a new instance of the Vector3 struct.

Parameters:

ParameterTypeDescription
vec4Vector4Vec4.

Vector3()

public Vector3()

ORIGIN

public static final Vector3 ORIGIN

Gets the origin position.

UNIT_SCALE

public static final Vector3 UNIT_SCALE

Gets the unit scale vector.

X_AXIS

public static final Vector3 X_AXIS

Gets the X axis.

Y_AXIS

public static final Vector3 Y_AXIS

Gets the Y axis.

Z_AXIS

public static final Vector3 Z_AXIS

Gets the Z axis.

x

public double x

The x component.

y

public double y

The y component.

z

public double z

The z component.

add(Vector3 lhs, Vector3 rhs)

public static Vector3 add(Vector3 lhs, Vector3 rhs)

Operator overloading for +

Parameters:

ParameterTypeDescription
lhsVector3The left vector
rhsVector3The right vector

Returns: Vector3 - Result vector

angleBetween(Vector3 dir)

public double angleBetween(Vector3 dir)

Calculate the inner angle between two direction Two direction can be non-normalized vectors

Parameters:

ParameterTypeDescription
dirVector3The direction vector to compare with

Returns: double - inner angle in radian

angleBetween(Vector3 dir, Vector3 up)

public double angleBetween(Vector3 dir, Vector3 up)

Calculate the inner angle between two direction Two direction can be non-normalized vectors

Parameters:

ParameterTypeDescription
dirVector3The direction vector to compare with
upVector3The up vector of the two direction’s shared plane

Returns: double - inner angle in radian

clone()

public Vector3 clone()

Returns: Vector3

compareTo(Vector3 other)

public int compareTo(Vector3 other)

Compare current vector to another instance.

Parameters:

ParameterTypeDescription
otherVector3

Returns: int

copyFrom(Vector3 src)

public void copyFrom(Vector3 src)

Parameters:

ParameterTypeDescription
srcVector3

cos()

public Vector3 cos()

Calculates cosine on each component

Returns: Vector3 - Calculated Vector3.

create(Vector3 v)

public static FVector3 create(Vector3 v)

Explicit conversion operator to cast Vector3 to FVector3

Parameters:

ParameterTypeDescription
vVector3

Returns: FVector3

cross(Vector3 rhs)

public Vector3 cross(Vector3 rhs)

Cross product of two vectors

Parameters:

ParameterTypeDescription
rhsVector3Right hand side value.

Returns: Vector3 - Cross product of two Vector3s.

div(Vector3 lhs, Vector3 rhs)

public static Vector3 div(Vector3 lhs, Vector3 rhs)

Operator overloading for /

Parameters:

ParameterTypeDescription
lhsVector3The left vector
rhsVector3The right vector

Returns: Vector3 - Result vector

div(Vector3 lhs, double rhs)

public static Vector3 div(Vector3 lhs, double rhs)

Operator overloading for /

Parameters:

ParameterTypeDescription
lhsVector3The left vector
rhsdoubleThe right double value

Returns: Vector3 - Result vector

dot(Vector3 rhs)

public double dot(Vector3 rhs)

Gets the dot product of two vectors

Parameters:

ParameterTypeDescription
rhsVector3Right hand side value.

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

equals(Object obj)

public boolean equals(Object obj)

Check if two vector3 equals

Parameters:

ParameterTypeDescription
objjava.lang.ObjectThe object to check equality.

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

get(int idx)

public double get(int idx)

Gets vector’s component by index.

Parameters:

ParameterTypeDescription
idxint

Returns: double

getClass()

public final native Class<?> getClass()

Returns: java.lang.Class

getLength()

public double getLength()

Gets the length of this vector.

Returns: double

getLength2()

public double getLength2()

Gets the square of the length.

Returns: double

getOne()

public static Vector3 getOne()

Gets unit vector (1, 1, 1)

Returns: Vector3

getUnitX()

public static Vector3 getUnitX()

Gets unit vector (1, 0, 0)

Returns: Vector3

getUnitY()

public static Vector3 getUnitY()

Gets unit vector (0, 1, 0)

Returns: Vector3

getUnitZ()

public static Vector3 getUnitZ()

Gets unit vector (0, 0, 1)

Returns: Vector3

getZero()

public static Vector3 getZero()

Gets unit vector (0, 0, 0)

Returns: Vector3

hashCode()

public int hashCode()

Gets the hash code of Vector3

Returns: int - The hash code of the Vector3

mul(Vector3 lhs, Vector3 rhs)

public static Vector3 mul(Vector3 lhs, Vector3 rhs)

Operator overloading for *

Parameters:

ParameterTypeDescription
lhsVector3The left vector
rhsVector3The right vector

Returns: Vector3 - Result vector

mul(Vector3 lhs, double rhs)

public static Vector3 mul(Vector3 lhs, double rhs)

Operator overloading for *

Parameters:

ParameterTypeDescription
lhsVector3The left vector
rhsdoubleThe right double value

Returns: Vector3 - Result vector

mul(double lhs, Vector3 rhs)

public static Vector3 mul(double lhs, Vector3 rhs)

Operator overloading for *

Parameters:

ParameterTypeDescription
lhsdoubleThe left scalar
rhsVector3The right vector

Returns: Vector3 - Result vector

negative(Vector3 v)

public static Vector3 negative(Vector3 v)

Operator overloading for -

Parameters:

ParameterTypeDescription
vVector3The origin vector

Returns: Vector3 - Result vector

normalize()

public Vector3 normalize()

Normalizes this instance.

Returns: Vector3 - Normalized vector.

notify()

public final native void notify()

notifyAll()

public final native void notifyAll()

op_eq(Vector3 lhs, Vector3 rhs)

public static boolean op_eq(Vector3 lhs, Vector3 rhs)

Equal operator for Vector3

Parameters:

ParameterTypeDescription
lhsVector3Left hand side value.
rhsVector3Right hand side value.

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

op_ne(Vector3 lhs, Vector3 rhs)

public static boolean op_ne(Vector3 lhs, Vector3 rhs)

Not-equal operator for Vector3

Parameters:

ParameterTypeDescription
lhsVector3Left hand side value.
rhsVector3Right hand side value.

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

set(double newX, double newY, double newZ)

public void set(double newX, double newY, double newZ)

Sets the x/y/z component in one call.

Parameters:

ParameterTypeDescription
newXdoubleThe x component.
newYdoubleThe y component.
newZdoubleThe z component.

set(int idx, double value)

public void set(int idx, double value)

Sets vector’s component by index.

Parameters:

ParameterTypeDescription
idxint
valuedoubleNew value

sin()

public Vector3 sin()

Calculates sine on each component

Returns: Vector3 - Calculated Vector3.

sub(Vector3 lhs, Vector3 rhs)

public static Vector3 sub(Vector3 lhs, Vector3 rhs)

Operator overloading for - (minus)

Parameters:

ParameterTypeDescription
lhsVector3The left vector
rhsVector3The right vector

Returns: Vector3 - Result vector

toString()

public String toString()

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

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

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