Matrix transformation sensitivity
-
I use QMatrix4x4 to find position of an item on screen as below. When xFactor in matrix.scale( xFactor, 1.0f ) is small, transformation goes smoothly and work as expected. When I drag the item on a touch screen, the item follows my finger property. However, when xFactor gets large, transformation is insensitive and jumpy. When dragging, the item no longer follows my finger. At this time, matrix has been changed, but matrix multiplies by the vector position does not change the position. It behaves as if this matrix does not change a lot; as a result, vector position does not change. If I keep dragging a bit more, the item jumps to another position (approximately 100 px from its previous position). This somehow suggests that all of a sudden, the matrix has been changed a lot and yielded a big jump. Any suggestions on what could cause this behavior?
//your code here QMatrix4x4 matrix; matrix.translate( m, n ); //translate back to qt coordinate where origin is top left corner matrix.scale( xFactor, 1.0f ); matrix.translate(-x, -y); // position back to origin ( 0 , 0 ) //qDebug()<<" matrix " << matrix; //find x QPointF point( localX , 0); QPointF tranformPoint = matrix.map(point); float x = tranformPoint.x(); //qDebug()<< " x " << x;