如何在Silverlight中从matrix3d获得2d点? [英] How can I get a 2d point from a matrix3d in silverlight?
问题描述
我有一个Matrix3D对象,该对象定义了具有透视图的2d平面. (想想一幅大画掉在地上,离你很远)
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)
翻译后如何获得与新位置相关的2d点?
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.
推荐答案
您需要使用此矩阵转换(X,Y,0)形式的3D向量.不幸的是,Matrix3D没有合适的方法,因此您必须手动编写矩阵向量乘法.无论如何,当您进行变换时,新的X,Y坐标将对应于屏幕空间中变换后的位置,而Z坐标将成为深度.
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.
这篇关于如何在Silverlight中从matrix3d获得2d点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!