about summary refs log tree commit diff
diff options
context:
space:
mode:
authoremile <hanemile@protonmail.com>2018-10-19 17:46:22 +0200
committeremile <hanemile@protonmail.com>2018-10-19 17:46:22 +0200
commitadb8b4f877c0145a1e56a7bdf37fd5bd66640b17 (patch)
tree3d81a5ddae3a8dd8c72fe43b352595ba0eda4892
parent999a45b25f3f7d9a4e7356a41a9ea6c1ac18520b (diff)
Added some extra comments.
-rw-r--r--structs/star.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/structs/star.go b/structs/star.go
index 72afc00..f495d99 100644
--- a/structs/star.go
+++ b/structs/star.go
@@ -2,27 +2,32 @@ package structs
 
 import "C"
 
+// Define a struct storing essential star information such as it's coordinate, velocity and mass
 type Star2D struct {
 	C Vec2    // coordinates of the star
 	V Vec2    // velocity    of the star
 	M float64 // mass        of the star
 }
 
+// Return a copy of the star by returning a star struct with the same values.
 func (s *Star2D) Copy() Star2D {
 	return Star2D{s.C.Copy(), s.V.Copy(), s.M}
 }
 
-// accelerate the star with the acceleration a for the time t
+// Accelerate the star with the acceleration a for the time t.
+// This changes the velocity of the star.
 func (s *Star2D) AccelerateVelocity(a Vec2, t float64) {
 	s.V = s.V.Add(a.Multiply(t))
 }
 
-// move the star with it's velocity for the time t
+// Move the star with it's velocity for the time t.
+// This changes the Position of the star.
 func (s *Star2D) Move(t float64) {
 	s.C = s.C.Add(s.V.Multiply(t))
 }
 
-// accelerate and move the star with it's velocity and the acceleration a for the time t
+// Accelerate and move the star with it's velocity and the acceleration a for the time t
+// This changes the position and the velocity of the star.
 func (s *Star2D) Accelerate(a Vec2, t float64) {
 	s.AccelerateVelocity(a, t)
 	s.Move(t)