Rank: Advanced Member
Groups: Member, Administration Joined: 8/2/2003(UTC) Posts: 876
Thanks: 2 times Was thanked: 27 time(s) in 27 post(s)
|
Non-affine transformations are made in the similar way as affine ones, but they use larger matrix. To build such matrix from points, we should construct system of linear equations and calculate its coefficients. If you like, I could describe how to do it. However fortunately there is an easier way. We can just each point on rotation matrix and use ProjectivePoints method instead of ProjectiveMatrix. Moreover, as you rotate on 90 degrees, it becomes much simplier - you even can do no calculations, but just rearrange parameters of ProjectivePoints. Rotation matrix is Code:
| cos(a) sin(a) |
| |
| -sin(a) cos(a) |
Argument a is a counter-clockwise angle there. You are rotating 90 degrees clockwise, so in our case a = -90. Let's calculate that: Code:
| cos(-90) sin(-90) | | 0 -1 |
| | = | |
| -sin(-90) cos(-90) | | 1 0 |
As you see, transformation is extremely simple: Code:
| 0 -1 | | x | | -y |
| | * | | = | |
| 1 0 | | y | | x |
In other word you should just swap x and y and change sign of y. In other words, instead of Code:
objBitmap.Transforms.ProjectivePoints 0, 200, 300, -890, 32, 1386, 600, 50, _
0, 0, 1386, 0, 0, 1386, 1386, 1386
use this code: Code:
objBitmap.Transforms.ProjectivePoints -200, 0, 890, 300, -1386, 32, -50, 600, _
0, 0, 1386, 0, 0, 1386, 1386, 1386
It will be equivalent to calling Rotate method with angle argument = 90. Please let me know if you have any questions with it. Edited by user Monday, December 24, 2007 5:23:50 PM(UTC)
| Reason: Not specified
|