A Planetary System

This is an introduction to OpenInventor scene graphs.

Setup

Download and decompress the archive prog.zip
To compile the program enter qmake then make. Enter run to execute it. The scene represents a simplified solar system, with a yellow sun and the earth rotating at speed 1.0 around it. Press SPACE to start/stop the animation.

Scene Graph

Find in the C++ code where the scene is built.
question Hierarchy Make a figure representing the node hierarchy.
question Loop Where is the main loop of the program ?
question Callback What is the purpose of node eventNode ?

Night and day

The rotation of the earth along its poles is responsible for the alternance of day and night. Implement it at speed 1.0.
question Daily rotation Make a figure representing the new scene graph

The moon

Modify the program to insert the moon in the scene, represented using a small grey sphere with radius 0.1, rotating at speed 0.1 and distance 1.0 around the earth. You may have to use SoSeparators to prevent the texture and the daily rotation of the earth from being applied to the moon.
question Moon Make a figure representing the new scene graph

Seasons

Seasons are due to the fact that the axis of the daily rotation is not perpendicular to the plane of the solar system. This axis has an (almost) fixed direction, 22.5 degrees away from the normal of the plane.

question Seasons Implement this rotation and make a figure representing the new scene graph

Watching the sky

We now want to place the camera at the equator on the surface of the earth, pointed to the sky. If our scene is correct we should see the sun higher in summer than in winter. Since the camera must be near the top left of the graph, we must redesign it by placing the earth near the root. We do this in two steps: we first place an object representing the camera on the earth ; we then "invert" the relevant parts of the graph to actually place the camera on the earth.

Preliminary

Ascii file coordinateSystem.iv models the origin and axes x,y,z (resp. red, green, blue) of a coordinate system (frame). Load this file using method readFile defined in utils.h and put it at the appropriate place in the graph. You can increase the size of the earth to ease the visualization. Check that the frame is correctly located and oriented. The z axis must point toward the center of the earth as illustrated in the following image

question Frame Make a figure representing the new scene graph

New point of view

Invert the graph in order to see the scene from the earth. It is probably a good idea to first write it on a paper sheet.

question Seasons Make a figure representing the new scene graph