May 2019
Intermediate to advanced
542 pages
13h 37m
English
We also want to implement zooming. Each time we click the zoom-in or zoom-out buttons, we want the image to get a tiny bit closer or further away.
Those callbacks look like this:
def zoom_in(self): self.view_matrix.scale(1.1, 1.1, 1.1) def zoom_out(self): self.view_matrix.scale(.9, .9, .9)
The scale() method of QMatrix4x4 causes the matrix to multiply each vertex point by the given amounts. Thus, we can cause our object to shrink or grow, giving the illusion that it is nearer or further away.
We could use translate() here, but translating in conjunction with rotation can cause some confusing results and we can lose sight of our object quickly.
Now, when you run the application, you should be able to spin your wedge and ...
Read now
Unlock full access