Package com.aspose.threed
Class Vector3
- java.lang.Object
-
- com.aspose.threed.Vector3
-
- All Implemented Interfaces:
com.aspose.threed.Struct<Vector3>
,java.io.Serializable
,java.lang.Cloneable
,java.lang.Comparable<Vector3>
public final class Vector3 extends java.lang.Object implements java.lang.Comparable<Vector3>, com.aspose.threed.Struct<Vector3>, java.io.Serializable
A vector with three components.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static Vector3
ORIGIN
Gets the origin position.static Vector3
UNIT_SCALE
Gets the unit scale vector.double
x
The x component.static Vector3
X_AXIS
Gets the X axis.double
y
The y component.static Vector3
Y_AXIS
Gets the Y axis.double
z
The z component.static Vector3
Z_AXIS
Gets the Z axis.
-
Constructor Summary
Constructors Constructor Description Vector3()
Vector3(double v)
Initializes a new instance of theVector3
struct.Vector3(double x, double y, double z)
Initializes a new instance of theVector3
struct.Vector3(FVector3 vec)
Initializes a new instance of theVector3
struct.Vector3(Vector4 vec4)
Initializes a new instance of theVector3
struct.Vector3(java.awt.Color color)
Initializes a new instance of theVector3
struct.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Vector3
add(Vector3 lhs, Vector3 rhs)
Operator overloading for +double
angleBetween(Vector3 dir)
Calculate the inner angle between two direction Two direction can be non-normalized vectorsdouble
angleBetween(Vector3 dir, Vector3 up)
Calculate the inner angle between two direction Two direction can be non-normalized vectorsVector3
clone()
int
compareTo(Vector3 other)
Compare current vector to another instance.void
copyFrom(Vector3 src)
Vector3
cos()
Calculates cosine on each componentstatic FVector3
create(Vector3 v)
Explicit conversion operator to cast Vector3 to FVector3Vector3
cross(Vector3 rhs)
Cross product of two vectorsstatic Vector3
div(Vector3 lhs, double rhs)
Operator overloading for /double
dot(Vector3 rhs)
Gets the dot product of two vectorsboolean
equals(java.lang.Object obj)
Check if two vector3 equalsdouble
getLength()
Gets the length of this vector.double
getLength2()
Gets the square of the length.int
hashCode()
Gets the hash code of Vector3static Vector3
mul(double lhs, Vector3 rhs)
Operator overloading for *static Vector3
mul(Vector3 lhs, double rhs)
Operator overloading for *static Vector3
mul(Vector3 lhs, Vector3 rhs)
Operator overloading for *static Vector3
negative(Vector3 v)
Operator overloading for -Vector3
normalize()
Normalizes this instance.static boolean
op_eq(Vector3 lhs, Vector3 rhs)
Equal operator for Vector3static boolean
op_ne(Vector3 lhs, Vector3 rhs)
Not-equal operator for Vector3void
set(double newX, double newY, double newZ)
Sets the x/y/z component in one call.Vector3
sin()
Calculates sine on each componentstatic Vector3
sub(Vector3 lhs, Vector3 rhs)
Operator overloading for - (minus)java.lang.String
toString()
Returns aString
that represents the currentVector3
.
-
-
-
Field Detail
-
x
public double x
The x component.
-
y
public double y
The y component.
-
z
public double z
The z component.
-
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.
-
-
Constructor Detail
-
Vector3
public Vector3(double x, double y, double z)
Initializes a new instance of theVector3
struct.- Parameters:
x
- The x coordinate.y
- The y coordinate.z
- The z coordinate.
-
Vector3
public Vector3(FVector3 vec)
Initializes a new instance of theVector3
struct.- Parameters:
vec
- The x coordinate.
-
Vector3
public Vector3(java.awt.Color color)
Initializes a new instance of theVector3
struct.- Parameters:
color
- Color.
-
Vector3
public Vector3(double v)
Initializes a new instance of theVector3
struct.- Parameters:
v
- V.
-
Vector3
public Vector3(Vector4 vec4)
Initializes a new instance of theVector3
struct.- Parameters:
vec4
- Vec4.
-
Vector3
public Vector3()
-
-
Method Detail
-
equals
public boolean equals(java.lang.Object obj)
Check if two vector3 equals- Overrides:
equals
in classjava.lang.Object
- Parameters:
obj
- The object to check equality.- Returns:
- True if all components are identically equal.
-
create
public static FVector3 create(Vector3 v)
Explicit conversion operator to cast Vector3 to FVector3- Parameters:
v
-
-
dot
public double dot(Vector3 rhs)
Gets the dot product of two vectors- Parameters:
rhs
- Right hand side value.- Returns:
- The dot product of the two vectors.
-
normalize
public Vector3 normalize()
Normalizes this instance.- Returns:
- Normalized vector.
-
getLength2
public double getLength2()
Gets the square of the length.
-
getLength
public double getLength()
Gets the length of this vector.
-
cross
public Vector3 cross(Vector3 rhs)
Cross product of two vectors- Parameters:
rhs
- Right hand side value.- Returns:
- Cross product of two
Vector3
s.
-
negative
public static Vector3 negative(Vector3 v)
Operator overloading for -- Parameters:
v
- The origin vector- Returns:
- Result vector
-
sub
public static Vector3 sub(Vector3 lhs, Vector3 rhs)
Operator overloading for - (minus)- Parameters:
lhs
- The left vectorrhs
- The right vector- Returns:
- Result vector
-
add
public static Vector3 add(Vector3 lhs, Vector3 rhs)
Operator overloading for +- Parameters:
lhs
- The left vectorrhs
- The right vector- Returns:
- Result vector
-
mul
public static Vector3 mul(Vector3 lhs, Vector3 rhs)
Operator overloading for *- Parameters:
lhs
- The left vectorrhs
- The right vector- Returns:
- Result vector
-
mul
public static Vector3 mul(double lhs, Vector3 rhs)
Operator overloading for *- Parameters:
lhs
- The left scalarrhs
- The right vector- Returns:
- Result vector
-
mul
public static Vector3 mul(Vector3 lhs, double rhs)
Operator overloading for *- Parameters:
lhs
- The left vectorrhs
- The right double value- Returns:
- Result vector
-
div
public static Vector3 div(Vector3 lhs, double rhs)
Operator overloading for /- Parameters:
lhs
- The left vectorrhs
- The right double value- Returns:
- Result vector
-
op_eq
public static boolean op_eq(Vector3 lhs, Vector3 rhs)
Equal operator for Vector3- Parameters:
lhs
- Left hand side value.rhs
- Right hand side value.- Returns:
- True if all components are identically equal.
-
op_ne
public static boolean op_ne(Vector3 lhs, Vector3 rhs)
Not-equal operator for Vector3- Parameters:
lhs
- Left hand side value.rhs
- Right hand side value.- Returns:
- True if two vectors are not equal.
-
set
public void set(double newX, double newY, double newZ)
Sets the x/y/z component in one call.- Parameters:
newX
- The x component.newY
- The y component.newZ
- The z component.
-
toString
public java.lang.String toString()
Returns aString
that represents the currentVector3
.- Overrides:
toString
in classjava.lang.Object
- Returns:
- A
String
that represents the currentVector3
.
-
angleBetween
public double angleBetween(Vector3 dir, Vector3 up)
Calculate the inner angle between two direction Two direction can be non-normalized vectors- Parameters:
dir
- The direction vector to compare withup
- The up vector of the two direction's shared plane- Returns:
- inner angle in radian
-
angleBetween
public double angleBetween(Vector3 dir)
Calculate the inner angle between two direction Two direction can be non-normalized vectors- Parameters:
dir
- The direction vector to compare with- Returns:
- inner angle in radian
-
compareTo
public int compareTo(Vector3 other)
Compare current vector to another instance.- Specified by:
compareTo
in interfacejava.lang.Comparable<Vector3>
- Parameters:
other
-
-
clone
public Vector3 clone()
- Specified by:
clone
in interfacecom.aspose.threed.Struct<Vector3>
- Overrides:
clone
in classjava.lang.Object
-
copyFrom
public void copyFrom(Vector3 src)
- Specified by:
copyFrom
in interfacecom.aspose.threed.Struct<Vector3>
-
hashCode
public int hashCode()
Gets the hash code of Vector3- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- The hash code of the
Vector3
-
-