Workbook 3: Transformations

CS559 Spring 2023 Sample Solution

This is a sample solution for the Workbook. You are welcome to refer to it to learn one way to do the assignment but only after you have turned in your own assignment

One of the most fundamental concepts in computer graphics is transformation. Transformations let us work in convenient coordinate systems, model complicated things by putting together parts, move things around without damaging their structure, animate things without changing their shape (or, changing their shape if we want), and many other things.

Generally, the mathematics of transformations are taught first, and then we tell you what to use them for.

Here it is going to be the other way round: we’ll jump right in and use transformations to see why they are so useful. We’ll write some programs that make use of transformations. Then, we’ll look at what is happening “under the hood”.

This workbook has tutorial text and examples - make sure you understand them. Read the code!

Several pages have required exercises (see the rubric), and there is the potential for advanced points on page 6.

Remember to commit your work as you edit files in for_students (you should not edit files outside of that directory). Remember to push your work to GitHub - at least at the end, or periodically after you commit to make a backup. And, when you have completed the workbook remember to submit to WB3 Canvas Assignment to signal to us that it is ready for us to grade.

Learning Goals

  1. Understand the concepts of transformation and their use in graphics
  2. Understand how to think about transformations in terms of coordinate systems
  3. Understand how basic transformations (rotate, translate, scale) are used
  4. Understand how transformations are composed to achieve different effects
  5. Be able to use the HTML Canvas transformation functionality
  6. Understand and use the basic ideas of hierarchical modeling and articulation
  7. Understand how hierearchy and transformation is represented in a scene-graph API such as SVG
  8. Be able to use SVG (as a file format) including its hierarchy and instancing features

Other Resources

This workbook is a little less self-contained than the prior workbook, you will probably want to look at some things outside the workbook.

  1. In this workbook, we will focus on using transformations. Textbooks discuss the math of transformations first, so we will read them in the future. However, on page 5, you will want to see more examples of how to use transformations to do hierarchical modeling.

    I strongly recommend you look at some of these resources (when you get to page 5):

    • At the University of Washington (the other UW), Prof. Steve Seitz (who is a Wisconsin Alum) has made a series of short videos he calls Graphics in 5 Minutes where he tries to condense his hour long lectures into 5 minute cartoons. All the videos are in a YouTube Channel (Graphics in 5 Minutes You Tube Channel). One or two of these videos is very relevant, so I will recommend it when we get to page 5. In general, he likes to show the math first, so it isn’t completely compatible with how we are learning things.
  2. On pages 7 and 8, we will look at SVG as an alternative to Canvas. You will need to read something about SVG in order to do the assignments.

    The required reading for this are the class tutorials (CS559 SVG Tutorial). You may also want to read other resources to learn about SVG, such as Mozilla SVG Tutorial (optional). Note: many of the SVG tutorials discuss curves (in particular, Bézier curves) - we won’t get to curves until later in the course, so you don’t need to worry about them now.

If you want to read ahead, these required readings for next week cover the math of transformations:

  1. (optional) FCG4 Chapter 6 (can skip 6.1.6 and 6.2)

BTW: you might want to look back at the Books Page to remind yourself about how the textbooks work in this class.

Rubric

Workbook Rubric (97 points total)
Points (86):
20 pt
correct WB3 Canvas Assignment submission
20 pt
correct WB3G Canvas Assignment submission on time
Box 03-01-06
3 pt
restore the triangle to original position when the “Jump Right” button is released
Box 03-02-06
3 pt
change the scales so the two pictures look the same
Box 03-03-03
3 pt
add appropriate transformations to make both images look the same
Box 03-03-05
3 pt
define the canvas coordinate systems as specified
Box 03-06-01
6 pt
quadcopter has a front and 4 arms
Box 03-06-01
8 pt
four attached propellers that spin
Box 03-06-01
3 pt
propellers spin at different rates
Box 03-06-01
3 pt
goes around a circle
Box 03-06-01
3 pt
faces points forward while going around circle
Box 03-08-01
3 pt
a picture using SVG
Box 03-08-01
2 pt
at least one path with an arc
Box 03-08-01
2 pt
at least one polygon that is not a rectangle
Box 03-08-01
2 pt
a hierarchy using grouping
Box 03-08-01
2 pt
repeated instancing via use
Advanced points (11):
Box 03-06-01
2 pt
multiple vehicles (must have spinning parts)
Box 03-06-01
2 pt
complex paths (at least one 'copter must be a circle)
Box 03-06-01
2 pt
cool looking vehicles
Box 03-06-01
2 pt
interaction (be sure to document)
Box 03-06-01
2 pt
quadcopters do something beyond move in a path
Box 03-06-01
1 pt
other articulated object

Get started on Page  1  (Translate Transformations)!