SUNY Geneseo Department of Mathematics

Homework Project 2—Transformations and Instancing

Math 384
Spring 2015
Prof. Doug Baldwin

Complete by Monday, February 16
Grade by Thursday, February 19

Purpose

This lesson reinforces your understanding of affine transformations and homogeneous coordinates as tools for “instancing” canonical objects in scenes.

Background

This exercise is based on material from classes beginning on February 4. I also expect to provide time in one or more other classes before the “Complete-By” date to work on and talk about specific programming issues arising in this exercise.

Activity

Complete each of the following parts. The first is a pencil-and-paper exercise on the basic math of affine transformations; the second is the programming part of the project.

Part 1

  1. Give the 4-by-4 matrix form of a transformation that first rotates a point or vector 30 degrees counterclockwise (as seen from the positive z axis) around the z axis, and then translates the result 2 units in the positive x direction and 3 units in the negative z direction.
  2. Next, give the inverse of the above transformation, also as a 4-by-4 matrix (hint: you can do this without directly inverting your matrix from the first step).
  3. Finally, find the result of applying the inverse transformation from step 2 to the ray r = (0,0,2) + t(1,-1,-1).

Part 2

Write a ray tracer that extends our first ray tracer with the ability to include multiple triangles in scenes. Each triangle should be a transformed instance of some canonical triangle, and each instance should be able to have its own color.

Your ray tracer should support (and demonstrate) at least three distinct transformations, but exactly which transformations you implement is up to you. The choice may well depend on what scenes you decide to create in order to test/demonstrate your ray tracer. My intuitive sense of what makes transformations “distinct” is that they have different matrix “templates.” For example, rotations about different axes are distinct from each other, but rotations by different amounts about the same axis are not. We can talk more about this while you are working on the project if it worries you.

Your canonical triangle can be any triangle that is convenient.

Follow-Up

I will grade this exercise in a face-to-face meeting with you. During this meeting I will look at your solution, ask you any questions I have about it, answer questions you have, etc. Please bring a written solution to the exercise to your meeting, as that will speed the process along. For programming parts of the exercise, please bring your code in a form we can read and run (e.g., on a laptop with Matlab installed).

Sign up for a meeting via Google calendar. If you worked in a group on this exercise, the whole group should schedule a single meeting with me. Please make the meeting half an hour long, and schedule it to finish before the end of the “Grade By” date above.