y
and row x
Require: x >= 0 and x <= width and y >= 0 and y <= height
var matrix = new Matrix.from([[0.0, 0.1],
[1.0, 1.1]])
assert matrix[0, 0] == 0.0
assert matrix[0, 1] == 0.1
assert matrix[1, 0] == 1.0
assert matrix[1, 1] == 1.1
# Get the value at column `y` and row `x`
#
# Require: `x >= 0 and x <= width and y >= 0 and y <= height`
#
# ~~~
# var matrix = new Matrix.from([[0.0, 0.1],
# [1.0, 1.1]])
#
# assert matrix[0, 0] == 0.0
# assert matrix[0, 1] == 0.1
# assert matrix[1, 0] == 1.0
# assert matrix[1, 1] == 1.1
# ~~~
fun [](y, x: Int): Float
do
assert x >= 0 and x < width
assert y >= 0 and y < height
return items[x + y*width]
end
lib/matrix/matrix.nit:142,2--161,4