Matrix
class Matrix
Properties
protected int[]|float[] | $elements | The array of elements. | |
protected int | $width | The matrix width. | |
protected int | $height | The matrix height. |
Methods
The given $elements get arranged as follows: The elements will be set from left to right in a row until the row is full. Then, the next line begins alike and so on.
Get the matrix width.
Get the matrix height.
Set the value of a cell.
Get the value of a cell.
Return all the matrix values, as a monodimensional array.
Return all the matrix values, as a bidimensional array (every array item contains the values of a row).
Calculate the offset position of a cell.
Details
at line 50
__construct(int $width, int $height, int[]|float[] $elements = array())
The given $elements get arranged as follows: The elements will be set from left to right in a row until the row is full. Then, the next line begins alike and so on.
at line 79
int
getWidth()
Get the matrix width.
at line 89
int
getHeight()
Get the matrix height.
at line 101
setElementAt(int $x, int $y, int|float $value)
Set the value of a cell.
at line 114
int|float
getElementAt(int $x, int $y)
Get the value of a cell.
at line 124
int[]|float[]
getValueList()
Return all the matrix values, as a monodimensional array.
at line 134
int[]|float[]
getMatrix()
Return all the matrix values, as a bidimensional array (every array item contains the values of a row).
at line 144
Matrix
normalize()
Returns a new Matrix instance, representing the normalized value of this matrix.
at line 169
protected int
calculatePosition(int $x, int $y)
Calculate the offset position of a cell.