CPSC 102 Computer Science II
Fall 2010
<http://andrewd.ces.clemson.edu/courses/cpsc102/fall10/sched.html>

9:05-9:55 MWF Daniel 415

Schedule

DateL#Topic
Wed. Aug.18 01 Introduction; syllabus; office hours, etc.
Fri. Aug.20 02 Working towards building a vector library (lab 1)
  • e.g., #include <math.h> and -lm
  • "interface" (.h) and "implementation" (.c)
  • example of vec_sum function
Mon. Aug.23 03 Working towards building a vector library (lab 1)
  • vec_len, vec_read, vec_print
  • example Makefile
Wed. Aug.25 04 vector library (lab 1), cont.d
  • vec_unit, vec_dot, vec_cross
  • example Makefile
Fri. Aug.27 05 Ray tracing intro
  • coordinate reference frame mapping (image to world coord's)
  • 3-stop outline of ray tracing algorithm
  • concept of generic linked list data structure
Mon. Aug.30 06 Building a list library (lab 2)
  • "interface" (.h) and "implementation" (.c)
  • example of link_init, list_init, list_add, list_empty
  • example Makefile
Wed. Sep.01 07 Debugging
  • print statements
  • the gdb debugger
Fri. Sep.03 08 Building the material library (lab 3)
  • material file entry structure
  • material data structure (abstract data type)
  • material processing functions
    • material_init
    • material_load_attributes
    • material_getbyname
    • material_list_print
    • material_getambient
Mon. Sep.06 09 Building the material library (lab 3)
  • parsing the data file mat.txt
  • material_load_attributes
  • header file organization, Makefile
Wed. Sep.08 10 OOP (lab 4)
  • generic objects and specialized object instances (inheritance)
  • generic and specialized object member functions (polymorphism)
  • "isa" relationship
  • function pointers
  • object_t and plane_t data types
  • object_print and plane_print functions
Fri. Sep.10 11 OOP (lab 4)
  • object_init and plane_init functions
Mon. Sep.13 12 OOP (lab 4, Assignment 1)
  • plane equation
  • what is pln->ndotq?
  • ray-plane intersection
  • object_hits and plane_hits functions
Wed. Sep.15 13 model_t object (lab 5) and mtx_t "class" (lab 6)
  • Makefile
  • model.h
  • model.c
  • matrix.h
  • matrix.c
  • mat_xpose() and vec_xform()
Fri. Sep.17 14 Odds and ends: plane_load_attributes(), camera_t
  • vec_xform() bug
  • plane_init()
  • argc, argv
  • fopen, fclose
  • camera.h
  • camera.c
  • pointers to pointers
Mon. Sep.20 15 Assignment 1 due. Solution: asg1.tar.gz
Parsing model.txt (Assignment 2)
  • calling camera_init() and camera_print()
  • on to ray tracing...

Wed. Sep.22 16 Live demo of Assignment 2.
Fri. Sep.24 17 Live demo of Assignment 2, cont'd.
Mon. Sep.27 18 Assignment 2 due. Solution: asg2.tar.gz
Basic ray caster (Assignment 3)
  • writing a .ppm image
  • converting image pixel coordinates to world coordinates
  • calculating ray direction
  • converting double pixel r,g,b values to unsigned char r,g,b values
Wed. Sep.29 19 Calling ray_trace() routine.
  • using drgb_t color as color accumulator
  • calling object_find_closest()
  • getting material ambient color
  • scaling material ambient color, adding to drgb_t color color accumulator
Fri. Oct.01 20 Intro to C++:
  • #include <iostream>
  • #include <string>
  • std::cout << and its interpretation: std::cout.ostream<<()
  • the "big three":
    • copy constructor
    • destructor
    • assignment operator
  • class data_t (lab 8)
Mon. Oct.04 21 Assignment 3 due. Solution: asg3.tar.gz
  • int main() (lab 7)
  • using std::cin for i/o
  • list_t function calls
  • data_t constructor and friend std::ostream& operator<<(std::ostream& s, data_t rhs)
Wed. Oct.06 22
  • list_t interface and implementation
Fri. Oct.08 23 MIDTERM EXAM
10 questions, non-uniform weighting, covering:
  • C
  • linear algebra
  • object-oriented principles
  • writing functions, programs
  • understanding (tracing) programs
  • pointers, pointers to functions
  • linked lists
Mon. Oct.11 24 Midterm answers
Wed. Oct.13 25 C++ vec_t class (lab 9)
  • constructors (overloaded)
  • C++ i/o (std::istream& operator>> and std::ostream& operator<<)
  • double& operator[](int i) {} mutator
  • const double& operator[](int i) const {} accessor
  • intended usage of operator=(), operator*(), operator+(), operator-()
Fri. Oct.15 26 C++ vec_t class (lab 9, Assignment 4)
  • assignment operator reminder to return *this;
  • operator=()
  • operator*()
  • operator+()
  • operator-()
  • operator-() (unary)
  • dot() and len() functions
Mon. Oct.18 27 C++ material_t class (lab 10)
  • material_t object
  • material_getbyname search function
Wed. Oct.20 28 C++ object_t and plane_t classes (lab 11)
  • base class, derived class relationships
  • using std::string material as index into materials list
    (eventually could use an associative array to store materials)
  • virtual functions
  • derived class : public object_t syntax
  • getting base class (parent) to read/write itself
    (no need for *priv pointer)
Fri. Oct.22 29 C++ model_t class and virtual hits function (lab 12)
  • C++ file i/o
  • find_closest() function
  • getting model to "read itself" via model_ifs >> model
Mon. Oct.25 30 C++ sphere_t class and virtual hits function
Wed. Oct.27 31 Assignment 4 due. Solution: asg4.tar.gz
C++ light_t class
  • rendering equation
Fri. Oct.29 32 Assignment 5
C++ file output (cout.write and cout.put)
  • ray casting
Mon. Nov.01-- Fall Break
Wed. Nov.03 33 Reflecting the ray
  • general structure of the ray_trace routine
  • the lighting loop
  • reflection (recursion)
  • final color composite (linear interpolation)
Fri. Nov.05 34 C in C++ style (lab4 redux)
  • object_t behaves like a pure virtual class— cannot allocate itself
  • void *priv; pointer not needed
  • object_init() function signature changes
  • plane_t must "include" object_t at top for pointer "masquerading" to work
Mon. Nov.08 35 Assignment 5 due. Solution: asg5.tar.gz
Assignment 6
"Templatizing" the rgb_t type to handle double and unsigned char (Assignment 4 redux)
  • benefit is code reduction: one class (rgb_t<>) instead of two (drgb_t and irgb_t)
  • idea is for compiler to replicate the code for us
  • only need to provide three things along with template <typename T> syntax:
    1. forward declaration(s)
    2. templated friend declarations (and separate implementations)
    3. specializations
Wed. Nov.10 36 "Templatizing" list_t (to get rid of that annoying compiler warning about void *)
  • need to move data_t into its own header
  • make sure you can s << (*rhs);
  • let user delete own data (list shouldn't delete data it did not allocate)
Fri. Nov.12 37 Using the STL list instead of our own list_t
  • use iterator and const_iterator to iterate through list
  • two ways of deleting from list
Mon. Nov.15 38 Assignment 6 due. Solution: asg6.tar.gz
Assignment 7
C++ doubly-linked list_t class (lab 13)
  • two problems with old, singly-linked list
Wed. Nov.17 39 C++ doubly-linked list_t class (lab 13)
  • the doubly-linked list
Fri. Nov.19 40 C++ doubly-linked list_t class (lab 13)
  • writing your own iterators
Mon. Nov.22 41 Assignment 7 due. Solution: asg7.tar.gz

No class: Student Evaluations (online)

Wed. Nov.24-- Thanksgiving
Fri. Nov.26-- Thanksgiving
Mon. Nov.29 42 Assignment 8
Assignment 7 review
  • main()
  • ray_trace() (from asg3)
Wed. Dec.01 43 C++ doubly-linked list_t class (lab 13)
  • const_iterator
  • iterator
Fri. Dec.03 44 Assignment 8 due (12/6/10). Solution: asg8.tar.gz
Final exam review
Fri. Dec.1045 FINAL EXAM 8:00am-10:30am
10 questions, non-uniform weighting, covering:
  • Makefiles
  • C programming
  • C++ programming
  • C++ polymorphism
  • C++ iterators
  • C++ templates
  • C++ STL