MCPcopy
hub / github.com/fogleman/ln / run

Function run

examples/cones.go:31–58  ·  view source on GitHub ↗
(seed int)

Source from the content-addressed store, hash-verified

29}
30
31func run(seed int) {
32 // fmt.Println(seed)
33 rand.Seed(int64(seed))
34 eye := ln.Vector{}
35 center := ln.Vector{0.5, 0, 8}
36 up := ln.Vector{0, 0, 1}
37 scene := ln.Scene{}
38 n := 9.0
39 points := pt.PoissonDisc(-n, -n, n, n, 2, 32)
40 for _, p := range points {
41 z := rand.Float64()*5 + 20
42 v0 := ln.Vector{p.X, p.Y, 0}
43 v1 := ln.Vector{p.X, p.Y, z}
44 if v0.Distance(eye) < 1 {
45 continue
46 }
47 c := ln.NewTransformedOutlineCone(eye, up, v0, v1, z/64)
48 tree := Tree{c, v0, v1}
49 scene.Add(&tree)
50 }
51 width := 2048.0
52 height := 2048.0
53 fovy := 90.0
54 paths := scene.Render(eye, center, up, width, height, fovy, 0.1, 100, 0.1)
55 path := fmt.Sprintf("out%d.png", seed)
56 paths.WriteToPNG(path, width, height)
57 paths.Print()
58}
59
60func main() {
61 run(10)

Callers 1

mainFunction · 0.85

Calls 5

DistanceMethod · 0.95
AddMethod · 0.95
RenderMethod · 0.95
WriteToPNGMethod · 0.80
PrintMethod · 0.45

Tested by

no test coverage detected