class CooCoo::Image::Rotate

Public Class Methods

new(ox, oy, radians) click to toggle source
Calls superclass method
# File lib/coo-coo/image.rb, line 201
def initialize(ox, oy, radians)
  super()
  @ox = ox
  @oy = oy
  @radians = radians
end

Public Instance Methods

call(x, y) click to toggle source
# File lib/coo-coo/image.rb, line 208
def call(x, y)
  c = ::Math.cos(@radians)
  s = ::Math.sin(@radians)
  
  x = x - @ox
  y = y - @oy

  nx = x * c - y * s
  ny = x * s + y * c
  
  nx = nx + @ox
  ny = ny + @oy
  
  [ nx.floor, ny.floor ]
end