16Matrix3qreal KisPerspectiveMath::computeMatrixTransfo(
const QPointF& topLeft1,
const QPointF& topRight1,
const QPointF& bottomLeft1,
const QPointF& bottomRight1 ,
const QPointF& topLeft2,
const QPointF& topRight2,
const QPointF& bottomLeft2,
const QPointF& bottomRight2)
22 a.coeffRef(0, 0) = topLeft1.x();
23 a.coeffRef(0, 1) = topLeft1.y();
25 a.coeffRef(0, 6) = -topLeft2.x() * topLeft1.x();
26 a.coeffRef(0, 7) = -topLeft2.x() * topLeft1.y();
27 a.coeffRef(0, 8) = -topLeft2.x();
28 a.coeffRef(1, 3) = topLeft1.x();
29 a.coeffRef(1, 4) = topLeft1.y();
31 a.coeffRef(1, 6) = -topLeft2.y() * topLeft1.x();
32 a.coeffRef(1, 7) = -topLeft2.y() * topLeft1.y();
33 a.coeffRef(1, 8) = -topLeft2.y();
35 a.coeffRef(2, 0) = topRight1.x();
36 a.coeffRef(2, 1) = topRight1.y();
38 a.coeffRef(2, 6) = -topRight2.x() * topRight1.x();
39 a.coeffRef(2, 7) = -topRight2.x() * topRight1.y();
40 a.coeffRef(2, 8) = -topRight2.x();
41 a.coeffRef(3, 3) = topRight1.x();
42 a.coeffRef(3, 4) = topRight1.y();
44 a.coeffRef(3, 6) = -topRight2.y() * topRight1.x();
45 a.coeffRef(3, 7) = -topRight2.y() * topRight1.y();
46 a.coeffRef(3, 8) = -topRight2.y();
48 a.coeffRef(4, 0) = bottomLeft1.x();
49 a.coeffRef(4, 1) = bottomLeft1.y();
51 a.coeffRef(4, 6) = -bottomLeft2.x() * bottomLeft1.x();
52 a.coeffRef(4, 7) = -bottomLeft2.x() * bottomLeft1.y();
53 a.coeffRef(4, 8) = -bottomLeft2.x();
54 a.coeffRef(5, 3) = bottomLeft1.x();
55 a.coeffRef(5, 4) = bottomLeft1.y();
57 a.coeffRef(5, 6) = -bottomLeft2.y() * bottomLeft1.x();
58 a.coeffRef(5, 7) = -bottomLeft2.y() * bottomLeft1.y();
59 a.coeffRef(5, 8) = -bottomLeft2.y();
61 a.coeffRef(6, 0) = bottomRight1.x();
62 a.coeffRef(6, 1) = bottomRight1.y();
64 a.coeffRef(6, 6) = -bottomRight2.x() * bottomRight1.x();
65 a.coeffRef(6, 7) = -bottomRight2.x() * bottomRight1.y();
66 a.coeffRef(6, 8) = -bottomRight2.x();
67 a.coeffRef(7, 3) = bottomRight1.x();
68 a.coeffRef(7, 4) = bottomRight1.y();
70 a.coeffRef(7, 6) = -bottomRight2.y() * bottomRight1.x();
71 a.coeffRef(7, 7) = -bottomRight2.y() * bottomRight1.y();
72 a.coeffRef(7, 8) = -bottomRight2.y();
79 for (
int r = 0; r < 3; r++)
for (
int c = 0; c < 3; c++) matrix.coeffRef(r, c) =
v.coeff(3 * r + c);