Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You are pushing a unit cube. Initially the cube is centered at (0, 0, 0) and you install a LookAt at (0, 0, 5) looking

You are pushing a unit cube. Initially the cube is centered at (0, 0, 0) and you install a LookAt at (0, 0, 5) looking at it. Your cube keeps rotating around the y-axis, by 30o every time. You decide the time interval between two consecutive rotations.

If you press the right mouse button and keep it pressed, your LookAt changes to (5, 5, 5) and stays there. If you release the button, the LookAt changes back to (0, 0, 5).

Now let us add some interactions. Use the key a to push the cube forward along the z-axis and use the key z to retreat the cube backward along the z-axis. Pushes or retreats should use the same distance. You decide its length. Every time you push or retreat the cube, you also need to adjust LookAt and possibly the projection such that the distance between your eye and the cube is constant, i.e., no change.

During the above pushing process, if you press the right mouse button and keep pressed, your LookAt changes to (5, 5, z). If you release the button, the LookAt returns to (0, 0, z). For both situations, z depends on the current z location of the cube.

Your cube is always rotating around the y-axis at its center. You decide and install an appropriate orthographic projection for the above tasks.

Call your program push.c and create a make file, called pushMake, for compiling it. The executable is called push. Code to be written in C/C++ only.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions