com.io7m.jtensors

## Class VectorI3F

- java.lang.Object
- - com.io7m.jtensors.VectorI3F

- All Implemented Interfaces:
    VectorReadable2FType, VectorReadable3FType

      public class VectorI3F
      extends Object
      implements VectorReadable3FType

  A three-dimensional immutable vector type with single precision elements.

  Values of this type are immutable and can therefore be safely accessed from multiple threads.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static VectorI3F` | `ZERO` The zero vector.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `VectorI3F()` Default constructor, initializing the vector with values `[0.0, 0.0, 0.0]`.
    `VectorI3F(float in_x, float in_y, float in_z)` Construct a vector initialized with the given values.
    `VectorI3F(VectorReadable3FType in_v)` Construct a vector initialized with the values given in the vector `in_v`.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static VectorI3F` | `absolute(VectorReadable3FType v)` Calculate the absolute value of the vector `v`.
    `static VectorI3F` | `add(VectorReadable3FType v0, VectorReadable3FType v1)` Calculate the element-wise sum of the vectors `v0` and `v1`.
    `static VectorI3F` | `addScaled(VectorReadable3FType v0, VectorReadable3FType v1, float r)` Calculate the element-wise sum of the vectors `v0` and the element-wise product of `v1` and `r`.
    `static boolean` | `almostEqual(com.io7m.jequality.AlmostEqualFloat.ContextRelative context, VectorReadable3FType va, VectorReadable3FType vb)` Determine whether or not the vectors `va` and `vb` are equal to within the degree of error given in `context`.
    `static VectorI3F` | `clamp(VectorReadable3FType v, float minimum, float maximum)` Clamp the elements of the vector `v` to the range `[minimum ..`
    `static VectorI3F` | `clampByVector(VectorReadable3FType v, VectorReadable3FType minimum, VectorReadable3FType maximum)` Clamp the elements of the vector `v` to the inclusive range given by the corresponding elements in `minimum` and `maximum`.
    `static VectorI3F` | `clampMaximum(VectorReadable3FType v, float maximum)` Clamp the elements of the vector `v` to the range `[-Infinity ..`
    `static VectorI3F` | `clampMaximumByVector(VectorReadable3FType v, VectorReadable3FType maximum)` Clamp the elements of the vector `v` to the inclusive range given by the corresponding elements in `maximum`.
    `static VectorI3F` | `clampMinimum(VectorReadable3FType v, float minimum)` Clamp the elements of the vector `v` to the range `[minimum ..`
    `static VectorI3F` | `clampMinimumByVector(VectorReadable3FType v, VectorReadable3FType minimum)` Clamp the elements of the vector `v` to the inclusive range given by the corresponding elements in `minimum`.
    `static VectorI3F` | `crossProduct(VectorReadable3FType v0, VectorReadable3FType v1)` Calculate the cross product of the vectors `v0` and `v1`.
    `static float` | `distance(VectorReadable3FType v0, VectorReadable3FType v1)` Calculate the distance between the two vectors `v0` and `v1`.
    `static float` | `dotProduct(VectorReadable3FType v0, VectorReadable3FType v1)` Calculate the scalar product of the vectors `v0` and `v1`.
    `boolean` | `equals(Object obj)`
    `float` | `getXF()`
    `float` | `getYF()`
    `float` | `getZF()`
    `int` | `hashCode()`
    `static VectorI3F` | `interpolateLinear(VectorReadable3FType v0, VectorReadable3FType v1, float alpha)` Linearly interpolate between `v0` and `v1` by the amount `alpha`.
    `static float` | `magnitude(VectorReadable3FType v)` Calculate the magnitude of the vector `v`.
    `static float` | `magnitudeSquared(VectorReadable3FType v)` Calculate the squared magnitude of the vector `v`.
    `static VectorI3F` | `normalize(VectorReadable3FType v)` Normalize the vector `v`, preserving its direction but reducing it to unit length.
    `static com.io7m.jfunctional.Pair<VectorI3F,VectorI3F>` | `orthoNormalize(VectorReadable3FType v0, VectorReadable3FType v1)` Orthonormalize and return the vectors `v0` and `v1` .
    `static VectorI3F` | `projection(VectorReadable3FType p, VectorReadable3FType q)` Calculate the projection of the vector `p` onto the vector `q`.
    `static VectorI3F` | `scale(VectorReadable3FType v, float r)` Scale the vector `v` by the scalar `r`.
    `static VectorI3F` | `subtract(VectorReadable3FType v0, VectorReadable3FType v1)` Subtract the vector `v1` from the vector `v0`.
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### ZERO

          public static final VectorI3F ZERO

      The zero vector.

  - ### Constructor Detail

    - #### VectorI3F

          public VectorI3F()

      Default constructor, initializing the vector with values `[0.0, 0.0, 0.0]`.

    - #### VectorI3F

          public VectorI3F(float in_x,
                           float in_y,
                           float in_z)

      Construct a vector initialized with the given values.
      Parameters:
        `in_x` - The `x` value
        `in_y` - The `y` value
        `in_z` - The `z` value

    - #### VectorI3F

          public VectorI3F(VectorReadable3FType in_v)

      Construct a vector initialized with the values given in the vector `in_v`.
      Parameters:
        `in_v` - The input vector.

  - ### Method Detail

    - #### absolute

          public static final VectorI3F absolute(VectorReadable3FType v)

      Calculate the absolute value of the vector `v`.
      Parameters:
        `v` - The input vector
      Returns:
        `(abs v.getXF(), abs v.getYF(), abs v.getZF())`

    - #### add

          public static final VectorI3F add(VectorReadable3FType v0,
                                            VectorReadable3FType v1)

      Calculate the element-wise sum of the vectors `v0` and `v1`.
      Parameters:
        `v0` - The left input vector
        `v1` - The right input vector
      Returns:
        `(v0.getXF() + v1.getXF(), v0.getYF() + v1.getYF(), v0.getZF() + v1.getZF())`

    - #### addScaled

          public static final VectorI3F addScaled(VectorReadable3FType v0,
                                                  VectorReadable3FType v1,
                                                  float r)

      Calculate the element-wise sum of the vectors `v0` and the element-wise product of `v1` and `r`.
      Parameters:
        `v0` - The left input vector
        `v1` - The right input vector
        `r` - The scaling value
      Returns:
        `(v0.getXF() + (v1.getXF() * r), v0.getYF() + (v1.getYF() * r), v0.getZF() + (v1.getZF() * r))`

    - #### almostEqual

          public static final boolean almostEqual(com.io7m.jequality.AlmostEqualFloat.ContextRelative context,
                                                  VectorReadable3FType va,
                                                  VectorReadable3FType vb)

      Determine whether or not the vectors `va` and `vb` are equal to within the degree of error given in `context`.
      Parameters:
        `context` - The equality context
        `va` - The left input vector
        `vb` - The right input vector
      Returns:
        `true` iff the vectors are almost equal.
      Since:
        5.0.0
      See Also:
        `AlmostEqualFloat.almostEqual(ContextRelative, float, float)`

    - #### clamp

          public static final VectorI3F clamp(VectorReadable3FType v,
                                              float minimum,
                                              float maximum)

      Clamp the elements of the vector `v` to the range `[minimum .. maximum]` inclusive.
      Parameters:
        `v` - The input vector
        `minimum` - The minimum allowed value
        `maximum` - The maximum allowed value
      Returns:
        A vector with both elements equal to at most `maximum` and at least `minimum`.

    - #### clampByVector

          public static final VectorI3F clampByVector(VectorReadable3FType v,
                                                      VectorReadable3FType minimum,
                                                      VectorReadable3FType maximum)

      Clamp the elements of the vector `v` to the inclusive range given by the corresponding elements in `minimum` and `maximum`.
      Parameters:
        `v` - The input vector
        `minimum` - The vector containing the minimum acceptable values
        `maximum` - The vector containing the maximum acceptable values
      Returns:
        `( min(max(v.getXF(), minimum.getXF()), maximum.getXF()), min(max(v.getYF(), minimum.getYF()), maximum.getYF()), min(max(v.getZF(), minimum.getZF()), maximum.getZF()) )`

    - #### clampMaximum

          public static final VectorI3F clampMaximum(VectorReadable3FType v,
                                                     float maximum)

      Clamp the elements of the vector `v` to the range `[-Infinity .. maximum]` inclusive.
      Parameters:
        `v` - The input vector
        `maximum` - The maximum allowed value
      Returns:
        A vector with both elements equal to at most `maximum`

    - #### clampMaximumByVector

          public static final VectorI3F clampMaximumByVector(VectorReadable3FType v,
                                                             VectorReadable3FType maximum)

      Clamp the elements of the vector `v` to the inclusive range given by the corresponding elements in `maximum`.
      Parameters:
        `v` - The input vector
        `maximum` - The vector containing the maximum acceptable values
      Returns:
        `(min(v.getXF(), maximum.getXF()), min(v.getYF(), maximum.getYF()), min(v.getZF(), maximum.getZF()))`

    - #### clampMinimum

          public static final VectorI3F clampMinimum(VectorReadable3FType v,
                                                     float minimum)

      Clamp the elements of the vector `v` to the range `[minimum .. Infinity]` inclusive.
      Parameters:
        `v` - The input vector
        `minimum` - The minimum allowed value
      Returns:
        A vector with both elements equal to at least `minimum`

    - #### clampMinimumByVector

          public static final VectorI3F clampMinimumByVector(VectorReadable3FType v,
                                                             VectorReadable3FType minimum)

      Clamp the elements of the vector `v` to the inclusive range given by the corresponding elements in `minimum`.
      Parameters:
        `v` - The input vector
        `minimum` - The vector containing the minimum acceptable values
      Returns:
        `(max(v.getXF(), minimum.getXF()), max(v.getYF(), minimum.getYF()), max(v.getZF(), minimum.getZF()))`

    - #### crossProduct

          public static final VectorI3F crossProduct(VectorReadable3FType v0,
                                                     VectorReadable3FType v1)

      Calculate the cross product of the vectors `v0` and `v1`. The result is a vector perpendicular to both vectors.
      Parameters:
        `v0` - The left input vector
        `v1` - The right input vector
      Returns:
        A vector perpendicular to both `v0` and `v1`

    - #### distance

          public static final float distance(VectorReadable3FType v0,
                                             VectorReadable3FType v1)

      Calculate the distance between the two vectors `v0` and `v1`.
      Parameters:
        `v0` - The left input vector
        `v1` - The right input vector
      Returns:
        The distance between the two vectors

    - #### dotProduct

          public static final float dotProduct(VectorReadable3FType v0,
                                               VectorReadable3FType v1)

      Calculate the scalar product of the vectors `v0` and `v1`.
      Parameters:
        `v0` - The left input vector
        `v1` - The right input vector
      Returns:
        The scalar product of the two vectors

    - #### interpolateLinear

          public static final VectorI3F interpolateLinear(VectorReadable3FType v0,
                                                          VectorReadable3FType v1,
                                                          float alpha)

      Linearly interpolate between `v0` and `v1` by the amount `alpha`. The `alpha` parameter controls the degree of interpolation, such that:
      - `interpolateLinear(v0, v1, 0.0) = v0`
      - `interpolateLinear(v0, v1, 1.0) = v1`
      Parameters:
        `v0` - The left input vector.
        `v1` - The right input vector.
        `alpha` - The interpolation value, between `0.0` and `1.0`.
      Returns:
        `(1 - alpha) * v0 + alpha * v1`

    - #### magnitude

          public static final float magnitude(VectorReadable3FType v)

      Calculate the magnitude of the vector `v`. Correspondingly, `magnitude(normalize(v)) == 1.0`.
      Parameters:
        `v` - The input vector
      Returns:
        The magnitude of the input vector

    - #### magnitudeSquared

          public static final float magnitudeSquared(VectorReadable3FType v)

      Calculate the squared magnitude of the vector `v`.
      Parameters:
        `v` - The input vector
      Returns:
        The squared magnitude of the input vector

    - #### normalize

          public static final VectorI3F normalize(VectorReadable3FType v)

      Normalize the vector `v`, preserving its direction but reducing it to unit length.
      Parameters:
        `v` - The input vector
      Returns:
        A vector with the same orientation as `v` but with magnitude equal to `1.0`

    - #### orthoNormalize

          public static final com.io7m.jfunctional.Pair<VectorI3F,VectorI3F> orthoNormalize(VectorReadable3FType v0,
                                                                                            VectorReadable3FType v1)

      Orthonormalize and return the vectors `v0` and `v1` .

      See GSP

      Parameters:
        `v0` - The left vector
        `v1` - The right vector
      Returns:
        A pair `(v0, v1)`, orthonormalized.
      Since:
        5.0.0

    - #### projection

          public static final VectorI3F projection(VectorReadable3FType p,
                                                   VectorReadable3FType q)

      Calculate the projection of the vector `p` onto the vector `q`.
      Parameters:
        `p` - The left vector
        `q` - The right vector
      Returns:
        `((dotProduct p q) / magnitudeSquared q) * q`

    - #### scale

          public static final VectorI3F scale(VectorReadable3FType v,
                                              float r)

      Scale the vector `v` by the scalar `r`.
      Parameters:
        `v` - The input vector
        `r` - The scaling value
      Returns:
        `(v.getXF() * r, v.getYF() * r, v.getZF() * r)`

    - #### subtract

          public static final VectorI3F subtract(VectorReadable3FType v0,
                                                 VectorReadable3FType v1)

      Subtract the vector `v1` from the vector `v0`.
      Parameters:
        `v0` - The left input vector
        `v1` - The right input vector
      Returns:
        `(v0.getXF() - v1.getXF(), v0.getYF() - v1.getYF(), v0.getZF() - v1.getZF())`

    - #### equals

          public final boolean equals(@Nullable
                                      Object obj)

      Overrides:
        `equals` in class `Object`

    - #### getXF

          public final float getXF()

      Specified by:
        `getXF` in interface `VectorReadable2FType`
      Returns:
        The X value of the given vector.

    - #### getYF

          public final float getYF()

      Specified by:
        `getYF` in interface `VectorReadable2FType`
      Returns:
        The Y value of the given vector.

    - #### getZF

          public final float getZF()

      Specified by:
        `getZF` in interface `VectorReadable3FType`
      Returns:
        The Z value of the given vector.

    - #### hashCode

          public final int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### toString

          public final String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2015 <code@io7m.com> http://io7m.com