From 7023d5dfdc12fd8b411902ed4a3fb25b6a00585e Mon Sep 17 00:00:00 2001 From: faiface <faiface@ksp.sk> Date: Thu, 1 Dec 2016 01:01:36 +0100 Subject: [PATCH] add Vec.XY method --- vec.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vec.go b/vec.go index eaae3eb..623424d 100644 --- a/vec.go +++ b/vec.go @@ -56,6 +56,11 @@ func (u Vec) Y() float64 { return imag(u) } +// XY returns the components of a vector in two return values. +func (u Vec) XY() (x, y float64) { + return real(u), imag(u) +} + // Len returns the length of a vector u. func (u Vec) Len() float64 { return cmplx.Abs(complex128(u)) -- GitLab