How can I get a 2d point from a matrix3d in silver

2019-08-06 10:47发布

问题:

I have a Matrix3D object that defines a 2d plane with perspective. (think a large painting that has fallen on the floor, away from you)

How can I get the 2d point that relates to the new location after the translation ?

If the 'painting' was three horizontal stripes then once the 'painting' is transformed those three stripes of equal width are now a trapezoid where the top stripe is smaller than the middle and bottom one.

回答1:

You need to transform a 3D vector of the form (X, Y, 0) using this matrix. Unfortunately, Matrix3D doesn't have an appropriate method, so you'll have to write the matrix-vector multiplication by hand. Anyway, when you do the transform, the new X, Y coordinates will correspond to the transformed position in screen space, and the Z coordinate will be the depth.