class Waxy::Geometry::Point
Attributes
x[RW]
y[RW]
Public Class Methods
new(_x, _y)
click to toggle source
# File lib/waxy/geometry/point.rb, line 7 def initialize(_x, _y) @x = _x @y = _y end
Public Instance Methods
hex_corner_offset(layout, corner)
click to toggle source
# File lib/waxy/geometry/point.rb, line 19 def hex_corner_offset(layout, corner) size = Point.new(layout.size) angle = 2.0 * M_PI * (layout.orientation.start_angle + corner ) / 6 Point.new(size.x * cos(angle), size.y * sin(angle)) end
hex_to_pixel(layout, h)
click to toggle source
# File lib/waxy/geometry/point.rb, line 12 def hex_to_pixel(layout, h) m = layout.orientation x = (m.f0 * h.q + m.f1 * h.r) * layout.size.x y = (m.f2 * h.q + m.f3 * h.r) * layout.size.y return Point.new(x + layout.origin.x, y + layout.origin.y) end