Feature #5: Auto Rotate in Mobile Devices
Explore how to implement an auto rotate feature for profile pictures on mobile devices during video calls. Understand how to rotate an n x n matrix in place with a 90-degree clockwise rotation while maintaining optimal time and space efficiency. This lesson helps you grasp the implementation details and complexity analysis for this common mobile interface feature.
We'll cover the following...
Description
Zoom is the leader in enabling smart enterprise video conferences. The offer of support it presents for a wide range of devices and operating systems is one of the main reasons for its popularity. Many users join meetings using mobile handheld devices, which can be rotated. We want to implement a rotate functionality on the profile pictures shown against each user in a meeting. We will start with the functionality to rotate 90 degrees clockwise. We will rotate the coordinates of the profile pictures. This feature will show us how to rotate the profile pictures in a meeting.
Solution
We have to rotate the pixels of the profile pictures when the user switches the mobile screen from landscape mode to portrait mode or vice versa.
Let’s see the following implementation of the feature:
-
We will start with the values comprising the two outermost rows and the two outermost columns of the n x n matrix.
-
We will rotate the values clockwise, in ...