Search code examples
c#matrixslimdx

How to invert the y coordinate of a 4x4 matrix?


I'm working in SlimDX and I start with an x,y,z coordinate. I'm converting a point in a right hand coordinate system with Z in the vertical positive position to a right hand y vertical positive(DirectX). To make rotations easy I converted my point into a 4x4 matrix. Now I need to invert the y coordinate. How can I invert just the y coordinate when in matrix form?

Matrix finalMatrix = originalMatrix * 
Matrix.RotationX(MathHelper.ToRadians(85f)) * 
Matrix.RotationY(MathHelper.ToRadians(-.075f)) *
Matrix.RotationZ(MathHelper.ToRadians(55f)) ;

Solution

  • To invert Y you need to reflect point by XZ plane.

    finalMatrix = finalMatrix * Matrix.Reflection(new Plane(0,-1,0, 0));