MCPcopy Index your code
hub / github.com/fogleman/ln / main

Function main

examples/example0.go:5–31  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3import "github.com/fogleman/ln/ln"
4
5func main() {
6 // create a scene and add a single cube
7 scene := ln.Scene{}
8 scene.Add(ln.NewCube(ln.Vector{-1, -1, -1}, ln.Vector{1, 1, 1}))
9
10 // define camera parameters
11 eye := ln.Vector{4, 3, 2} // camera position
12 center := ln.Vector{0, 0, 0} // camera looks at
13 up := ln.Vector{0, 0, 1} // up direction
14
15 // define rendering parameters
16 width := 1024.0 // rendered width
17 height := 1024.0 // rendered height
18 fovy := 50.0 // vertical field of view, degrees
19 znear := 0.1 // near z plane
20 zfar := 10.0 // far z plane
21 step := 0.01 // how finely to chop the paths for visibility testing
22
23 // compute 2D paths that depict the 3D scene
24 paths := scene.Render(eye, center, up, width, height, fovy, znear, zfar, step)
25
26 // save the result as a png
27 paths.WriteToPNG("out.png", width, height)
28
29 // save the result as an svg
30 paths.WriteToSVG("out.svg", width, height)
31}

Callers

nothing calls this directly

Calls 4

AddMethod · 0.95
RenderMethod · 0.95
WriteToPNGMethod · 0.80
WriteToSVGMethod · 0.80

Tested by

no test coverage detected