Method: RMath3D::RMtx2#sub!
- Defined in:
- lib/rmath3d/rmath3d_plain.rb
#sub!(other) ⇒ Object
call-seq: mtx1.sub!( mtx2 )
mtx1 -= mtx2 : subtracts the elements of mtx2
from corresponding mtx1
elements.
483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 |
# File 'lib/rmath3d/rmath3d_plain.rb', line 483 def sub!( other ) if ( other.class != RMtx2 ) raise TypeError, "RMtx2#sub! : Unknown type #{other.class} given as RMtx2." return nil end result = RMtx2.new for row in 0...2 do for col in 0...2 do self.setElement( row, col, getElement(row,col) - other.getElement(row,col) ) end end return self end |