From 35c8993423f9240aefa0b4bd839fba85b8a3c944 Mon Sep 17 00:00:00 2001 From: hanemile Date: Fri, 30 Nov 2018 14:19:47 +0100 Subject: added some points for testing the strenghts, and adjusted the colors --- draw/draw.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'draw') diff --git a/draw/draw.go b/draw/draw.go index c5d1474..8b66c90 100644 --- a/draw/draw.go +++ b/draw/draw.go @@ -1,6 +1,7 @@ package draw import ( + "fmt" "git.darknebu.la/GalaxySimulator/Source/structs" "github.com/fogleman/gg" "math" @@ -9,8 +10,8 @@ import ( // initializePlot generates a new plot and returns the plot context func initializePlot() *gg.Context { // Define the image size - const imageWidth = 8192 * 2 - const imageHeight = 8192 * 2 + const imageWidth = 8192 + const imageHeight = 8192 // Initialize the new context dc := gg.NewContext(imageWidth, imageHeight) @@ -57,7 +58,7 @@ func drawStar(dc *gg.Context, star structs.Star2D) { func drawVelocity(dc *gg.Context, star structs.Star2D) { // scaling factor for a better view of the velocity difference // Use this value to control how long the vectors are drawn - var scalingFactor float64 = 25 + var scalingFactor float64 = 50 // Move the "cursor" to the start position of the vector dc.MoveTo(star.C.X/50, star.C.Y/50) @@ -67,7 +68,8 @@ func drawVelocity(dc *gg.Context, star structs.Star2D) { // 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*scalingFactor/2)) + var val = 1.0 / (1.0 + math.Exp(-vecLength*scalingFactor/2 * 1e8)) + fmt.Println(val) // Set the color to a blue / red dc.SetRGB(val, 0, 1-val) -- cgit 1.4.1