diff options
author | emile <hanemile@protonmail.com> | 2018-10-15 15:19:52 +0200 |
---|---|---|
committer | emile <hanemile@protonmail.com> | 2018-10-15 15:19:52 +0200 |
commit | 58849bac281f3d60ca3200038c47007e1ae845a8 (patch) | |
tree | 0bd5c7c8655dcd285c04ca62823d4fda9cf3d5be /draw | |
parent | 95f9ab588b7840739fbd782653926a3a74e99ab4 (diff) |
The size of the stars is now proportional to its mass
Diffstat (limited to 'draw')
-rw-r--r-- | draw/draw.go | 16 |
1 files changed, 15 insertions, 1 deletions
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() } |