diff options
author | emile <hanemile@protonmail.com> | 2018-10-15 15:32:13 +0200 |
---|---|---|
committer | emile <hanemile@protonmail.com> | 2018-10-15 15:32:13 +0200 |
commit | 088372b31882dd0217d8cc36d7abeac8b6268382 (patch) | |
tree | 72cde48dd5ebdcd1dbe46d1ddec47cda2d2ae592 /draw/draw3D.go | |
parent | 04f6bbb6a71b38c2ea40cec68d5de9fe15d430ef (diff) |
refactored the Star type to Star2D
Diffstat (limited to 'draw/draw3D.go')
-rw-r--r-- | draw/draw3D.go | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/draw/draw3D.go b/draw/draw3D.go deleted file mode 100644 index 62d0f05..0000000 --- a/draw/draw3D.go +++ /dev/null @@ -1,58 +0,0 @@ -package draw - -import ( - "../llog" - "../structs" - "github.com/fogleman/ln/ln" -) - -func drawStar3D(scene ln.Scene, star structs.Star) ln.Scene { - starSize := 0.1 - oneCorner := ln.Vector{star.C.X - starSize, star.C.Y - starSize, star.C.Z - starSize} - otherCorner := ln.Vector{star.C.X + starSize, star.C.Y + starSize, star.C.Z + starSize} - - scene.Add(ln.NewCube(oneCorner, otherCorner)) - - return scene -} - -func drawStars3D(scene ln.Scene, slice []structs.Star) ln.Scene { - for _, star := range slice { - scene = drawStar3D(scene, star) - } - - return scene -} - -func Slice3D(slice []structs.Star, path string) { - // create a scene and add a single cube - scene := ln.Scene{} - - llog.Good("Drawing the Stars") - scene = drawStars3D(scene, slice) - llog.Good("Done Drawing the Stars") - - // scene.Add(ln.NewCube(ln.Vector{-1, -1, -1}, ln.Vector{1, 1, 1})) - - // define camera parameters - eye := ln.Vector{4, 3, 2} // camera position - center := ln.Vector{0, 0, 0} // camera looks at - up := ln.Vector{0, 0, 1} // up direction - - // define rendering parameters - width := 1024.0 // rendered width - height := 1024.0 // rendered height - fovy := 50.0 // vertical field of view, degrees - znear := 0.1 // near z plane - zfar := 10.0 // far z plane - step := 0.01 // how finely to chop the paths for visibility testing - - llog.Good("Configuring path") - // compute 2D paths that depict the 3D scene - paths := scene.Render(eye, center, up, width, height, fovy, znear, zfar, step) - llog.Good("Done") - - // render the paths in an image - llog.Good("Writing to png") - paths.WriteToPNG(path, width, height) -} |