diff options
author | hanemile <hanemile@protonmail.com> | 2019-01-24 20:36:42 +0100 |
---|---|---|
committer | hanemile <hanemile@protonmail.com> | 2019-01-24 20:36:42 +0100 |
commit | 6102ad0b000d4b213cff5928239807f993771a40 (patch) | |
tree | e3e818b9e3e1c16027003d47cec5e42bcd127e08 | |
parent | 9f82827465369fd676e221e98b4ca9bf39c78504 (diff) |
update
-rw-r--r-- | star.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/star.go b/star.go index 7450da5..feea20d 100644 --- a/star.go +++ b/star.go @@ -36,6 +36,12 @@ func (s Star2D) InsideOf(boundary BoundingBox) bool { } } +// calcNewPos calculates the new position of a star using the force acting on it +func (s *Star2D) CalcNewPos(force Vec2, timestep float64) { + acceleration := NewVec2(force.X/s.M, force.Y/s.M) + s.Accelerate(acceleration, timestep) +} + // 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} |