From fd0ffc82ec36d021669e1bbf10f74bfc3822dd57 Mon Sep 17 00:00:00 2001 From: hanemile Date: Fri, 14 Dec 2018 15:55:48 +0100 Subject: updated stuff... --- boundingBox.go | 4 ++-- star.go | 4 ++++ vector2D.go | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/boundingBox.go b/boundingBox.go index 4e9bf7d..6cf60c4 100644 --- a/boundingBox.go +++ b/boundingBox.go @@ -6,6 +6,6 @@ type BoundingBox struct { Width float64 // Width of the box } -func NewBoundingBox(center Vec2, width float64) *BoundingBox { - return &BoundingBox{Center: center, Width: width} +func NewBoundingBox(center Vec2, width float64) BoundingBox { + return BoundingBox{Center: center, Width: width} } diff --git a/star.go b/star.go index 2255a69..3a7f66e 100644 --- a/star.go +++ b/star.go @@ -7,6 +7,10 @@ type Star2D struct { M float64 // mass of the star } +func NewStar2D(c Vec2, v Vec2, m float64) Star2D { + return Star2D{C: c, V: v, M: m} +} + // InsideOf is a method that tests if the star it is applied on is in or outside of the given // BoundingBox. It returns true if the star is inside of the BoundingBox and false if it isn't. func (s Star2D) InsideOf(boundary BoundingBox) bool { diff --git a/vector2D.go b/vector2D.go index 6beedb2..2b95a72 100644 --- a/vector2D.go +++ b/vector2D.go @@ -9,8 +9,8 @@ type Vec2 struct { } // newVec2 returns a new Vec2 using the given coordinates -func newVec2(x float64, y float64) *Vec2 { - return &Vec2{ +func NewVec2(x float64, y float64) Vec2 { + return Vec2{ X: x, Y: y, } -- cgit 1.4.1