Class Vec4

All Implemented Interfaces:
Serializable

public class Vec4 extends Vec<Vec4> implements Serializable
Represents a vector with an x-, a y-, a z- and a w-component.
See Also:
Serialized Form
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Represents a Vector component.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    float
     
    float
     
    float
     
    float
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create a vector initialized to [0, 0, 0, 1].
    Vec4​(float x, float y, float z, float w)
    Creates a vector with the given values.
    Vec4​(float x, float y, Vec2 zw)
    Creates a vector with the given values.
    Vec4​(float x, Vec2 yz, float w)
    Creates a vector with the given values.
    Vec4​(float x, Vec3 yzw)
    Creates a vector with the given values.
    Vec4​(Vec2 xy, float z, float w)
    Creates a vector with the given values.
    Vec4​(Vec2 xy, Vec2 zw)
    Creates a vector with the given values.
    Vec4​(Vec3 xyz, float w)
    Creates a vector with the given values.
    Vec4​(Vec4 xyzw)
    Creates a vector with the given values.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected float[]
    Returns an array containing all components in the order they appear in the vector.
    protected Vec4
    Creates a new vector (values don't matter) of this type.
    mul​(Mat4 mat)
    Multiplies this the given matrix with this vector and stores the result in this.
    mul​(Mat4 mat, Vec4 dest)
    Multiplies this the given matrix with this vector and stores the result in dest.
    mulN​(Mat4 mat)
    Multiplies this the given matrix with this vector and stores the result in a new vector, returning it.
    set​(float x, float y, float z, float w)
    Sets the vector to the given values.
    set​(float x, float y, Vec2 zw)
    Sets the vector to the given values.
    set​(float x, Vec2 yz, float w)
    Sets the vector to the given values.
    set​(float x, Vec3 yzw)
    Sets the vector to the given values.
    set​(Vec2 xy, float z, float w)
    Sets the vector to the given values.
    set​(Vec2 xy, Vec2 zw)
    Sets the vector to the given values.
    set​(Vec3 xyz, float w)
    Sets the vector to the given values.
    set​(Vec4 xyzw)
    Sets the vector to the given values.
    protected void
    setComponents​(float[] values)
    Sets the components of the vector.

    Methods inherited from class rosequartz.math.Vec

    abs, add, add, add, addN, addN, angle, components, distance, div, div, div, divN, divN, dot, equals, get, length, max, min, mul, mul, mul, mulN, mulN, negate, normalize, scale, sub, sub, sub, subN, subN, toString

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • x

      public float x
    • y

      public float y
    • z

      public float z
    • w

      public float w
  • Constructor Details

    • Vec4

      public Vec4()
      Create a vector initialized to [0, 0, 0, 1].
    • Vec4

      public Vec4(Vec4 xyzw)
      Creates a vector with the given values.
    • Vec4

      public Vec4(Vec3 xyz, float w)
      Creates a vector with the given values.
    • Vec4

      public Vec4(float x, Vec3 yzw)
      Creates a vector with the given values.
    • Vec4

      public Vec4(Vec2 xy, Vec2 zw)
      Creates a vector with the given values.
    • Vec4

      public Vec4(Vec2 xy, float z, float w)
      Creates a vector with the given values.
    • Vec4

      public Vec4(float x, Vec2 yz, float w)
      Creates a vector with the given values.
    • Vec4

      public Vec4(float x, float y, Vec2 zw)
      Creates a vector with the given values.
    • Vec4

      public Vec4(float x, float y, float z, float w)
      Creates a vector with the given values.
  • Method Details

    • set

      public Vec4 set(Vec4 xyzw)
      Sets the vector to the given values.
      Returns:
      this
    • set

      public Vec4 set(Vec3 xyz, float w)
      Sets the vector to the given values.
      Returns:
      this
    • set

      public Vec4 set(float x, Vec3 yzw)
      Sets the vector to the given values.
      Returns:
      this
    • set

      public Vec4 set(Vec2 xy, Vec2 zw)
      Sets the vector to the given values.
      Returns:
      this
    • set

      public Vec4 set(Vec2 xy, float z, float w)
      Sets the vector to the given values.
      Returns:
      this
    • set

      public Vec4 set(float x, Vec2 yz, float w)
      Sets the vector to the given values.
      Returns:
      this
    • set

      public Vec4 set(float x, float y, Vec2 zw)
      Sets the vector to the given values.
      Returns:
      this
    • set

      public Vec4 set(float x, float y, float z, float w)
      Sets the vector to the given values.
      Returns:
      this
    • mul

      public Vec4 mul(Mat4 mat)
      Multiplies this the given matrix with this vector and stores the result in this.
      Parameters:
      mat - vector to multiply with this one
      Returns:
      this
    • mul

      public Vec4 mul(Mat4 mat, Vec4 dest)
      Multiplies this the given matrix with this vector and stores the result in dest.
      Parameters:
      mat - vector to multiply with this one
      dest - vector to store result in
      Returns:
      this
    • mulN

      public Vec4 mulN(Mat4 mat)
      Multiplies this the given matrix with this vector and stores the result in a new vector, returning it.
      Parameters:
      mat - vector to multiply with this one
      Returns:
      new vector holding result
    • getComponents

      protected float[] getComponents()
      Description copied from class: Vec
      Returns an array containing all components in the order they appear in the vector.
      Specified by:
      getComponents in class Vec<Vec4>
      Returns:
      array containing all vector components
    • setComponents

      protected void setComponents(float[] values)
      Description copied from class: Vec
      Sets the components of the vector.
      Specified by:
      setComponents in class Vec<Vec4>
      Parameters:
      values - an array containing the values for all components.
    • getNewVector

      protected Vec4 getNewVector()
      Description copied from class: Vec
      Creates a new vector (values don't matter) of this type.
      Specified by:
      getNewVector in class Vec<Vec4>
      Returns:
      new vector of this type