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¶
193rotation_around_paddle1: float = 0.0
Event Loop¶
245while not glfw.window_should_close(window):
...
273 glColor3f(0.0, 0.0, 1.0)
274 glBegin(GL_QUADS)
275 for model_space in square:
276 paddle_1_space: Vertex = model_space.rotate(square_rotation) \
277 .translate(Vertex(x=2.0, y=0.0)) \
278 .rotate(rotation_around_paddle1)
279 world_space: Vertex = paddle_1_space.rotate(paddle1.rotation) \
280 .translate(paddle1.position)
281 camera_space: Vertex = world_space.translate(-camera.position_worldspace)
282 ndc_space: Vertex = camera_space.uniform_scale(scalar=1.0/10.0)
283 glVertex2f(ndc_space.x, ndc_space.y)
284 glEnd()