Class: Rough::Fillers::ZigzagLine

Inherits:
Object
  • Object
show all
Defined in:
lib/rough/fillers/zigzag_line.rb

Instance Method Summary collapse

Constructor Details

#initialize(helper) ⇒ ZigzagLine

Returns a new instance of ZigzagLine.



9
10
11
# File 'lib/rough/fillers/zigzag_line.rb', line 9

def initialize(helper)
  @helper = helper
end

Instance Method Details

#fill_polygons(polygon_list, o) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/rough/fillers/zigzag_line.rb', line 13

def fill_polygons(polygon_list, o)
  gap = (o.hachure_gap < 0) ? (o.stroke_width * 4) : o.hachure_gap
  zo = (o.zigzag_offset < 0) ? gap : o.zigzag_offset
  o2 = o.merge(hachure_gap: gap + zo)
  lines = ScanLineHachure.polygon_hachure_lines(polygon_list, o2)
  OpSet.new(type: :fillSketch, ops: zigzag_lines(lines, zo, o2))
end