A detailed explanation of two-dimensional transformations in Silverlight

Source: Internet
Author: User
Keywords nbsp zoom below this
Tags class create direction graphics image

Silverlight includes rotational (RotateTransform), Scaling (ScaleTransform), skew (SkewTransform), and panning (TranslateTransform) for common transformation transformations.

There is also a matrixtransform class that can create custom transformations that are not provided by the RotateTransform, ScaleTransform, SkewTransform, and TranslateTransform classes.

All of the following example blue is the original position, red is the transformed position, purple is the overlapping position! Introduction to one or two-D transformation matrices

This is the two-dimensional graph geometric transformation matrix.

The graphics are scaled, rotated, symmetric, and wrong-cut transformations. (Note: symmetry, wrong-cut is computer graphics, Microsoft Translation is distorted, the plane transformation will not transform the distorted image.) ) is a translation transformation of the image, is the projection of the graphics transform, Silverlight is not supported, is the overall graphics to do telescopic transformation, nor in Silverlight support;

The original image does not make any transformation of the matrix: in the back will often use this matrix.

Translation transformation

Only modify offsetx and offsety to achieve the goal the following shows the corresponding transformations of several groups of matrices respectively.

You can see that the direction of the OffsetX and OffsetY is the same as that in the rectangular coordinate system.

Third, proportional transformation (scaling)

Modify M11 and M22 to scale the x-axis and y-axis respectively. When the M11=M22 is equal proportional transformation, the M11!=M22 is Non-uniform proportional transformation.

You can see that M11 is working on the Y axis, M22 is working on the x-axis.

Iv. Symmetric transformations

The symmetrical transformation altogether 5 kinds, respectively is the Y axis symmetry, the x axis symmetry, the center symmetry, the y=x symmetry, the y=-x symmetry, specifically see the following figure

V. Rotation transformation

Here is the variation matrix of the rotational 30°. Other angles are also the formula.

Six, cut the wrong transformation

M12,M21 is used to control the error-cutting transformation.

M12=0,m21!=0, the y axis coordinates unchanged, the x coordinates with the initial value and the transformation coefficient M21 to do the linear change, m21>0 along the +x direction cut wrong, m21<0 along-x direction.

M21=0,m12!=0, the x-axis coordinates unchanged, the y-coordinate with the initial value and the transformation coefficient M12 do a linear change, m12>0 along the y direction of the error, m12<0 along the y-direction of the wrong cut.

When M12!=0 and m21!=0, the graph is incorrectly cut along XY two.

Complex transformation

A composite transformation is actually a matrix multiplication. Here are two complete calculation formulas:

XY coordinate formula before and after transformation:

33 Matrix Multiplication Formula:

Thank you for watching, the two-dimensional transformation of the matrix content is so much, three-dimensional matrix transformation 44 matrix, have the opportunity to write again.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.