From a759b1c59e63f5515a03183fba79d36491b2d717 Mon Sep 17 00:00:00 2001 From: emile Date: Fri, 19 Oct 2018 17:49:44 +0200 Subject: Adjusted the method for defining how big a star should be drawn. --- draw/draw.go | 10 ++-------- main.go | 9 ++++----- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/draw/draw.go b/draw/draw.go index d1166b4..06d76e2 100644 --- a/draw/draw.go +++ b/draw/draw.go @@ -36,14 +36,14 @@ func saveImage(dc *gg.Context, path string) { // drawStar draws the given stars to the given context func drawStar(dc *gg.Context, star structs.Star2D) { // User the value below to controll how big the stars are overall - var StarScalingFactor float64 = 1 + var starScalingFactor = 50.0 // Default Star Size S := 2.0 // Calculate the Stars Size according to its Mass (Maximal size = 5) if star.M < 5e4 { - S = float64(math.Ceil(star.M/4e4) * StarScalingFactor) + S = float64(math.Ceil(math.Sqrt(star.M)) / starScalingFactor) } else { S = 5.0 } @@ -111,12 +111,6 @@ func Slice(slice []structs.Star2D, path string) { dc.SetRGB(1, 1, 1) - // drawing the 4 big stars as bigger white dots - //dc.DrawCircle(600, 600, 5) - //dc.DrawCircle(-600, 600, 5) - //dc.DrawCircle(-600, 0, 5) - //dc.DrawCircle(600, -600, 5) - dc.Fill() // save the plot to the given path diff --git a/main.go b/main.go index de319c4..97d9986 100644 --- a/main.go +++ b/main.go @@ -15,12 +15,10 @@ func main() { var threads int = 8 var frames int = 1 var rangeStart int = 0 - var rangeEnd int = 5000 + var rangeEnd int = 50000 // the slice starsSlice stores the star structures - starsSlice := []structs.Star2D{ - {C: structs.Vec2{}, M: 5E8}, - } + starsSlice := []structs.Star2D{} logplus.LogNeutral("Opening the csv") starsSlice = csv.Import("data/U_ALL.csv", rangeStart, rangeEnd, starsSlice) @@ -36,8 +34,9 @@ func main() { logplus.LogNeutral("Calculate the acting accelerations") starsSlice = forces.CalcAllAccelerations(starsSlice, threads) - outputName := fmt.Sprintf("out_%d.png", i+1) + outputName := fmt.Sprintf("out_%d.png", i+3) logplus.LogNeutral(fmt.Sprintf("draw the slice and save it to %s\n", outputName)) draw.Slice(starsSlice, outputName) + } } -- cgit 1.4.1