Program 3
-
A Movie
Abstract
For this problem you will produce a "movie".
The movie will show some objects moving relative each other.
You will need to pre-program the movements and translate these into
transformation matrixes.
You will then use the sequences of these matrixes to cause the movie to be
displayed.
Outline
First story board a movie. Translate the movements into a sequence of
transformation function calls or matrices.
Write code to display the objects and change them over time.
Show the movie and add a special image to show the whole time line
of the movie.
Goals
A goal of this project is to get you to understand the
transformation coordinate system.
Another goal is allow you to build dynamic images rather than just a
static image.
Objectives
You will be able to able to read and build transformation matrices.
You will be able to translate a sequence of events into a movie.
You will be able to address the concept of a time line translated
into multiple separate events.
Prerequest Background
You need to be exposed to transformation operations and transformational
matrices.
You need to be able to add routines to the VTK program environment.
Content
Write a program to produce a "movie". The movie consists of a sequence
of movements of an object. You are to create the movements
by creating and applying a sequence of transformation matrixes.
Each matrix is to take the object from the old location to the new location.
This requires you get the old matrix and update it with the new parts to
show the next image in the movie.
That is, you are to do the transformation calculations your self.
You are to make two runs of these calculations.
The first time move the object (only one copy of the object
on the screen at a time). The second time add copies of the object
to the image. This second form is to be printed for hand-in.
You are to include at least translation and rotation.
The program
Cone2.cxx is one example of showing multiple images
in a "movie".
The program MotBlur.cc shows
a way to display the full movie in one picture.
You could instead, create a separate agent for each "image" in the movie.
MotBlur.cxx uses the SetSubFrames command with the number of subframes.
If you set it to 5, you will then need 5 calls to Render to fill the
5 SubFrames.
You need to be able to create and update a 4x4 matrix for the vtk
transformations. The following methods are available in vtkActor:
vtkMatrix4x4& GetMatrix()
void GetMatrix(vtkMatrix4x4& result)
void SetUserMatrix(vtkMatrix4x4*)
void SetUserMatrix(vtkMatrix4x4&)
vtkMatrix4x4 *GetUserMatrix()
There are some other methods vtkActor has that can be of use:
void GetPosition(float data[3])
void SetPosition(float,float,float)
void SetOrientation(float x, float y, float z)
float *GetOrientation()
If you look at pp74-79 [Schroeder, Martin, Lorensen 98] you will see
how to use the built in matrix manipulation commands.
Posttest
After doing this programming assignment, you should be able to address
problems such as:
Write a program to show a "dog fight" between two planes.
Why does it make sense for VTK to have a transformation matrix attached
to each object/agent?