package rough
type hachureFiller struct {
helper renderHelper
}
func (f *hachureFiller ) fillPolygon (points []Point , o *ResolvedOptions ) OpSet {
return f .fillPolygonWithConnectEnds (points , o , false )
}
func (f *hachureFiller ) fillPolygonWithConnectEnds (points []Point , o *ResolvedOptions , connectEnds bool ) OpSet {
lines := polygonHachureLines (points , o )
ops := f .renderLines (lines , o , connectEnds )
return OpSet {Type : OpSetFillSketch , Ops : ops }
}
func (f *hachureFiller ) renderLines (lines []Line , o *ResolvedOptions , connectEnds bool ) []Op {
ops := make ([]Op , 0 )
var prevPoint *Point
for _ , line := range lines {
ops = append (ops , f .helper .doubleLineOps (
line [0 ][0 ], line [0 ][1 ], line [1 ][0 ], line [1 ][1 ], o ,
)...)
if connectEnds && prevPoint != nil {
ops = append (ops , f .helper .doubleLineOps (
(*prevPoint )[0 ], (*prevPoint )[1 ], line [0 ][0 ], line [0 ][1 ], o ,
)...)
}
p := line [1 ]
prevPoint = &p
}
return ops
}
The pages are generated with Golds v0.8.7 . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds .