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

package rough

import 

type zigZagLineFiller struct {
	helper renderHelper
}

func ( *zigZagLineFiller) ( []Point,  *ResolvedOptions) OpSet {
	 := .HachureGap
	if  < 0 {
		 = .StrokeWidth * 4
	}
	 := .ZigzagOffset
	if  < 0 {
		 = 
	}
	 := *
	.HachureGap =  + 
	 := polygonHachureLines(, &)
	return OpSet{Type: OpSetFillSketch, Ops: .zigzagLines(, , &)}
}

func ( *zigZagLineFiller) ( []Line,  float64,  *ResolvedOptions) []Op {
	 := make([]Op, 0)
	for ,  := range  {
		 := lineLength()
		 := jsRound( / (2 * ))
		,  := [0], [1]
		if [0] > [0] {
			,  = [1], [0]
		}
		 := math.Atan(([1] - [1]) / ([0] - [0]))
		for  := 0.0;  < ; ++ {
			 :=  * 2 * 
			 := ( + 1) * 2 * 
			 := math.Sqrt(2 * math.Pow(, 2))
			 := Point{[0] + *math.Cos(), [1] + *math.Sin()}
			 := Point{[0] + *math.Cos(), [1] + *math.Sin()}
			 := Point{
				[0] + *math.Cos(+math.Pi/4),
				[1] + *math.Sin(+math.Pi/4),
			}
			 = append(, .helper.doubleLineOps([0], [1], [0], [1], )...)
			 = append(, .helper.doubleLineOps([0], [1], [0], [1], )...)
		}
	}
	return 
}