From 64b1239108c6f275b14579dbd8aab0bc3b2524d6 Mon Sep 17 00:00:00 2001 From: hanemile Date: Fri, 2 Nov 2018 23:11:23 +0100 Subject: added a Vector2 generator functoin --- structs/vector2D.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/structs/vector2D.go b/structs/vector2D.go index 47e457f..6beedb2 100644 --- a/structs/vector2D.go +++ b/structs/vector2D.go @@ -8,6 +8,14 @@ type Vec2 struct { X, Y float64 } +// newVec2 returns a new Vec2 using the given coordinates +func newVec2(x float64, y float64) *Vec2 { + return &Vec2{ + X: x, + Y: y, + } +} + // creates a copy of the vector func (v *Vec2) Copy() Vec2 { return Vec2{v.X, v.Y} -- cgit 1.4.1