Method: MiniGL::Vector#rotate
- Defined in:
- lib/minigl/global.rb
#rotate(radians) ⇒ Object
Returns a vector corresponding to the rotation of this vector around the origin (0, 0) by radians
radians.
72 73 74 75 76 |
# File 'lib/minigl/global.rb', line 72 def rotate(radians) sin = Math.sin radians cos = Math.cos radians Vector.new cos * @x - sin * @y, sin * @x + cos * @y end |