class SK::Vec2
Attributes
x[RW]
y[RW]
Public Class Methods
new(x = 0.0, y = 0.0)
click to toggle source
# File lib/shirokuro/math/vec2.rb, line 5 def initialize x = 0.0, y = 0.0 @x = x @y = y end
Public Instance Methods
*(other)
click to toggle source
# File lib/shirokuro/math/vec2.rb, line 24 def * other if other.is_a?(Numeric) return Vec2.new(@x * other, @y * other) end Vec2.new(@x * other.x, @y * other.y) end
+(other)
click to toggle source
# File lib/shirokuro/math/vec2.rb, line 10 def + other if other.is_a?(Numeric) return Vec2.new(@x + other, @y + other) end Vec2.new(@x + other.x, @y + other.y) end
-(other)
click to toggle source
# File lib/shirokuro/math/vec2.rb, line 17 def - other if other.is_a?(Numeric) return Vec2.new(@x - other, @y - other) end Vec2.new(@x - other.x, @y - other.y) end
/(other)
click to toggle source
# File lib/shirokuro/math/vec2.rb, line 31 def / other if other.is_a?(Numeric) return Vec2.new(@x / other, @y / other) end Vec2.new(@x / other.x, @y / other.y) end