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

Function main

examples/csg.go:9–32  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

7)
8
9func main() {
10 shape := ln.NewDifference(
11 ln.NewIntersection(
12 ln.NewSphere(ln.Vector{}, 1),
13 ln.NewCube(ln.Vector{-0.8, -0.8, -0.8}, ln.Vector{0.8, 0.8, 0.8}),
14 ),
15 ln.NewCylinder(0.4, -2, 2),
16 ln.NewTransformedShape(ln.NewCylinder(0.4, -2, 2), ln.Rotate(ln.Vector{1, 0, 0}, ln.Radians(90))),
17 ln.NewTransformedShape(ln.NewCylinder(0.4, -2, 2), ln.Rotate(ln.Vector{0, 1, 0}, ln.Radians(90))),
18 )
19 for i := 0; i < 90; i += 2 {
20 fmt.Println(i)
21 scene := ln.Scene{}
22 m := ln.Rotate(ln.Vector{0, 0, 1}, ln.Radians(float64(i)))
23 scene.Add(ln.NewTransformedShape(shape, m))
24 eye := ln.Vector{0, 6, 2}
25 center := ln.Vector{0, 0, 0}
26 up := ln.Vector{0, 0, 1}
27 width := 750.0
28 height := 750.0
29 paths := scene.Render(eye, center, up, width, height, 20, 0.1, 100, 0.01)
30 paths.WriteToPNG(fmt.Sprintf("out%03d.png", i), width, height)
31 }
32}

Callers

nothing calls this directly

Calls 4

AddMethod · 0.95
RenderMethod · 0.95
RotateMethod · 0.80
WriteToPNGMethod · 0.80

Tested by

no test coverage detected