From fe6e43ed1ff1a011ce3ebc0d91c7269e00f845e5 Mon Sep 17 00:00:00 2001 From: gin Date: Sun, 7 Apr 2024 09:25:15 +0200 Subject: [PATCH] Add XY function to destructure Vectors (#132) --- features/math/vec2.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/features/math/vec2.go b/features/math/vec2.go index 72c0e5a..10ce139 100644 --- a/features/math/vec2.go +++ b/features/math/vec2.go @@ -118,3 +118,7 @@ func (v Vec2) Angle(other Vec2) float64 { func (v Vec2) Distance(other Vec2) float64 { return math.Sqrt(math.Pow(v.X-other.X, 2) + math.Pow(v.Y-other.Y, 2)) } + +func (v Vec2) XY() (float64, float64) { + return v.X, v.Y +}