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
    abs()
    Return the absolute value of each component.
    cross(Vec3Arg rightFactor)
    Return the cross product with the argument.
    float
    dot(Vec3Arg factor)
    Return the dot product with the argument.
    float
    get(int index)
    Return the specified component.
    Return an arbitrary unit vector perpendicular to the current vector.
    Return the component-wise (binary) sign.
    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
    isClose(Vec3Arg v2, float maxDistSq)
    Test whether the specified vector lies within the specified squared distance of this one.
    boolean
    Test whether the vector contains infinities or NaNs.
    boolean
    Test whether the vector contains NaNs.
    boolean
    Test whether the squared length is within 10^-12 of zero.
    boolean
    isNearZero(float tolerance)
    Test whether the squared length is within the specified tolerance of zero.
    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 unit vector with the same direction.
    normalizedOr(Vec3Arg zeroValue)
    Return a copy of the argument if the length of the current vector is zero.
    void
    put(FloatBuffer storeBuffer)
    Write all 3 components to the specified buffer and advance the buffer's position by 3.
    Generate the component-wise reciprocal.
    float
    Return the maximum component.
    float
    Return the minimum component.
    void
    Copy to a Float3 object.
    swizzle(int xi, int yi, int zi)
    Copy the specified components to a new vector.
    float[]
    Copy the components to an array.
    Copy the components to a direct buffer.
    Copy the components to a new location vector.
  • Method Details

    • abs

      Vec3 abs()
      Return the absolute value of each component. The vector is unaffected.
      Returns:
      a new vector with no negative components
    • cross

      Vec3 cross(Vec3Arg rightFactor)
      Return the cross product with the argument. Both vectors are 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 argument. Both vectors are 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
    • getSign

      Vec3 getSign()
      Return the component-wise (binary) sign. The current vector is unaffected.
      Returns:
      a new vector (each component 1 or -1)
    • 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
    • isFinite

      boolean isFinite()
      Test whether the vector contains infinities or NaNs. The vector is unaffected.
      Returns:
      false if one or more infinities or NaNs, otherwise true
    • isNan

      boolean isNan()
      Test whether the vector contains NaNs. The vector is unaffected.
      Returns:
      true if one or more NaNs, otherwise false
    • isNearZero

      boolean isNearZero()
      Test whether the squared length is within 10^-12 of zero. The vector is unaffected.
      Returns:
      true if nearly zero, otherwise false
    • isNearZero

      boolean isNearZero(float tolerance)
      Test whether the squared length is within the specified tolerance of zero. The vector is unaffected.
      Parameters:
      tolerance - the desired tolerance (≥0, default=1e-12)
      Returns:
      true if nearly 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 (≥0, default=1e-6)
      Returns:
      true if normalized, otherwise false
    • isClose

      boolean isClose(Vec3Arg v2, float maxDistSq)
      Test whether the specified vector lies within the specified squared distance of this one. Both vectors are unaffected.
      Parameters:
      v2 - the vector to compare with (not null, unaffected)
      maxDistSq - the maximum allowed squared distance (≥0)
      Returns:
      true if within the squared distance, 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 unit 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 unit 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
    • put

      void put(FloatBuffer storeBuffer)
      Write all 3 components to the specified buffer and advance the buffer's position by 3. The vector is unaffected.
      Parameters:
      storeBuffer - the destination buffer (not null)
    • reciprocal

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

      float reduceMax()
      Return the maximum component. The current vector is unaffected.
      Returns:
      a component value
    • reduceMin

      float reduceMin()
      Return the minimum component. The current vector is unaffected.
      Returns:
      a component value
    • storeFloat3

      void storeFloat3(Float3 target)
      Copy to a Float3 object. The vector is unaffected.
      Parameters:
      target - the destination (not null, modified)
    • swizzle

      Vec3 swizzle(int xi, int yi, int zi)
      Copy the specified components to a new vector. The current vector is unaffected.
      Parameters:
      xi - index of the component to copy to the first (X) component of the result (0, 1, or 2)
      yi - index of the component to copy to the 2nd (Y) component of the result (0, 1, or 2)
      zi - index of the component to copy to the 3rd (Z) component of the result (0, 1, or 2)
      Returns:
      the new vector
    • toArray

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

      FloatBuffer toBuffer()
      Copy the components to a direct buffer. The vector is unaffected.
      Returns:
      a new direct buffer with capacity=3
    • toRVec3

      RVec3 toRVec3()
      Copy the components to a new location vector. The current vector is unaffected.
      Returns:
      a new vector