A third party algorithm that I'm using is creating the following matrix
| 355,78 : -12,33 : ,02 : ,02 |
| 39,69 : 378,26 : ,08 : ,08 |
| -145,43 : -61,32 : -,49 : -,49 |
| 75610,61 : 25380,20 : 385,12 : 386,92 |
Which places the FrameworkElement in the correct place if I use it as a projection:
player.Graphic.Projection = new Matrix3DProjection { ProjectionMatrix = m };
But this also rotates and skews the element and I only need to move the element to the correct 2D coordinates.
I'm using the following code which I found here: http://www.gamespp.com/tutorials/matrixTransformationTutorial04.html
double x0 = 100, y0 = 100, z0 = 0;
var x1 = x0 * m.M11 + y0 * m.M12 + z0 * m.M13 + m.OffsetX;
var y1 = x0 * m.M21 + y0 * m.M22 + z0 * m.M23 + m.OffsetY;
z0 is unnecessary since it's always zero but I left it there just in case.
That produces x1=109954,75 and y1=67175,64 which are obviously wrong. It should generate some开发者_运维百科thing similar to mx=298 and my=162 (This is the mouse position when the projection was applied)
How can you transform X,Y coordinates using a Matrix3D?
Thanks
精彩评论