Package jme3utilities.math
Class VectorSetUsingBuffer
java.lang.Object
jme3utilities.math.VectorSetUsingBuffer
- All Implemented Interfaces:
VectorSet
A VectorSet implemented using FloatBuffer.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionVectorSetUsingBuffer(int numVectors, boolean direct) Instantiate an empty set with the specified initial capacity. -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(float x, float y, float z) Add the specified value to this set, if it's not already present.voidAdd the value of the specified Vector3f to this set, if it's not already present.voidAdd the specified values to this set, to the extent that they're not already present.voidclear()Reset this set to its initial (empty, flipped, rewound) state without altering its capacity.static voidReset the hashing statistics.booleancontains(float x, float y, float z) Test whether this set contains the specified value.booleanTest whether this set contains the value of the specified Vector3f.covariance(Matrix3f storeResult) Determine the sample covariance of the values in this set.static voidPrint the hashing statistics.Find the maximum absolute coordinate for each axis among the Vector3f values in this set.floatFind the magnitude of the longest vector in this set.voidFind the maximum and minimum coordinates for each axis among the values in this set.Determine the sample mean for each axis among the values in this set.intDetermine the number of values in this set.toBuffer()Access a Buffer containing all values in this set.float[]Create an array of floats containing all values in this set.toString()Represent this set as a String.Vector3f[]Create an array of vectors containing all values in this set.
-
Field Details
-
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
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. -
add
Add the value of the specified Vector3f to this set, if it's not already present. -
addAll
Add the specified values to this set, to the extent that they're not already present. -
clear
public void clear()Reset this set to its initial (empty, flipped, rewound) state without altering its capacity. The hashing statistics are unaffected. -
contains
public boolean contains(float x, float y, float z) Test whether this set contains the specified value. -
contains
Test whether this set contains the value of the specified Vector3f. -
covariance
Determine the sample covariance of the values in this set.- Specified by:
covariancein interfaceVectorSet- Parameters:
storeResult- storage for the result (modified if not null)- Returns:
- the unbiased sample covariance (either storeResult or a new matrix, not null)
-
maxAbs
Find the maximum absolute coordinate for each axis among the Vector3f values in this set. -
maxLength
public float maxLength()Find the magnitude of the longest vector in this set. -
maxMin
Find the maximum and minimum coordinates for each axis among the values in this set. -
mean
Determine the sample mean for each axis among the values in this set. -
numVectors
public int numVectors()Determine the number of values in this set.- Specified by:
numVectorsin interfaceVectorSet- Returns:
- the count (≥0)
-
toBuffer
Access a Buffer containing all values in this set. No further add() is allowed. -
toFloatArray
public float[] toFloatArray()Create an array of floats containing all values in this set.- Specified by:
toFloatArrayin interfaceVectorSet- Returns:
- a new array
-
toVectorArray
Create an array of vectors containing all values in this set.- Specified by:
toVectorArrayin interfaceVectorSet- Returns:
- a new array of new vectors
-
toString
Represent this set as a String.
-