Swapping X,Y coordinates in a rectangle, what is this operation called?
-
12-09-2019 - |
Question
Trying to find a good name for a method swapping each coordinate X and Y values.
Is there a name for this operation?
Essentially, here's what is done
(1, 2) -> (2, 1)
On a polygon, this is the same as having a rotation of -90 degrees and doing a horizontal flip or mirror.
Solution
In a matrix, it is called the Transpose.
OTHER TIPS
This is called a reflection, or line symmetry. In your case, the line is X=Y. It is invariant by the symmetry.
It would be reflection about line x=y which is one of the transformations in coordinate geometry.
cheers
Perhaps you want a transpose it would turn the row vector (1 2) into a column vector (1 2), so your question and example with the (1, 2) is a little unclear. Abstractly:
array=[[ 0., 1., 2.],
[ 11., 0., 3.],
[ 22., 33., 0.]]
transposed_array=transpose(array).
print transposed_array
[[ 0., 11., 22.],
[ 1., 0., 33.],
[ 2., 3., 0.]]
It is NOT a reflection about x=y (at best x=-y and only for square matrices). Please look at the link abelenky posted on transpose. Eric Bainville and Andriyev answer's would be closer to correct if they said x=-y, but never technically sufficient. Also, it is NOT a matrix inversion which involves changing the values of individual components. If I interpret your statement "rotation of -90 degrees [that is 90 degrees clockwise] and doing a horizontal flip or mirror." correctly, then this is indeed the correct answer.