Class: DotRenderers::Square

Inherits:
Object
  • Object
show all
Defined in:
lib/rubyplot/scripting/line/dotrender.rb

Instance Method Summary collapse

Instance Method Details

#render(d, new_x, new_y, circle_radius) ⇒ Object


11
12
13
14
15
16
17
18
# File 'lib/rubyplot/scripting/line/dotrender.rb', line 11

def render(d, new_x, new_y, circle_radius)
  offset = (circle_radius * 0.8).to_i
  corner_1 = new_x - offset
  corner_2 = new_y - offset
  corner_3 = new_x + offset
  corner_4 = new_y + offset
  d.rectangle(corner_1, corner_2, corner_3, corner_4)
end