Rotate the Square Around Paddle 1 - Demo 13¶
Purpose¶
Rotate the square around paddle1’s center.
Move the Paddles using the Keyboard¶
Keyboard Input |
Action |
---|---|
w |
Move Left Paddle Up |
s |
Move Left Paddle Down |
k |
Move Right Paddle Down |
i |
Move Right Paddle Up |
d |
Increase Left Paddle’s Rotation |
a |
Decrease Left Paddle’s Rotation |
l |
Increase Right Paddle’s Rotation |
j |
Decrease Right Paddle’s Rotation |
UP |
Move the camera up, moving the objects down |
DOWN |
Move the camera down, moving the objects up |
LEFT |
Move the camera left, moving the objects right |
RIGHT |
Move the camera right, moving the objects left |
q |
Rotate the square around its center |
e |
Rotate the square around paddle 1’s center |
Description¶
Cayley Graph¶
196rotation_around_paddle1: float = 0.0
Event Loop¶
246while not glfw.window_should_close(window):
...
277 glColor3f(0.0, 0.0, 1.0)
278 glBegin(GL_QUADS)
279 for square_vertex_ms in square:
280 paddle_1_space: Vertex = (
281 square_vertex_ms.rotate(square_rotation)
282 .translate(Vertex(x=2.0, y=0.0))
283 .rotate(rotation_around_paddle1)
284 )
285 world_space: Vertex = paddle_1_space.rotate(paddle1.rotation).translate(
286 paddle1.position
287 )
288 camera_space: Vertex = world_space.translate(-camera.position_ws)
289 ndc: Vertex = camera_space.uniform_scale(scalar=1.0 / 10.0)
290 glVertex2f(ndc.x, ndc.y)
291 glEnd()