diff --git a/vec.go b/vec.go index eaae3eb2bb6cef0f48e8f1e0f67a6aa8f4a1ff2f..623424d9425225d92302739710bb83ff6781e58a 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))