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 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 the Vector3 struct.
        Parameters:
        x - The x coordinate.
        y - The y coordinate.
        z - The z coordinate.
      • Vector3

        public Vector3​(FVector3 vec)
        Initializes a new instance of the Vector3 struct.
        Parameters:
        vec - The x coordinate.
      • Vector3

        public Vector3​(java.awt.Color color)
        Initializes a new instance of the Vector3 struct.
        Parameters:
        color - Color.
      • Vector3

        public Vector3​(double v)
        Initializes a new instance of the Vector3 struct.
        Parameters:
        v - V.
      • Vector3

        public Vector3​(Vector4 vec4)
        Initializes a new instance of the Vector3 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 class java.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.
      • sin

        public Vector3 sin()
        Calculates sine on each component
        Returns:
        Calculated Vector3.
      • cos

        public Vector3 cos()
        Calculates cosine on each component
        Returns:
        Calculated Vector3.
      • cross

        public Vector3 cross​(Vector3 rhs)
        Cross product of two vectors
        Parameters:
        rhs - Right hand side value.
        Returns:
        Cross product of two Vector3s.
      • 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 vector
        rhs - The right vector
        Returns:
        Result vector
      • add

        public static Vector3 add​(Vector3 lhs,
                                  Vector3 rhs)
        Operator overloading for +
        Parameters:
        lhs - The left vector
        rhs - The right vector
        Returns:
        Result vector
      • mul

        public static Vector3 mul​(Vector3 lhs,
                                  Vector3 rhs)
        Operator overloading for *
        Parameters:
        lhs - The left vector
        rhs - The right vector
        Returns:
        Result vector
      • mul

        public static Vector3 mul​(double lhs,
                                  Vector3 rhs)
        Operator overloading for *
        Parameters:
        lhs - The left scalar
        rhs - The right vector
        Returns:
        Result vector
      • mul

        public static Vector3 mul​(Vector3 lhs,
                                  double rhs)
        Operator overloading for *
        Parameters:
        lhs - The left vector
        rhs - The right double value
        Returns:
        Result vector
      • div

        public static Vector3 div​(Vector3 lhs,
                                  double rhs)
        Operator overloading for /
        Parameters:
        lhs - The left vector
        rhs - 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 a String that represents the current Vector3.
        Overrides:
        toString in class java.lang.Object
        Returns:
        A String that represents the current Vector3.
      • 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 with
        up - 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 interface java.lang.Comparable<Vector3>
        Parameters:
        other -
      • clone

        public Vector3 clone()
        Specified by:
        clone in interface com.aspose.threed.Struct<Vector3>
        Overrides:
        clone in class java.lang.Object
      • copyFrom

        public void copyFrom​(Vector3 src)
        Specified by:
        copyFrom in interface com.aspose.threed.Struct<Vector3>
      • hashCode

        public int hashCode()
        Gets the hash code of Vector3
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        The hash code of the Vector3