From 31d4f081736df00b954dd609b56d3f89bc58121e Mon Sep 17 00:00:00 2001 From: faiface <faiface@ksp.sk> Date: Sat, 18 Mar 2017 11:34:31 +0100 Subject: [PATCH] add Vec.YX --- geometry.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/geometry.go b/geometry.go index ad63f99..a7bb515 100644 --- a/geometry.go +++ b/geometry.go @@ -73,6 +73,11 @@ func (u Vec) XY() (x, y float64) { return real(u), imag(u) } +// YX returns the components of the vector in two return values in reversed order. +func (u Vec) YX() (y, x float64) { + return imag(u), real(u) +} + // Len returns the length of the vector u. func (u Vec) Len() float64 { return cmplx.Abs(complex128(u)) -- GitLab