diff options
author | hanemile <hanemile@protonmail.com> | 2018-11-02 23:11:23 +0100 |
---|---|---|
committer | hanemile <hanemile@protonmail.com> | 2018-11-02 23:11:23 +0100 |
commit | 64b1239108c6f275b14579dbd8aab0bc3b2524d6 (patch) | |
tree | f7d28512d273cf24077b24ed43a29afa53154618 /structs | |
parent | dbc75dfc7b01893c1a6a11aee33be37da70d7bae (diff) |
added a Vector2 generator functoin
Diffstat (limited to 'structs')
-rw-r--r-- | structs/vector2D.go | 8 |
1 files changed, 8 insertions, 0 deletions
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} |