Converts screen coordinates to viewport coordinates. Args: screen_coordinates: 2-component tuple, with components being integral numbers in range defined by the screen/window resolution. Returns: A 2-component tuple, with components being floating point values in range
(self, screen_coordinates)
| 633 | self._screen_size.height = height |
| 634 | |
| 635 | def screen_to_viewport(self, screen_coordinates): |
| 636 | """Converts screen coordinates to viewport coordinates. |
| 637 | |
| 638 | Args: |
| 639 | screen_coordinates: 2-component tuple, with components being integral |
| 640 | numbers in range defined by the screen/window resolution. |
| 641 | Returns: |
| 642 | A 2-component tuple, with components being floating point values in range |
| 643 | [0, 1]. |
| 644 | """ |
| 645 | x = screen_coordinates[0] / self._screen_size.width |
| 646 | y = screen_coordinates[1] / self._screen_size.height |
| 647 | return np.array([x, y], np.float32) |
| 648 | |
| 649 | def screen_to_inverse_viewport(self, screen_coordinates): |
| 650 | """Converts screen coordinates to viewport coordinates flipped vertically. |
no outgoing calls