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):
...
282 glColor3f(0.0, 0.0, 1.0)
283 glBegin(GL_QUADS)
284 for square_vertex_in_model_space in square:
285 paddle_1_space: Vertex = square_vertex_in_model_space.rotate(square_rotation) \
286 .translate(Vertex(x=2.0, y=0.0)) \
287 .rotate(rotation_around_paddle1)
288 world_space: Vertex = paddle_1_space.rotate(paddle1.rotation) \
289 .translate(paddle1.position)
290 camera_space: Vertex = world_space.translate(-camera.position_worldspace)
291 ndc_space: Vertex = camera_space.uniform_scale(scalar=1.0/10.0)
292 glVertex2f(ndc_space.x, ndc_space.y)
293 glEnd()