Mega Code Archive

 
Categories / Ruby / Number
 

Matrix in action

require "matrix" # Represent the point (1,1) as the vector [1,1] unit = Vector[1,1] identity = Matrix.identity(2)  # 2x2 matrix identity*unit == unit          # true: no transformation