Package com.aspose.threed
Class Vector2
- java.lang.Object
-
- com.aspose.threed.Vector2
-
- All Implemented Interfaces:
com.aspose.threed.Struct<Vector2>
,java.io.Serializable
,java.lang.Cloneable
,java.lang.Comparable<Vector2>
public final class Vector2 extends java.lang.Object implements java.lang.Comparable<Vector2>, com.aspose.threed.Struct<Vector2>, java.io.Serializable
A vector with two components.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Vector2
add(Vector2 lhs, Vector2 rhs)
Addition operator for Vector2Vector2
clone()
int
compareTo(Vector2 other)
Compare current vector to another instance.void
copyFrom(Vector2 src)
static FVector2
create(Vector2 v)
Explicit conversion operator to cast Vector2 to FVector2double
cross(Vector2 v)
Cross product of two vectorsstatic Vector2
div(Vector2 lhs, double rhs)
Division operator for Vector2double
dot(Vector2 rhs)
Gets the dot product of two vectorsboolean
equals(Vector2 rhs)
Check if two vector2 equalsboolean
equals(java.lang.Object obj)
Check if two vector2 equalsdouble
getLength()
Gets the length.double
getU()
Gets the U component if theVector2
is used as a mapping coordinate.double
getV()
Gets the V component if theVector2
is used as a mapping coordinate.int
hashCode()
Gets the hash code of Vector2static Vector2
mul(double lhs, Vector2 rhs)
Multiply operator for Vector2static Vector2
mul(Vector2 lhs, double rhs)
Multiply operator for Vector2Vector2
normalize()
Normalizes this instance.static boolean
op_eq(Vector2 lhs, Vector2 rhs)
Equal operator for Vector2static boolean
op_ne(Vector2 lhs, Vector2 rhs)
Not-equal operator for Vector2void
setU(double value)
Sets the U component if theVector2
is used as a mapping coordinate.void
setV(double value)
Sets the V component if theVector2
is used as a mapping coordinate.static Vector2
sub(Vector2 lhs, Vector2 rhs)
Subtraction operator for Vector2java.lang.String
toString()
Returns aString
that represents the currentVector2
.
-
-
-
Constructor Detail
-
Vector2
public Vector2(double s)
Initializes a new instance of theVector2
struct.- Parameters:
s
- S.
-
Vector2
public Vector2(FVector2 vec)
Initializes a new instance of theVector2
struct.- Parameters:
vec
- Vector in float.
-
Vector2
public Vector2(double x, double y)
Initializes a new instance of theVector2
struct.- Parameters:
x
- The x coordinate.y
- The y coordinate.
-
Vector2
public Vector2()
-
-
Method Detail
-
create
public static FVector2 create(Vector2 v)
Explicit conversion operator to cast Vector2 to FVector2- Parameters:
v
-
-
getU
public double getU()
Gets the U component if theVector2
is used as a mapping coordinate. It's an alias of x component.
-
setU
public void setU(double value)
Sets the U component if theVector2
is used as a mapping coordinate. It's an alias of x component.- Parameters:
value
- New value
-
getV
public double getV()
Gets the V component if theVector2
is used as a mapping coordinate. It's an alias of y component.
-
setV
public void setV(double value)
Sets the V component if theVector2
is used as a mapping coordinate. It's an alias of y component.- Parameters:
value
- New value
-
dot
public double dot(Vector2 rhs)
Gets the dot product of two vectors- Parameters:
rhs
- Right hand side value.- Returns:
- The dot product of the two vectors.
-
getLength
public double getLength()
Gets the length.
-
add
public static Vector2 add(Vector2 lhs, Vector2 rhs)
Addition operator for Vector2- Parameters:
lhs
- Left hand side value.rhs
- Right hand side value.- Returns:
- The result of addition.
-
sub
public static Vector2 sub(Vector2 lhs, Vector2 rhs)
Subtraction operator for Vector2- Parameters:
lhs
- Left hand side value.rhs
- Right hand side value.- Returns:
- The result of substraction.
-
div
public static Vector2 div(Vector2 lhs, double rhs)
Division operator for Vector2- Parameters:
lhs
- Left hand side value.rhs
- Right hand side value.- Returns:
- The result of division.
-
mul
public static Vector2 mul(Vector2 lhs, double rhs)
Multiply operator for Vector2- Parameters:
lhs
- Left hand side value.rhs
- Right hand side value.- Returns:
- The result of multiply.
-
mul
public static Vector2 mul(double lhs, Vector2 rhs)
Multiply operator for Vector2- Parameters:
lhs
- Left hand side value.rhs
- Right hand side value.- Returns:
- The result of multiply.
-
op_eq
public static boolean op_eq(Vector2 lhs, Vector2 rhs)
Equal operator for Vector2- 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(Vector2 lhs, Vector2 rhs)
Not-equal operator for Vector2- Parameters:
lhs
- Left hand side value.rhs
- Right hand side value.- Returns:
- True if two vectors are not equal.
-
equals
public boolean equals(Vector2 rhs)
Check if two vector2 equals- Parameters:
rhs
- The right hand side value.- Returns:
- True if all components are identically equal.
-
equals
public boolean equals(java.lang.Object obj)
Check if two vector2 equals- Overrides:
equals
in classjava.lang.Object
- Parameters:
obj
- The object to compare.- Returns:
- True if all components are identically equal.
-
toString
public java.lang.String toString()
Returns aString
that represents the currentVector2
.- Overrides:
toString
in classjava.lang.Object
- Returns:
- A
String
that represents the currentVector2
.
-
cross
public double cross(Vector2 v)
Cross product of two vectors- Parameters:
v
-
-
normalize
public Vector2 normalize()
Normalizes this instance.- Returns:
- Normalized vector.
-
compareTo
public int compareTo(Vector2 other)
Compare current vector to another instance.- Specified by:
compareTo
in interfacejava.lang.Comparable<Vector2>
- Parameters:
other
-
-
clone
public Vector2 clone()
- Specified by:
clone
in interfacecom.aspose.threed.Struct<Vector2>
- Overrides:
clone
in classjava.lang.Object
-
copyFrom
public void copyFrom(Vector2 src)
- Specified by:
copyFrom
in interfacecom.aspose.threed.Struct<Vector2>
-
hashCode
public int hashCode()
Gets the hash code of Vector2- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- The hash code of the
Vector2
-
-