skew matrix algorithm

2019-01-14 09:03发布

问题:

I'm looking for skew algorithm, just like on photoshop, edit->transform->skew is there any simple matrix which could do that?

what I've seen so far was basic skew matrix (shear) but its lack of control point, doesn't like on photoshop which have at least 4 points on each corner of rectangle and we can move each control point freely.

I need to implement it to transform a plane.

回答1:

Looking at http://www.w3.org/TR/SVG11/coords.html, which talks about SVG, it says:

  • A skew transformation along the x-axis is equivalent to the matrix

or [1 0 tan(a) 1 0 0], which has the effect of skewing X coordinates by angle a.

  • A skew transformation along the y-axis is equivalent to the matrix

or [1 tan(a) 0 1 0 0], which has the effect of skewing Y coordinates by angle a.

Hope that helps! :)