This matrix scales a point by sx,sy : matrix « Number « Ruby






This matrix scales a point by sx,sy


require "matrix"
unit = 2
sx,sy = 2.0, 3.0;
scale = Matrix[[sx,0], [0, sy]]
scale*unit             # => [2.0, 3.0]: scaled point

 








Related examples in the same category

1.matrix in action
2.This matrix rotates counterclockwise around the origin
3.Two transformations in one