MCPcopy
hub / github.com/fogleman/primitive / Mutate

Method Mutate

primitive/rectangle.go:57–69  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

55}
56
57func (r *Rectangle) Mutate() {
58 w := r.Worker.W
59 h := r.Worker.H
60 rnd := r.Worker.Rnd
61 switch rnd.Intn(2) {
62 case 0:
63 r.X1 = clampInt(r.X1+int(rnd.NormFloat64()*16), 0, w-1)
64 r.Y1 = clampInt(r.Y1+int(rnd.NormFloat64()*16), 0, h-1)
65 case 1:
66 r.X2 = clampInt(r.X2+int(rnd.NormFloat64()*16), 0, w-1)
67 r.Y2 = clampInt(r.Y2+int(rnd.NormFloat64()*16), 0, h-1)
68 }
69}
70
71func (r *Rectangle) Rasterize() []Scanline {
72 x1, y1, x2, y2 := r.bounds()

Callers

nothing calls this directly

Calls 1

clampIntFunction · 0.85

Tested by

no test coverage detected