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
Constructor | Description |
---|---|
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
Field | Description |
---|---|
ORIGIN | Gets the origin position. |
UNIT_SCALE | Gets the unit scale vector. |
X_AXIS | Gets the X axis. |
Y_AXIS | Gets the Y axis. |
Z_AXIS | Gets the Z axis. |
x | The x component. |
y | The y component. |
z | The z component. |
Methods
Method | Description |
---|---|
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:
Parameter | Type | Description |
---|---|---|
x | double | The x coordinate. |
y | double | The y coordinate. |
z | double | The z coordinate. |
Vector3(FVector3 vec)
public Vector3(FVector3 vec)
Initializes a new instance of the Vector3 struct.
Parameters:
Parameter | Type | Description |
---|---|---|
vec | FVector3 | The x coordinate. |
Vector3(double v)
public Vector3(double v)
Initializes a new instance of the Vector3 struct.
Parameters:
Parameter | Type | Description |
---|---|---|
v | double | V. |
Vector3(Vector4 vec4)
public Vector3(Vector4 vec4)
Initializes a new instance of the Vector3 struct.
Parameters:
Parameter | Type | Description |
---|---|---|
vec4 | Vector4 | Vec4. |
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:
Parameter | Type | Description |
---|---|---|
lhs | Vector3 | The left vector |
rhs | Vector3 | The 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:
Parameter | Type | Description |
---|---|---|
dir | Vector3 | The 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:
Parameter | Type | Description |
---|---|---|
dir | Vector3 | The direction vector to compare with |
up | Vector3 | The 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:
Parameter | Type | Description |
---|---|---|
other | Vector3 |
Returns: int
copyFrom(Vector3 src)
public void copyFrom(Vector3 src)
Parameters:
Parameter | Type | Description |
---|---|---|
src | Vector3 |
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:
Parameter | Type | Description |
---|---|---|
v | Vector3 |
Returns: FVector3
cross(Vector3 rhs)
public Vector3 cross(Vector3 rhs)
Cross product of two vectors
Parameters:
Parameter | Type | Description |
---|---|---|
rhs | Vector3 | Right 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:
Parameter | Type | Description |
---|---|---|
lhs | Vector3 | The left vector |
rhs | Vector3 | The right vector |
Returns: Vector3 - Result vector
div(Vector3 lhs, double rhs)
public static Vector3 div(Vector3 lhs, double rhs)
Operator overloading for /
Parameters:
Parameter | Type | Description |
---|---|---|
lhs | Vector3 | The left vector |
rhs | double | The right double value |
Returns: Vector3 - Result vector
dot(Vector3 rhs)
public double dot(Vector3 rhs)
Gets the dot product of two vectors
Parameters:
Parameter | Type | Description |
---|---|---|
rhs | Vector3 | Right 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:
Parameter | Type | Description |
---|---|---|
obj | java.lang.Object | The 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:
Parameter | Type | Description |
---|---|---|
idx | int |
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:
Parameter | Type | Description |
---|---|---|
lhs | Vector3 | The left vector |
rhs | Vector3 | The right vector |
Returns: Vector3 - Result vector
mul(Vector3 lhs, double rhs)
public static Vector3 mul(Vector3 lhs, double rhs)
Operator overloading for *
Parameters:
Parameter | Type | Description |
---|---|---|
lhs | Vector3 | The left vector |
rhs | double | The right double value |
Returns: Vector3 - Result vector
mul(double lhs, Vector3 rhs)
public static Vector3 mul(double lhs, Vector3 rhs)
Operator overloading for *
Parameters:
Parameter | Type | Description |
---|---|---|
lhs | double | The left scalar |
rhs | Vector3 | The right vector |
Returns: Vector3 - Result vector
negative(Vector3 v)
public static Vector3 negative(Vector3 v)
Operator overloading for -
Parameters:
Parameter | Type | Description |
---|---|---|
v | Vector3 | The 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:
Parameter | Type | Description |
---|---|---|
lhs | Vector3 | Left hand side value. |
rhs | Vector3 | Right 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:
Parameter | Type | Description |
---|---|---|
lhs | Vector3 | Left hand side value. |
rhs | Vector3 | Right 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:
Parameter | Type | Description |
---|---|---|
newX | double | The x component. |
newY | double | The y component. |
newZ | double | The z component. |
set(int idx, double value)
public void set(int idx, double value)
Sets vector’s component by index.
Parameters:
Parameter | Type | Description |
---|---|---|
idx | int | |
value | double | New 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:
Parameter | Type | Description |
---|---|---|
lhs | Vector3 | The left vector |
rhs | Vector3 | The 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:
Parameter | Type | Description |
---|---|---|
arg0 | long |
wait(long arg0, int arg1)
public final void wait(long arg0, int arg1)
Parameters:
Parameter | Type | Description |
---|---|---|
arg0 | long | |
arg1 | int |