Due date: Friday, 01.11.2013 at 12 pm (Berlin). The decision to extend deadline until midnight represents a compromise between wanting to preserve the weekend for recovering from the work-week, and wanting to make sure that teams can find time to get together, which can be a problem when team members attend different tutorials. If you want to work on the extra credit assignment (see below) you have until one week later to complete that work, as I have promised some new code to assist and we won’t learn how to pull this new code until next week’s gitorious tutorials.)
Goals of assignment: This assignment is designed to develop the following skills:
- Use of the MatrixBuilder class to construct arbitrary euclidean (or other interesting) matrices,
- Practice in controlling and creating simple animations, and
- Acquaintance with the Assignment class, in particular, ability to add a slider or other GUI element to the inspector panel.
The first step in completing the assignment is to copy the assignment to a package of your own making “parallel” to the template package. Use the “New->Package” menu item in eclipse to do say. Please use the format studentxx where “xx” is the 2-digit number assigned to you on the latest version of the signup sheet I have circulated in class. If you don’t know this number, send me e-mail or take a look at the sheet at the next class meeting. Leave the name of the copy as Assignment1. Follow the directions in the JavaDoc for the class Assignment1 to complete the assignment. In the interests of stimulating your creativity I give some ideas here for how you can fulfill the first part of the exercise, to change the matrix applied to the scene graph components in the method setValueAtTime(). Ideas for generating matrices. The calculation of the matrix depends on two helper functions: getGeometryParameter(i,j) and scalingFactor(). The default (“template”) versions of these functions and the construction via MatrixBuilder is very simple — all cubes rotate a full turn around the y-axis, and the animation delay depends only on column of the cube array where the cube is. Both functions contain optional code which you can un-comment to obtain somewhat more interesting behavior. Some possible further changes include:
- getGeometryParameter(i,j): Make the level sets of this function more interesting: diagonal lines through the array (as in the commented-code), or concentric circles or hyperbolae. Or some completely different ordering such that each cube receives a different value based on some walk through the array.
- scalingFactor(): The commented-out code returns an “inverted tent” function of its input. One could smooth this out — use the method AnimationUtility.hermiteInterpolation instead of AnimationUtllity.linearInterpolation. Or redefine this function to depend directly on the (i,j) indices of the cube to obtain location-dependent scaling (now it’s only time-dependent).
- Use other types of basic transformations in the MatrixBuilder method call. For example:
- Non-uniform scaling — 3 different values instead of identical values, as in the template code. These values can also depend on the (i,j) location of the cube in the array.
- Rotations whose axes depend on the (i,j) position of the cube in the array, or rotations through an axis which doesn’t go through the origin.
- Translations. One natural choice would be vertical translations (in the z-direction) which depend on time and/or position of the cube in the array. This could be used to simulate the motion of a wave through the array.
- One can also consider changing the way the cubes are arranged, for example, replace the square with a cylinder or a torus. To do so, one has to adjust the call the MatrixBuilder in the method setupArray(). In the template this method arranges the cubes by translating them to positions in a square array.
- Extra credit assignment Change setupArray() so that the (bottom faces of the) cubes are arranged without gaps or overlap on the surface of a torus with minor radius 1 and major radius R. Note: Doing this requires going beyond the capabilities of the MatrixBuilder class, since it requires mapping a square onto a non-parallelogram. As discussed in class, this can be solved using a general projectivity mapping 5 points onto 5 points (in $\mathbf{P}^3$); I have added the corresponding method to the class Pn and you can fetch the new version next week when we learn how to do that.
I hope these suggestions stimulate you to further brain-storming. An image of a version incorporating some of these suggestions is shown below: