From 58849bac281f3d60ca3200038c47007e1ae845a8 Mon Sep 17 00:00:00 2001 From: emile Date: Mon, 15 Oct 2018 15:19:52 +0200 Subject: The size of the stars is now proportional to its mass --- draw/draw.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'draw') diff --git a/draw/draw.go b/draw/draw.go index e99ef4e..92518ef 100644 --- a/draw/draw.go +++ b/draw/draw.go @@ -35,7 +35,21 @@ func saveImage(dc *gg.Context, path string) { // drawStar draws the given stars to the given context func drawStar(dc *gg.Context, star structs.Star) { - dc.DrawPoint(star.C.X/50, star.C.Y/50, 2) + // the radius can be any value inbetween 1e4 and 1e5 + + // Define the default star radius as 1 and change it according to the stars mass + radius := 1 + switch { + case star.Mass < 10000: + radius = 1 + case star.Mass < 50000 && star.Mass > 10000: + radius = 2 + case star.Mass < 100000 && star.Mass > 50000: + radius = 3 + } + + // Draw the star + dc.DrawPoint(star.C.X/50, star.C.Y/50, float64(radius)) dc.Fill() dc.Stroke() } -- cgit 1.4.1