Convert a PlaneProjection into a MatrixTransform
I have a plane projection as follows:
<Rectangle Fill="Red" Margin="50">
<Rectangle.Projection>
<PlaneProjection RotationX="开发者_JAVA百科-40"/>
</Rectangle.Projection>
</Rectangle>
For various reasons I would like to use a MatrixTransform instead. Does anyone know what the equivalent MatrixTransform would be?
The PlaneProjection
is a non-linear transformation while the MatrixTransform
is:
http://www.charlespetzold.com/blog/2009/01/Non-Affine-Transforms-in-Silverlight.html
There will be no way to express the exact same prjection with a linear transform.
If you are transforming an image or non-interactive element you may split it in two triangles to get a good "3d" effect without using a projection. For example this cube uses this approach (SL 2.0 code there):
http://www.codeproject.com/KB/silverlight/CubeProject.aspx
Finally if you just need the transformation matrix, you can access it from the ProjectionMatrix
property.
var matrix = (myElement.Projection as PlaneProjection).ProjectionMatrix;
var matrixProjection = new Matrix3DProjection { ProjectionMatrix = matrix };
This is also how you can use it to create a Matrix3DProjection
精彩评论