diff options
author | emile <hanemile@protonmail.com> | 2018-10-08 17:38:10 +0200 |
---|---|---|
committer | emile <hanemile@protonmail.com> | 2018-10-08 17:38:10 +0200 |
commit | 929da9cff24a3853563adb950eea057c16a404fe (patch) | |
tree | a332c19741032e567ecd3d9f4e572fe3ab126dcb /draw | |
parent | ff38efae6116b1d1845d1f5c02ed977934c64ac6 (diff) |
More logging
Diffstat (limited to 'draw')
-rw-r--r-- | draw/draw.go | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/draw/draw.go b/draw/draw.go index b8d552a..785f7b1 100644 --- a/draw/draw.go +++ b/draw/draw.go @@ -2,6 +2,7 @@ package draw import ( "../structs" + "fmt" "github.com/fogleman/gg" "math" ) @@ -20,7 +21,7 @@ func initializePlot() *gg.Context { dc.Clear() // Invert the Y axis (positive values are on the top and right) - dc.InvertY() + // dc.InvertY() // Set the coordinate midpoint to the middle of the image dc.Translate(imageWidth/2, imageHeight/2) @@ -57,7 +58,7 @@ func drawForce(dc *gg.Context, star structs.Star) { // Use a sigmoid function to generate useful values for coloring the vectors according to their // strength - var val = 1.0 / (1.0 + math.Exp(-vecLength/100000)) + var val = 1.0 / (1.0 + math.Exp(-vecLength)) // Set the color to a blue / red dc.SetRGB(val, 0, 1-val) @@ -92,12 +93,18 @@ func drawStars(dc *gg.Context, slice []structs.Star) { // Slice draws the stars and the forces acting on them and saves the result to the given path func Slice(slice []structs.Star, path string) { + fmt.Printf("%-60s", "Plot init") // initialize the plot dc := initializePlot() + fmt.Printf("Done\n") + fmt.Printf("%-60s", "Drawing the Stars") // draw all the stars in the given slice drawStars(dc, slice) + fmt.Printf("Done\n") + fmt.Printf("%-60s", "Saving image") // save the plot to the given path saveImage(dc, path) + fmt.Printf("Done\n") } |