// SPDX-License-Identifier: MIT
// Derived from Rough.js 4.6.6, Copyright (c) 2019 Preet Shihn.

package rough

import 

type zigZagFiller struct {
	hachureFiller
}

func ( *zigZagFiller) ( []Point,  *ResolvedOptions) OpSet {
	 := .HachureGap
	if  < 0 {
		 = .StrokeWidth * 4
	}
	 = math.Max(, 0.1)
	// Object.assign in Rough.js keeps the mutable randomizer shared.
	 := *
	.HachureGap = 
	 := polygonHachureLines(, &)
	 := math.Pi / 180 * .HachureAngle
	 :=  * 0.5 * math.Cos()
	 :=  * 0.5 * math.Sin()
	 := make([]Line, 0, len()*2)
	for ,  := range  {
		,  := [0], [1]
		if lineLength() == 0 {
			continue
		}
		 = append(,
			Line{{[0] - , [1] + }, },
			Line{{[0] + , [1] - }, },
		)
	}
	return OpSet{Type: OpSetFillSketch, Ops: .renderLines(, , false)}
}