lib/ray_tracer/matrix.rb
# Build a scaling matrix by placing the scaling vector along the diagonal
Build a scaling matrix by placing the scaling vector along the diagonal
Build a scaling matrix by placing the scaling vector along the diagonal
def scaling(x, y, z)
        matrix =
        [
          [x, 0, 0, 0],
          [0, y, 0, 0],
          [0, 0, z, 0],
          [0, 0, 0, 1]
        ]
        build(4, 4) { |i, j| Rational(matrix.dig(i, j)) }
      end
def scaling ( x , y , z ) matrix = [ [ x , 0 , 0 , 0 ] , [ 0 , y , 0 , 0 ] , [ 0 , 0 , z , 0 ] , [ 0 , 0 , 0 , 1 ] ] build ( 4 , 4 ) { | i , j | Rational ( matrix . dig ( i , j ) ) } end
Build a scaling matrix by placing the scaling vector along the diagonal
Build a scaling matrix by placing the scaling vector along the diagonal
x
y
z