Matrix for reflecting points on the line y=x

Is there are a matrix for this? I’ve been trying to come up with something, seems impossible to me.

Could you be more specific??

If you are thinking in a 3D space, it is not line but a plane.

And in what is it related to OpenGL? you should at least ask your question on the math section.

If you search the matrix for the linear function that maps (x,y) to (y,x) then the 2D matrix is
(0 1)
(1 0)

I was going to put it in the math section, but I figured I want to understand the matrix and it is probably going to be a shear function of some sort.

So that matrix you’ve given is in fact a shear function

010
100
001

I can’t really understand how this would move and object as there very very little on shearing on the net lol, but I’ll try it out, thanks.

Actually it is a simple permutation matrix that swaps x and y.

true, any axis swap (*= -1.0) is mirroring/reflecting to the opposite side.