Advertisement
Guest User

Untitled

a guest
May 13th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.98 KB | None | 0 0
  1. Known:
  2. The vertices: a.x, a.y, b.x, b.y, c.x, c.y, d.x, d.y
  3.  
  4. Unknown:
  5. the scaling factor: k
  6. the rotation factor: theta
  7. the translation vector: v.x, v.y
  8.  
  9. matrix form:
  10.  
  11. [scaling matrix] * [rotation matrix] * [translation matrix] * [a and b] == [c and d]
  12.  
  13. +-- --+ +-- --+ +-- --+ +-- --+ +-- --+
  14. | k 0 0 | | cos(theta) -sin(theta) 0 | | 1 0 v.x | | a.x b.x | | c.x d.x |
  15. | 0 k 0 | * | sin(theta) cos(theta) 0 | * | 0 1 v.y | * | a.y b.y | == | c.y d.y |
  16. | 0 0 1 | | 0 0 1 | | 0 0 1 | | 1 1 | | 1 1 |
  17. +-- --+ +-- --+ +-- --+ +-- --+ +-- --+
  18.  
  19. multiply first three matrices
  20.  
  21. +-- --+ +-- --+ +-- --+
  22. | k * cos(theta) k * -sin(theta) (k * cos(theta) * v.x + k * -sin(theta) * v.y) | | a.x b.x | | c.x d.x |
  23. | k * sin(theta) k * cos(theta) (k * sin(theta) * v.x + k * cos(theta) * v.y) | * | a.y b.y | == | c.y d.y |
  24. | 0 0 1 | | 1 1 | | 1 1 |
  25. +-- --+ +-- --+ +-- --+
  26.  
  27. Equivalent series of equations:
  28. (k * cos(theta) * a.x + k * -sin(theta) * a.y + (k * cos(theta) * v.x + k * -sin(theta) * v.y)) = c.x
  29. (k * cos(theta) * b.x + k * -sin(theta) * b.y + (k * cos(theta) * v.x + k * -sin(theta) * v.y)) = d.x
  30. (k * sin(theta) * a.x + k * cos(theta) * a.y + (k * sin(theta) * v.x + k * cos(theta) * v.y)) = c.y
  31. (k * sin(theta) * b.x + k * cos(theta) * b.y + (k * sin(theta) * v.x + k * cos(theta) * v.y)) = d.y
  32.  
  33. Goal:
  34. solve for k, theta, and v
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement