Class Vec3

All Implemented Interfaces:
Serializable

public class Vec3 extends Vec<Vec3> implements Serializable
Represents a vector with an x-, a y- and a z-component.
See Also:
Serialized Form
  • Field Details

    • x

      public float x
    • y

      public float y
    • z

      public float z
  • Constructor Details

    • Vec3

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

      public Vec3(Vec3 xyz)
      Creates a vector with the given values.
    • Vec3

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

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

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

    • set

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

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

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

      public Vec3 set(float x, float y, float z)
      Sets the vector to the given values.
      Returns:
      this
    • 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<Vec3>
      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<Vec3>
      Parameters:
      values - an array containing the values for all components.
    • getNewVector

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