Module: Rough::Fillers::ScanLineHachure

Defined in:
lib/rough/fillers/scan_line_hachure.rb

Class Method Summary collapse

Class Method Details

.polygon_hachure_lines(polygon_list, o) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/rough/fillers/scan_line_hachure.rb', line 10

def polygon_hachure_lines(polygon_list, o)
  angle = o.hachure_angle + 90
  gap = o.hachure_gap
  gap = o.stroke_width * 4 if gap < 0
  gap = [gap.round, 0.1].max

  skip_offset = 1
  if o.roughness >= 1
    rng_val = o.randomizer ? o.randomizer.next : rand
    skip_offset = gap if rng_val > 0.7
  end

  HachureFill.hachure_lines(polygon_list, gap, angle, (skip_offset == 0) ? 1 : skip_offset)
end