From 6102ad0b000d4b213cff5928239807f993771a40 Mon Sep 17 00:00:00 2001 From: hanemile Date: Thu, 24 Jan 2019 20:36:42 +0100 Subject: update --- star.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'star.go') 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} -- cgit 1.4.1