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

Function NewRandomTriangle

primitive/triangle.go:17–28  ·  view source on GitHub ↗
(worker *Worker)

Source from the content-addressed store, hash-verified

15}
16
17func NewRandomTriangle(worker *Worker) *Triangle {
18 rnd := worker.Rnd
19 x1 := rnd.Intn(worker.W)
20 y1 := rnd.Intn(worker.H)
21 x2 := x1 + rnd.Intn(31) - 15
22 y2 := y1 + rnd.Intn(31) - 15
23 x3 := x1 + rnd.Intn(31) - 15
24 y3 := y1 + rnd.Intn(31) - 15
25 t := &Triangle{worker, x1, y1, x2, y2, x3, y3}
26 t.Mutate()
27 return t
28}
29
30func (t *Triangle) Draw(dc *gg.Context, scale float64) {
31 dc.LineTo(float64(t.X1), float64(t.Y1))

Callers 1

RandomStateMethod · 0.85

Calls 1

MutateMethod · 0.95

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…