Starting from:
$35

$29

Assignment 2: Solar System in a Box SOlution

In this assignment you will make a solar-system-in-a-box. This solar system will have planets, satellites and their orbits, and at least one “unusual” spiral orbit. You will then implement a trackball to move the entire box and its contents using the mouse, similar to how we would if we held it in our hands and moved it around.

Part 1: Solar System in a box

Your model, upon completion of this part should have the following aspects:

    1. The box should be drawn as a wireframe (i.e. lines for its 12 edges).

    2. A sun that is stationary at the center of the box.

    3. At least 4 planets that orbit around the sun.

    4. The planets’ orbits should be oriented in different ways. Use the illustration below to think about how to orient orbits.

    5. At no point should any two planets be in danger of colliding with each other.

    6. At least two planets should have satellites that revolve around them in their own orbits, as the planets orbit around the sun.

    7. At least one planet should have more than one satellite, following different orbits around it.

    8. At least one satellite should have an off-center orbit (similar to how the Earth’s moon follows an elliptical orbit around the earth, with its center not at the earth).

    9. The orbits of all the planets and their satellites should be drawn as white lines.

    10. All planets should be of different colors.

    11. (Graduate students: required, undergraduates: extra credit): You should have one additional planet that follows a rotating spiral orbit around the sun (imagine taking a spring and bending it so that its ends touch, to make a circle. Now make a planet follow the path of this spring, around the sun). You do not need to draw this planet’s orbit.



When the program is run, it should animate this solar system.




















Part Two: Trackball

In this part you must animate the box and its contents so that they can be rotated using a trackball with the mouse. The trackball is an imaginary sphere surrounding your model. Imagine your model “pinned” to this center of this sphere. As you rotate the sphere, you rotate the model accordingly. The trackball behaves as follows: if you press the left mouse and drag the mouse vertically downwards, the cube with the solar system rotates counter-clockwise around +X axis. If you drag it to the right, it will rotate counter-clockwise around the +Y axis, and so on. Dragging it diagonally will cause similar rotations about a “middle” axis between X and Y.

Hint: Every mouse movement will cause a rotation. Try out various mouse movements and try to determine which axis of rotation should be chosen. The speed of rotation will be determined by the radius of the track-ball. Choose a radius so that the model rotations approximately match the mouse movements.

Gimbal Lock

Beware of the “gimbal lock” problem. The gimbal lock is when your trackball loses a degree of motion (imagine the trackball sphere to be the earth. Now drag the mouse downwards so that the North pole faces you. Now drag the mouse sideways. If the rotation is about the earth’s axis pointing at you, you have a gimbal lock problem).

If you have this problem, look at how you have thought of and represented various transformations.


How to submit: Please submit your IntelliJ/Qt project as a single zip file. You do not need to submit the extras/headers folder provided by us to you.

More products