06-14-2023, 03:27 PM
If you have the matrices in left-coordinate system, then you should convert them to DirectX / WPF 3D right-handed coordinate system (x - right, y - up, z - towards the viewer).
You should probably do that by multiplying by the following matrix:
I cannot test that so I cannot say if this will work. As you see from the values, this matrix preserves the x value, swaps the x and z value and negates the z value. The offset (the last row) is preserved.
It may be also possible that you would need to transpose the matrix (some matrices are defined as row-first, and some as column-first). But if this would be the case, then you would probably not see anything - the scene would be too distorted.
I hope that this will solve your problem.
You should probably do that by multiplying by the following matrix:
Code:
// The transformation defines the new axis - defined in matrix columns in upper left 3x3 part of the matrix:
// x axis: 1st column: 1 0 0 (in the positive x direction - same as WPF 3D)
// y axis: 2nd column: 0 0 -1 (in the negative z direction - into the screen)
// z axis: 3rd column: 0 1 0 (in the positive y direction - up)
var matrix = new Matrix3D(1, 0, 0, 0,
0, 0, -1, 0,
0, 1, 0, 0,
0, 0, 0, 1);I cannot test that so I cannot say if this will work. As you see from the values, this matrix preserves the x value, swaps the x and z value and negates the z value. The offset (the last row) is preserved.
It may be also possible that you would need to transpose the matrix (some matrices are defined as row-first, and some as column-first). But if this would be the case, then you would probably not see anything - the scene would be too distorted.
I hope that this will solve your problem.
Andrej Benedik

