Ray Tracing, Version 1.0
Day #2

Goal: Ray trace a scene where

  • the entire scene is on the negative-z side of the world origin,
  • the only objects in the scene are spheres
  • the spheres are generic spheres which may have been translated
  • the only other attribute of each sphere is an assigned (emissive) color
  • the camera is set up on the positive z axis, looking toward the origin

Ray Tracing Tools:

Add the following methods to class GLdoubleVector and throroughly test each.:

GLdouble dot(GLdoubleVector other);    returns the dot product of this vector with the other vector
double length();       returns the length of this vector
GLdoubleVector operator - (GLdoubleVector other);     returns the result of subtracting the other vector from this vector

Set up and thoroughly test class Object. This class will be used to store information about each of the primitive objects in our scene. For this version, of course, our only primitive is sphere, but we will be adding more to subsequent versions. The class should have these public data members:

//data:
string obj_type;
         the type of primitive (sphere, cube, etc.)
Color3 color;
                 the color of the primitive
Matrix_4x4 M;
                 the current inverse transformation matrix for the primitive
double hit_time;     
time the ray hit the object (negative value indicates no hit)

and these public methods:
a constructor, which will initialize hit_time to -1.0, indicating a "no hit"

void translate(GLdouble trans_x, GLdouble trans_y, GLdouble trans_z); which changes the object's current transformation matrix to indicate the primitive has been translated by (trans_x, trans_y, trans_z)

Ray3D inverseTransform(Ray3D ray);
assumes the current transformation matrix, M, for the object has been set; returns the inverse transform of ray with respect to the current transformation matrix.

Driver Program:

Begin with the skeleton driver program /classes/cs3114/Advanced_Graphics/files/rt_1.cpp and fill in the details, a few at a time. Write a makefile to use with this driver program. Compile and make sure it runs correctly.