Class Vector3i

java.lang.Object
jme3utilities.math.Vector3i
All Implemented Interfaces:
com.jme3.export.Savable

public class Vector3i extends Object implements com.jme3.export.Savable
Integer vector with 3 components, used to identify a chunk in a 3-D world or represent the offset between 2 chunks. Immutable except for read(com.jme3.export.JmeImporter).
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Logger
    message logger for this class
    static final Vector3i
    instance with all components =0
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    No-argument constructor needed by SavableClassUtil.
     
    Vector3i(int x, int y, int z)
    Instantiate a vector.
  • Method Summary

    Modifier and Type
    Method
    Description
    add(int deltaX, int deltaY, int deltaZ)
    Add to (translate) the current instance.
    boolean
    equals(Object otherObject)
    Test for exact equivalence with another Object.
    int
    Generate the hash code for this vector.
    void
    read(com.jme3.export.JmeImporter importer)
    De-serialize this vector, for example when loading from a J3O file.
    subtract(int deltaX, int deltaY, int deltaZ)
    Subtract from (inverse translate) the current instance.
    Represent this vector as a text string.
    void
    write(com.jme3.export.JmeExporter exporter)
    Serialize this vector, for example when saving to a J3O file.
    int
    x()
    Determine the X component.
    int
    xDiff(Vector3i other)
    Compare the X component to that of another vector.
    int
    y()
    Determine the Y component.
    int
    yDiff(Vector3i other)
    Compare the Y component to that of another chunk.
    int
    z()
    Determine the Z component.
    int
    zDiff(Vector3i other)
    Compare the Z component to that of another chunk.

    Methods inherited from class java.lang.Object

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

    • zero

      public static final Vector3i zero
      instance with all components =0
    • logger

      public static final Logger logger
      message logger for this class
  • Constructor Details

    • Vector3i

      protected Vector3i()
      No-argument constructor needed by SavableClassUtil.
    • Vector3i

      public Vector3i(int x, int y, int z)
      Instantiate a vector.
      Parameters:
      x - the desired X component
      y - the desired Y component
      z - the desired Z component
  • Method Details

    • add

      public Vector3i add(int deltaX, int deltaY, int deltaZ)
      Add to (translate) the current instance.
      Parameters:
      deltaX - the number of units in the +X direction
      deltaY - the number of units in the +Y direction
      deltaZ - the number of units in the +Z direction
      Returns:
      a new vector
    • subtract

      public Vector3i subtract(int deltaX, int deltaY, int deltaZ)
      Subtract from (inverse translate) the current instance.
      Parameters:
      deltaX - the number of units in the -X direction
      deltaY - the number of units in the -Y direction
      deltaZ - the number of units in the -Z direction
      Returns:
      a new vector
    • x

      public int x()
      Determine the X component.
      Returns:
      the component value
    • xDiff

      public int xDiff(Vector3i other)
      Compare the X component to that of another vector.
      Parameters:
      other - (not null)
      Returns:
      the difference (this minus other)
    • y

      public int y()
      Determine the Y component.
      Returns:
      the component value
    • yDiff

      public int yDiff(Vector3i other)
      Compare the Y component to that of another chunk.
      Parameters:
      other - (not null)
      Returns:
      the difference (this minus other)
    • z

      public int z()
      Determine the Z component.
      Returns:
      the component value
    • zDiff

      public int zDiff(Vector3i other)
      Compare the Z component to that of another chunk.
      Parameters:
      other - (not null)
      Returns:
      the difference (this minus other)
    • equals

      public boolean equals(Object otherObject)
      Test for exact equivalence with another Object.
      Overrides:
      equals in class Object
      Parameters:
      otherObject - the object to compare to (may be null, unaffected)
      Returns:
      true if the objects are equivalent, otherwise false
    • hashCode

      public int hashCode()
      Generate the hash code for this vector.
      Overrides:
      hashCode in class Object
      Returns:
      the value to use for hashing
    • toString

      public String toString()
      Represent this vector as a text string. The format is: (X,Y,Z)
      Overrides:
      toString in class Object
      Returns:
      a descriptive string of text (not null)
    • read

      public void read(com.jme3.export.JmeImporter importer) throws IOException
      De-serialize this vector, for example when loading from a J3O file.
      Specified by:
      read in interface com.jme3.export.Savable
      Parameters:
      importer - (not null)
      Throws:
      IOException - from importer
    • write

      public void write(com.jme3.export.JmeExporter exporter) throws IOException
      Serialize this vector, for example when saving to a J3O file.
      Specified by:
      write in interface com.jme3.export.Savable
      Parameters:
      exporter - (not null)
      Throws:
      IOException - from exporter