Module: GTransMat
- Defined in:
- lib/transformations.rb
Class Method Summary collapse
- .gCenterAtMatrix(tranmatrix, about) ⇒ Object
- .gRotateMatrix(radian) ⇒ Object
- .gScaleMatrix(sx, sy) ⇒ Object
- .gTranslateMatrix(dx, dy) ⇒ Object
Class Method Details
.gCenterAtMatrix(tranmatrix, about) ⇒ Object
23 24 25 26 |
# File 'lib/transformations.rb', line 23 def self.gCenterAtMatrix(tranmatrix,about) t = GTransMat.gTranslateMatrix(-about.x , -about.y) return t.inv * (tranmatrix * t) end |
.gRotateMatrix(radian) ⇒ Object
5 6 7 8 9 |
# File 'lib/transformations.rb', line 5 def self.gRotateMatrix(radian) return Matrix[[Math.cos(radian) , Math.sin(radian),0], [-Math.sin(radian) , Math.cos(radian),0], [0,0,1]] end |
.gScaleMatrix(sx, sy) ⇒ Object
17 18 19 20 21 |
# File 'lib/transformations.rb', line 17 def self.gScaleMatrix(sx,sy) return Matrix[[sx , 0 ,0], [0 , sy ,0], [0 , 0 ,1]] end |
.gTranslateMatrix(dx, dy) ⇒ Object
11 12 13 14 15 |
# File 'lib/transformations.rb', line 11 def self.gTranslateMatrix(dx,dy) return Matrix[[1 , 0 ,dx], [0 , 1 ,dy], [0 , 0 ,1]] end |