将PlaneProjection转换为MatrixTransform

Col*_*inE 1 silverlight

我有一个平面投影如下:

<Rectangle Fill="Red" Margin="50">
    <Rectangle.Projection>
        <PlaneProjection RotationX="-40"/>
    </Rectangle.Projection>
</Rectangle>
Run Code Online (Sandbox Code Playgroud)

由于各种原因,我想使用MatrixTransform.有谁知道等效的MatrixTransform会是什么?

小智 6

PlaneProjection是一个非线性变换,MatrixTransform而是:

http://www.charlespetzold.com/blog/2009/01/Non-Affine-Transforms-in-Silverlight.html

用线性变换无法表达完全相同的投影.

如果要变换图像或非交互元素,可以将其拆分为两个三角形,以获得良好的"3d"效果,而无需使用投影.例如,此多维数据集使用此方法(SL 2.0代码):

http://www.codeproject.com/KB/silverlight/CubeProject.aspx

最后,如果您只需要转换矩阵,则可以从ProjectionMatrix属性中访问它.

var matrix = (myElement.Projection as PlaneProjection).ProjectionMatrix;
var matrixProjection = new Matrix3DProjection { ProjectionMatrix = matrix };
Run Code Online (Sandbox Code Playgroud)

这也是你如何使用它来创建一个 Matrix3DProjection