public class SmallTwoDimensionalFloatArray extends TwoDimensionalFloatReadAccess.Base implements TwoDimensionalFloatAccess
This internally maps to a one-dimensional float array which is created faster.
Because of the mapping the size of the dimensions is restricted in a way that the
number of elements in this array (i.e. the multiplication of its X and Y size) is less
than Integer.MAX_VALUE
. Use TwoDimensionalFloatArray
if you are not
sure to always obey this restriction.
TwoDimensionalFloatReadAccess.Base
EMPTY
Constructor and Description |
---|
SmallTwoDimensionalFloatArray(int ySize,
float... values)
Constructor.
|
SmallTwoDimensionalFloatArray(int xSize,
int ySize)
Constructor.
|
SmallTwoDimensionalFloatArray(int xSize,
int ySize,
IntToFloatFunction2 filler)
Initializing constructor.
|
SmallTwoDimensionalFloatArray(TwoDimensionalFloatReadAccess array)
Copy constructor.
|
Modifier and Type | Method and Description |
---|---|
SmallTwoDimensionalFloatArray |
copy()
Get a copy of this array.
|
float |
getValueAt(int ix,
int iy)
Get the value at the given indexes.
|
void |
invertX()
Invert the row order in X direction.
|
void |
invertY()
Invert the row order in Y direction.
|
void |
setValueAt(float value,
int ix,
int iy)
Set the value at the given indexes.
|
int |
sizeX()
Get the number of elements in X direction.
|
int |
sizeY()
Get the number of elements in Y direction
|
static SmallTwoDimensionalFloatArray |
unitySquare(int size)
Create a unity square 2-dimensional float array.
|
asBase
equals, hashCode, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
changeAllValues, changeValueAt, fillValuesByIndex, setElementAt, subAtX, subAtY, transposed
asBase, getElementAt, singleton
changeAll, changeAll, createConstant, createIndexed, createNulled, createSupplied, empty, fillByIndex, setElement, zeroX, zeroY
equal, getElement, getNumDimensions, getNumElements, getSize, getSizes, hash, toString, view, visitAll, visitAll, xIterable, xIterator, yIterable, yIterator
change, setAll, setFrom, setFrom, setFrom
empty, linearized
public SmallTwoDimensionalFloatArray(int xSize, int ySize)
0.0
values.xSize
- X size of arrayySize
- Y size of arrayjava.lang.IllegalArgumentException
- on negative sizes or if linearized size becoms too largeSmallTwoDimensionalFloatArray(int, int, IntToFloatFunction2)
public SmallTwoDimensionalFloatArray(int xSize, int ySize, @NotNull IntToFloatFunction2 filler)
xSize
- X size of arrayySize
- Y size of arrayfiller
- setter function which provides the value to set for each index combinationjava.lang.IllegalArgumentException
- on negative sizes or if linearized size becoms too largeTwoDimensionalFloatAccess.fillValuesByIndex(IntToFloatFunction2)
public SmallTwoDimensionalFloatArray(int ySize, float... values)
ySize
- size in y directionvalues
- values in order, the first ySize
values
will become row 0, the second ySize
values
row 1, and so on. Needs a multiple of ySize values.public SmallTwoDimensionalFloatArray(@NotNull TwoDimensionalFloatReadAccess array)
array
- array to copyjava.lang.IllegalArgumentException
- on negative sizes or if linearized size becoms too largepublic void invertX()
public void invertY()
public void setValueAt(float value, int ix, int iy)
setValueAt
in interface TwoDimensionalFloatAccess
value
- value to setix
- X indexiy
- Y indexpublic float getValueAt(int ix, int iy)
getValueAt
in interface TwoDimensionalFloatReadAccess
ix
- X indexiy
- Y indexpublic int sizeX()
TwoDimensionalReadAccess
sizeX
in interface TwoDimensionalReadAccess<java.lang.Float>
public int sizeY()
TwoDimensionalReadAccess
sizeY
in interface TwoDimensionalReadAccess<java.lang.Float>
@NotNull public SmallTwoDimensionalFloatArray copy()
@NotNull public static SmallTwoDimensionalFloatArray unitySquare(int size)
x == y
diagonal initialized to 1.0F
, and all others to 0.0F
.size
- size of returned square array