about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--draw/draw.go16
-rw-r--r--forces/forces.go4
2 files changed, 16 insertions, 4 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()
 }
diff --git a/forces/forces.go b/forces/forces.go
index 4589246..e3f822d 100644
--- a/forces/forces.go
+++ b/forces/forces.go
@@ -105,8 +105,6 @@ func CalcAllForces(starSlice []structs.Star, threads int) []structs.Star {
 		localRangeStart := i * localRangeLen
 		localRangeEnd := (i * localRangeLen) + localRangeLen
 
-		// fmt.Printf("starting worker nr. %d, processing %d stars\n", i, localRangeEnd-localRangeStart)
-
 		// calculate the forces for all the stars in the given slice in the given range and return them using the
 		// given channel
 		go forcesThread(starSlice, localRangeStart, localRangeEnd, channel)
@@ -164,7 +162,7 @@ func NextTimestep(starSlice []structs.Star, deltat int) []structs.Star {
 		newStar := structs.Star{
 			C:    structs.Coord{X: newX, Y: newY, Z: newZ},
 			F:    structs.Force{},
-			Mass: 50000,
+			Mass: starSlice[index].Mass,
 		}
 
 		// append the new star to the newSlice