Class VectorSetUsingBuffer

java.lang.Object
jme3utilities.math.VectorSetUsingBuffer
All Implemented Interfaces:
VectorSet

public class VectorSetUsingBuffer extends Object implements VectorSet
A VectorSet implemented using FloatBuffer.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Logger
    message logger for this class
  • Constructor Summary

    Constructors
    Constructor
    Description
    VectorSetUsingBuffer(int numVectors, boolean direct)
    Instantiate an empty set with the specified initial capacity.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(float x, float y, float z)
    Add the specified value to this set, if it's not already present.
    void
    add(Vector3f vector)
    Add the value of the specified Vector3f to this set, if it's not already present.
    void
    Add the specified values to this set, to the extent that they're not already present.
    void
    Reset this set to its initial (empty, flipped, rewound) state without altering its capacity.
    static void
    Reset the hashing statistics.
    boolean
    contains(float x, float y, float z)
    Test whether this set contains the specified value.
    boolean
    Test whether this set contains the value of the specified Vector3f.
    covariance(Matrix3f storeResult)
    Determine the sample covariance of the values in this set.
    static void
    Print the hashing statistics.
    maxAbs(Vector3f storeResult)
    Find the maximum absolute coordinate for each axis among the Vector3f values in this set.
    float
    Find the magnitude of the longest vector in this set.
    void
    maxMin(Vector3f storeMaxima, Vector3f storeMinima)
    Find the maximum and minimum coordinates for each axis among the values in this set.
    mean(Vector3f storeResult)
    Determine the sample mean for each axis among the values in this set.
    int
    Determine the number of values in this set.
    Access a Buffer containing all values in this set.
    float[]
    Create an array of floats containing all values in this set.
    Represent this set as a String.
    Create an array of vectors containing all values in this set.

    Methods inherited from class java.lang.Object

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

    • logger

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

    • VectorSetUsingBuffer

      public VectorSetUsingBuffer(int numVectors, boolean direct)
      Instantiate an empty set with the specified initial capacity.
      Parameters:
      numVectors - the number of vectors the set must hold without needing enlargement (>0)
      direct - true→allocate direct buffers, false→allocate indirect buffers
  • Method Details

    • clearStats

      public static void clearStats()
      Reset the hashing statistics.
    • dumpStats

      public static void dumpStats(String tag)
      Print the hashing statistics.
      Parameters:
      tag - (not null)
    • add

      public void add(float x, float y, float z)
      Add the specified value to this set, if it's not already present.
      Specified by:
      add in interface VectorSet
      Parameters:
      x - the X component of the new value
      y - the Y component of the new value
      z - the Z component of the new value
    • add

      public void add(Vector3f vector)
      Add the value of the specified Vector3f to this set, if it's not already present.
      Specified by:
      add in interface VectorSet
      Parameters:
      vector - the value to add (not null, unaffected)
    • addAll

      public void addAll(Iterable<Vector3f> vectors)
      Add the specified values to this set, to the extent that they're not already present.
      Specified by:
      addAll in interface VectorSet
      Parameters:
      vectors - the values to add (not null, unaffected)
    • clear

      public void clear()
      Reset this set to its initial (empty, flipped, rewound) state without altering its capacity. The hashing statistics are unaffected.
      Specified by:
      clear in interface VectorSet
    • contains

      public boolean contains(float x, float y, float z)
      Test whether this set contains the specified value.
      Specified by:
      contains in interface VectorSet
      Parameters:
      x - the X component of the value to find
      y - the Y component of the value to find
      z - the Z component of the value to find
      Returns:
      true if found, otherwise false
    • contains

      public boolean contains(Vector3f vector)
      Test whether this set contains the value of the specified Vector3f.
      Specified by:
      contains in interface VectorSet
      Parameters:
      vector - the value to find (not null, unaffected)
      Returns:
      true if found, otherwise false
    • covariance

      public Matrix3f covariance(Matrix3f storeResult)
      Determine the sample covariance of the values in this set.
      Specified by:
      covariance in interface VectorSet
      Parameters:
      storeResult - storage for the result (modified if not null)
      Returns:
      the unbiased sample covariance (either storeResult or a new matrix, not null)
    • maxAbs

      public Vector3f maxAbs(Vector3f storeResult)
      Find the maximum absolute coordinate for each axis among the Vector3f values in this set.
      Specified by:
      maxAbs in interface VectorSet
      Parameters:
      storeResult - storage for the result (modified if not null)
      Returns:
      the half extent for each axis (either storeResult or a new instance)
    • maxLength

      public float maxLength()
      Find the magnitude of the longest vector in this set.
      Specified by:
      maxLength in interface VectorSet
      Returns:
      the magnitude (≥0)
    • maxMin

      public void maxMin(Vector3f storeMaxima, Vector3f storeMinima)
      Find the maximum and minimum coordinates for each axis among the values in this set.
      Specified by:
      maxMin in interface VectorSet
      Parameters:
      storeMaxima - storage for the maxima (not null, modified)
      storeMinima - storage for the minima (not null, modified)
    • mean

      public Vector3f mean(Vector3f storeResult)
      Determine the sample mean for each axis among the values in this set.
      Specified by:
      mean in interface VectorSet
      Parameters:
      storeResult - storage for the result (modified if not null)
      Returns:
      the sample mean for each axis (either storeResult or a new Vector3f)
    • numVectors

      public int numVectors()
      Determine the number of values in this set.
      Specified by:
      numVectors in interface VectorSet
      Returns:
      the count (≥0)
    • toBuffer

      public FloatBuffer toBuffer()
      Access a Buffer containing all values in this set. No further add() is allowed.
      Specified by:
      toBuffer in interface VectorSet
      Returns:
      the pre-existing Buffer, flipped but possibly not rewound
    • toFloatArray

      public float[] toFloatArray()
      Create an array of floats containing all values in this set.
      Specified by:
      toFloatArray in interface VectorSet
      Returns:
      a new array
    • toVectorArray

      public Vector3f[] toVectorArray()
      Create an array of vectors containing all values in this set.
      Specified by:
      toVectorArray in interface VectorSet
      Returns:
      a new array of new vectors
    • toString

      public String toString()
      Represent this set as a String.
      Overrides:
      toString in class Object
      Returns:
      a descriptive string of text (not null, not empty)