Interface Vec3Arg

All Known Implementing Classes:
Vec3

public interface Vec3Arg
Read-only access to a Vec3. (native type: const Vec3)
  • Method Summary

    Modifier and Type
    Method
    Description
    cross(Vec3Arg rightFactor)
    Return the cross product with the specified vector.
    float
    dot(Vec3Arg factor)
    Return the dot product with the specified vector.
    float
    get(int index)
    Return the specified component.
    Return an arbitrary unit vector perpendicular to the current vector.
    float
    Return the first (X) component in single precision.
    float
    Return the 2nd (Y) component in single precision.
    float
    Return the 3rd (Z) component in single precision.
    boolean
    Test whether the vector is zero to within a tolerance of 10^-12.
    boolean
    isNearZero(float tolerance)
    Test whether the vector is zero to within the specified tolerance.
    boolean
    Test whether the vector is normalized to within a tolerance of 10^-6.
    boolean
    isNormalized(float tolerance)
    Test whether the vector is normalized to within the specified tolerance.
    float
    Return the length.
    float
    Return the squared length.
    Generate a normalized vector with the same direction.
    normalizedOr(Vec3Arg zeroValue)
    Return a copy of the argument if the length of the current vector is zero.
    Generate the component-wise reciprocal.
    float[]
    Copy the components to an array.
  • Method Details

    • cross

      Vec3 cross(Vec3Arg rightFactor)
      Return the cross product with the specified vector. The current vector is unaffected.
      Parameters:
      rightFactor - the vector to cross with the current one (not null, unaffected)
      Returns:
      a new product vector
    • dot

      float dot(Vec3Arg factor)
      Return the dot product with the specified vector. The current vector is unaffected.
      Parameters:
      factor - the vector to dot with the current one (not null, unaffected)
      Returns:
      the dot product
    • get

      float get(int index)
      Return the specified component. The vector is unaffected.
      Parameters:
      index - 0, 1, or 2
      Returns:
      the X component if index=0, the Y component if index=1, or the Z component if index=2
      Throws:
      IllegalArgumentException - if index is not 0, 1, or 2
    • getNormalizedPerpendicular

      Vec3 getNormalizedPerpendicular()
      Return an arbitrary unit vector perpendicular to the current vector. The current vector is unaffected.
      Returns:
      a new vector
    • getX

      float getX()
      Return the first (X) component in single precision. The vector is unaffected.
      Returns:
      the component value
    • getY

      float getY()
      Return the 2nd (Y) component in single precision. The vector is unaffected.
      Returns:
      the component value
    • getZ

      float getZ()
      Return the 3rd (Z) component in single precision. The vector is unaffected.
      Returns:
      the component value
    • isNearZero

      boolean isNearZero()
      Test whether the vector is zero to within a tolerance of 10^-12. The vector is unaffected.
      Returns:
      true if near zero, otherwise false
    • isNearZero

      boolean isNearZero(float tolerance)
      Test whether the vector is zero to within the specified tolerance. The vector is unaffected.
      Parameters:
      tolerance - the desired tolerance (default=1e-12)
      Returns:
      true if near zero, otherwise false
    • isNormalized

      boolean isNormalized()
      Test whether the vector is normalized to within a tolerance of 10^-6. The vector is unaffected.
      Returns:
      true if normalized, otherwise false
    • isNormalized

      boolean isNormalized(float tolerance)
      Test whether the vector is normalized to within the specified tolerance. The vector is unaffected.
      Parameters:
      tolerance - the desired tolerance (default=1e-6)
      Returns:
      true if normalized, otherwise false
    • length

      float length()
      Return the length. The vector is unaffected.
      Returns:
      the length
    • lengthSq

      float lengthSq()
      Return the squared length. The vector is unaffected.
      Returns:
      the squared length
    • normalized

      Vec3 normalized()
      Generate a normalized vector with the same direction. The current vector is unaffected.
      Returns:
      a new vector
    • normalizedOr

      Vec3 normalizedOr(Vec3Arg zeroValue)
      Return a copy of the argument if the length of the current vector is zero. Otherwise, generate a normalized vector with the same direction as the current vector. The current vector is unaffected.
      Parameters:
      zeroValue - the value to return if the length is zero (not null, unaffected)
      Returns:
      a new vector
    • reciprocal

      Vec3 reciprocal()
      Generate the component-wise reciprocal. The current vector is unaffected.
      Returns:
      a new vector
    • toArray

      float[] toArray()
      Copy the components to an array. The vector is unaffected.
      Returns:
      a new array with length=3