Lecture 11 Part 2 & Lecture 12: Transforming how we Paint & Using Superclasses as Service Providers

Ambient temperature: 75.1oF

Concepts

  1. Fishworld uses “Affine Transformations” to make its fish turn to face the correct direction.
    1. Everything takes place relative to the origin, and order of operations is important.
    2. This is why CS majors must take math courses: Their concepts become freakishly germane in matters of computer graphics.
    3. Dr. Wong advises us to always do scaling and rotation first, before transformation.
  2. Any graphical element has one “prototype,” which is its state before any transformations have been applied to it.
    1. The size of a prototype is “one unit.” The size of all subsequent instances of the prototype can then be described solely in terms of the scale factor (say “3 times”), without having to worry about multiplication anywhere.
  3. Dr. Wong shows off his class hierarchy for Fishworld (from Lecture 12 webpage) – this would also serve the needs of Homework 3’s ballworld, though it would be overkill.
  4. Math.atan2(double _y, double _x) will return a value that is rotated correctly into a quadrant; Math.atan(double _ratio) will only return a value in the first or fourth quadrant. If you want fish to rotate to properly face in the direction of its velocity, atan2 is your friend.
  5. The Lecture 12 webpage is full of provided code and detailed design explanation for Homework 4.

Resources

  1. Lecture 11 webpage: http://www.clear.rice.edu/comp310/f12/lectures/lec11/
  2. Lecture 12 webpage: http://www.clear.rice.edu/comp310/f12/lectures/lec12/