Csc418 Assignment 1

Homework Assignments


Homework and Team Projects

Due date
Java2D, transformations, animation and fractalsFriday, October 3rd 
Splines, transforms and composite objectsFriday, October 10th
Projection of CubesTuesday, October 21st
Project #1 - bikingTuesday, October 28th
3-D viewing and polygon cullingFriday, November 7th
3-D ShadowsFriday, November 14th


Tuesday, November 25th
Project #2 - 3-D Spiral StaircaseTuesday, November 18th
Project #3 - pick your poisonTuesday, December 9th


The source code in SusanList.jar shall be used as the start for assignments

and the first group Lab. This code makes intentional use of magic numbers because the program was designed for a data structures course where part of their assignment was to document  and improve the code.

Java2D, transformations, animation and fractals

SusanList.jar animates several patterns of flowers. The flower is defined in the class Flower. Abstract the interface from Flower, calling it PaintInterface, and use the interface in defining a Fractal class that draws a fractal pattern. Allow the user to select between drawing fractals and flowers.

Fix the bug in the code that causes all the flowers to disappear periodically without using an infinitely long buffer. This requires less than ten lines of code. 

I would like to see at least 10 different fractal patterns. Negotiate with your class mates on which patterns each person will do. Bring a print out of your pattern to class on September 30th.



Splines, transforms and composite objects

Roll a ball along a curve using Java 2D. The ball shall have a round spot on it (like a billiard ball), and the spot moves and changes shape as the ball rolls. You can make simplify assumptions about how the shape of the spot changes when the ball rotates, but the effect should look realistic.

The path of the ball shall follow one of the following.

Students with SS numbers ending in 0 to 4 Follow a Bezier Curve with four control points.

Students with SS numbers ending in 5 to 9 Follow a B-Spline with four control points.  

Allow the user to change the path by moving the control points. of the curve/spline. 

You should be able to find code to generate the curve/splines on the web (look at the links below). You can use code from the web to draw and control the spline, but you are responsible for documenting the code and being able to explain it.

Java 2D shapes


Projection of Cubes

Part 1

Generate a dimetric or isometric parallel projection of a cube using only squares and transformed squares with Java2D.  Why can we not use this method to do Part 2?

Render three versions

  1. wire mesh showing all the edges,

  2. wire mesh with obstructed lines hidden, and 

  3. surfaces with obstructed surfaces hidden.

Part 2

Create 2-point perspective of a cube. Have Java2D-based GUI render the following two point perspective

Students with SS numbers ending in 0 to 2  Allow the user to control the height and width of the cube, with the width being the two horizontal dimensions, using two sliders in a separate panel. 

Students with SS numbers ending in 3 to 6 Allow the user to move the two vanishing points using two sliders in a separate panel. 

Students with SS numbers ending in 7 to 9 Allow the user to move cube up and down using a slider in a separate panel. 




The FlyingPyramids.jar program should be used to implement the remainder of the assignments and the team programming projects. 

Viewing and Culling

Modify the the FlyingPyramids.jar program to do the following:

  • change  the pyramids animation so they move with their bottoms on the z = 0 plane

  • implement a viewer model that lets the user drive around the z = 0 plane 

  • implement polygon culling

  • implement polygon clipping

In order to change the viewer you will need to either to modify or replace WireFrameGeometry.lookat() and WireFramePanel.makeSurface(). The effect of mouse dragging should also change, you no longer pivot around a fixed location, but translate in 3-d space.

The WireFrameGeometry.transpoints() transforms the pyramidal view frustum to a cube. Look at WireFrameGeometry.perspective() to see what the size of the cube should be or change the transformation to produce a cube size you like. 

Extra credit Cull the pyramids that are not in the view. Bound the pyramid with a sphere and see if the sphere is in the frustum. You can do this by not even adding the objects out of view to the vertex and polygon list.

Cull the polygons not in view. 

Next, clip all the polygons that are partially in the cube. You will need to decide at this point whether the program should force all clipped polygons to be decomposed into quadrilaterals  or to allow the the program to support n-sided polygons. This decision will affect you ability to do shading and Z-buffering. 

You will notice that the existing code throws a endPath: bad path

exception when your viewpoint is in the middle of a scene. This is supposedly a bug in the Java Virtual Machine and come from drawing to far from the edge of the view port.  (Line segments where one of the points has a homogeneous coordinates with a negative coefficient has the line segment going through infinity and turns the quadrilaterals into triangles. ?)


Clipping and Shadows

Generate  shadow of a pyramid on to the ground  from a point light source. Allow the user to move the point source and pyramid using the curser keys. Extra credit: create soft shadows.

Add all the missing Javadoc comments.

Clipping Polygons



Implement either Gouraud and Phong shading. 

This will require you to do bilinear interpellation of the pixel values in the polygon and you won't be able to just paint the polygon. Find the edges of the polygon using "perfect scan converting".


  • You will have to normalize your vectors. As an example if you calculate the reflection vector using 
    R = 2.0*(N.L)*N - L, you will need to normalize R.

Render a ball. These balls are progressively harder and each earns more points.

matte ball with strips  
a shinny checkered ball with a matte finish  
ball of crumpled aluminum foil or paperAdd texture to the ball by using a fine mesh and adding random noise to the vertices 


try adding noise to the normals calculated in Phong shading.  If the noise is correlated than the features will seem larger.

orangeExtra credit- show the dimples in the orange and make sure the orange is not a perfect sphere.


Scan Conversion

  • Line Drawing

    • Bresenham's Algorithm - a java applet that draws lines
      Jack E. Bresenham, Algorithm for Computer Control of a Digital Plotter, IBM Systems Journal, 4(1):25-30, 1965. Reprinted in Interactive Computer Graphics, Herbert Freeman ed., IEEE catalog no. EHO 156-0, Library of Congress no. 79-91237, 1980, and Seminal Graphics: Pioneering Efforts That Shaped The Field, Rosalee Wolfe ed., ACM SIGGRAPH, ACM order no. 435985, ISBN 1-58113-052-X, 1998.

    • Drawing a Straight Line

  • Rasterizing Polygons In Image Space - On-Line Computer Graphics Notes

  • Polygon Scan Converting - perfect converting

  • Rasterisation- Scan Conversion

  • 3D Coding - has a section on Polygon Scan Conversion,

  • scanning and shading


Other topics for Final Project

Texture Maps

Bump Maps


Quaternions - a vector representation of Rotation

Culling using Binary Space Partitioning 

Ray Tracing 


Team Projects

There will be three projects this semester. The first one is done using Java 2D, the second using  the 3D framework in FlyingPyramids.jar  and the the last one is open ended.

The first two project will consist of three parts with a single part assigned to member of either a three-person or two-person. 

Look at  Cooperative-Group Problem Solving FAQ to see what University of Minnesota thinks about team projects.

Project 1- biking

Animate a bicycle in two dimensions. The animation should be organized in three Java classes corresponding to the parts below. When pedaling begins the bike shall move across the panel. The bike shall give the allusion of moving by having components, such as the wheel spooks becoming transparent as they move faster. 

The program GUI shall provide sliders in a separate panel which control the following :

  1. the size of the bike
  2. the pedaling cadence

Also allow the user to turn a shadow of the bike and rider on or off.

Part 1

Render the bike frame and wheels. Include handle bars and seat.

Part 2

Render the crank set, chain and gears.

Part 3

Render a person sitting on the bike and pedaling.

Project 2 - spiral staircase

Create a spiral stair case in 3-D.

The program GUI shall provide controls to

  1. toggle between wire mesh and filled polygons.
  2. select viewpoint mode:
    1. preprogrammed spiral tour up staircase
    2. flying
    3. driving around base.
  3. Turn on and off shadows,

Part 1

Render the central column and wooden stairs

Part 2

Render a hand rail and the hand rail support.

Part 3

Render and animate either (1) a soccer ball bouncing down the stair case or (2) a biped walking up the stairs.

Project 3 - Pick your 3-D poison 

The last project you can do on your own or with up to 3 team members. If you do the project as a team you must have the instructor sign off on the partition of work for the project between team members. In order for me to do this their must be clearly defined deliverables for each team member that be can shown in a stand-alone program. You can implement these projects in straight Java or use the Java 3D API.

Each person shall implement one concepts that that has not been implemented yet in the assignments. Examples are

  • ray tracing

  • binary space partitioning

  • depth of field effect

  • anti-aliasing using super sampling or some type of spatial filtering

  • translucent objects

  • image processing - examples of this are edge detection, erosion and dilation.

  • collision detection

  • splines in 3-D

  • texture mapping

  • physical correct simulation

  • morphing between shapes

  • shadows using shadows buffer

  • shadows using shadows volumes 

  • implement a mirror

  • etc.

Possible single person project:

  • Ray Traced Rendering Ray tracing rendering that shows semi-transparent object. This should probably be done with spheres to make it interesting looking and doable.

  • Image Processing Implement an application that manipulates imaging.

  • Simulation Simulate a physical object in 3-D.

Possible team projects

  • 3-D Game Something of the complexity of Battletank or a maze game. Provide collision detection, BSP, a radar view, possibly stereo sound effects.

  • simulate a complex system

    • a rock climbing robot or spider and a climbing wall.
      • provide two viewpoints:
        • from head of robot
        • flying above robot
      • allow the user to control the limbs of the robots.
    • the bicycle from the first project, with a block neighborhood as a back ground. 
      • provide two viewpoints:
        • from the bike
        • flying above the bike
  • to be discussed



Computer Graphics CSC418 Winter 2018


LEC2501 Tuesdays 18:00–20:00 in GB 248
Prof. Karan Singh
+1 416–978–7201
Office hours Tuesdays 17:00–18:00 in BA 5258

LEC0101 Wednesdays 15:00–17:00 in SF 3202
Prof. David Levin
+1 416–978–2052
Office hours Tuesdays 17:00–18:00 in BA 5268

Tutorial for both sections will be held together on Tuesdays 20:00-21:00 in GB248.


Date PostedAnouncement
9/1/2018Welcome to CSC418
9/1/2018A1 posted
9/1/2018Submission instructions for assigments
2/1/2018A2 posted
2/1/2018Midterm during tutorial hour on Feb 11 and Feb 13
15/2/2018A2 deadline extended to March 9.


Course Overview

This course introduces the basic concepts and algorithms of computer graphics. It covers the basic methods needed to model and render 3D objects, including much of the following: graphics displays, basic optics, line drawing, affine and perspective transformations, windows and viewports, clipping, visibility, illumination and reflectance models, radiometry, energy transfer models, parametric representations, curves and surfaces, texture mapping, graphics hardware, ray tracing, graphics toolkits, animation systems.

Prerequisites: CSC336H1/CSC350H1/CSC351H1/CSC363H1/364H1/CSC365H1/CSC373H1/ CSC375H1/378HI, MAT137Y1, CSC209H1/proficiency in C or C++ ;
CGPA 3.0/enrolment in a CSC subject POSt.

The student is expected to read background material on the hardware and local software, and should be comfortable with elementary linear algebra, geometry, and vector calculus. It is also assumed that the student is comfortable programming in basic C++.

Recommended preparation: MAT237Y1, MAT244H1.

Lecture Schedule

Links to lecture slides are required readings. These links are available before each lecture (but may be minimally altered for the lecture).

Online notes present the slides in greater detail and are strongly suggested reading. Sections under the Textbook column refer to strongly suggested readings from Shirley’s textbook. External links point to online resources (e.g., Wikipedia and MathWorld) that you may find helpful. They are not required readings.

TopicsSlidesShirley Chapters
Part I: Graphics Primitives (modeling)
Tutorial 1Hello, I’m your TA. There’s no tutorial this week.
Lecture 1Introduction & raster operations Line drawing, 2D polygons, parametric 2D curves (circle, ellipse)
Wikipedia List of curves
lecture1.pdf, lecture1_6up.pdf3.1–3.5; 2.5–2.6
Tutorial 2javascript, canvas, C++, OpenGL and graphical APIs.
Lecture 2Interpolation & 2D Transformations Rigid, conformal, affine transformations. Homogeneous coordinates. Coordinate-free geometry.

lecture2+3.pdf, lecture2+3_6up.pdf



6.1; 2.4; 6.3
Tutorial 32D transforms and hierarchical models.
Lecture 3

3D Surfaces Planes, tangents, normals, bilinear patches, quadrics/superquadrics.

Polynomial interpolation and Introduction to smooth curve design.

2.9–2.11; 13.1; 6.2

Tutorial 4

3D meshes, objects, tangents and normals. 
Lecture 4 Bezier, b-splines, Hermite splines, Catmull-Romm splines and curve continuity.

lecture4.pdf, lecture4_6up.pdf


Part II: Viewing in 3D
Tutorial 5Curve modeling review. 
Lecture 5Camera models and 3D transformations Change of basis, Scene Hierarchies, Viewer coordinates. Perspective and orthographic projections. Pseudo-depth.

lecture5.pdf, lecture5_6up.pdf


7.2-7.3; 7.3-7-5   
Tutorial 6MIDTERM   
Lecture 6Visibility BSP, Spatial partitions, Z-buffer

lecture6.pdf, lecture6_6up.pdf

Part III: Appearance Modeling Animation and Rendering
Tutorial 73D viewing, 3D view volumeVisibility, back-faces, spatial partitions.  
Lecture 7

Lighting and Reflection Diffuse, ambient, specular, and Phong models. Interpolative shading, texture mapping.

lecture7.pdf, lecture7_6up.pdf

Tutorial 8vertex and fragment shadersglsl_slides.pdf 
Lecture 8Basic ray tracing algorithm. Computing ray-plane intersections

lecture8.pdf, lecture8_6up.pdf


Tutorial 9Ray tracing review  
Lecture 9Refraction, Distributed/stochastic ray-tracing, Backwards ray-tracing (caustics), radiosity.  24.1-24.2 
Tutorial 10Ray tracing pseudo-code.    10.8,10.10
Lecture 10Animation: history, principles, keyframe interpolation, physical simulation, behavioral rules. 15.1-15.3, 15.6.1, 15.4-15.5  
Tutorial 11Animation review.  
Lecture 11

Future trends in Computer Graphics

Tutorial 12Final exam review  
Lecture 12Wooden Monkey presentation, Summary 16.1-16.2, 16.4-16.5;


Academic Honesty (Please Read!!!)

Links to assignments will be available on the hand-out dates


Recommended Textbook and References

Currently, there is no textbook that reflects all the material covered in this class. Only the Slides in the Lecture Schedule are required reading.

In-class lectures will be supplemented by online notes (lecture slides and course notes) as well as portions of the following recommended textbook:


Textbook sections and online notes listed next to each lecture are strongly suggested reading.

  • OpenGL Programming Guide: The official guide to learning OpenGL, version 1.4, By the OpenGL Architecture Review Board, Addison-Wesley. This book will be a useful reference for getting some of the programming assignments done. (Also available online)
  • OpenGL Reference Manual, By the OpenGL Architecture Review Board, Addison-Wesley. (Also available online) Supplementary Textbooks

We will not be using the following books directly, but they offer different perspectives on the topics that will be covered in class.

  • A. Glassner, Principles of Digital Image Synthesis, vol. 1&2, Morgan Kaufman, 1995
  • J. Foley et al., Computer Graphics: Principles and Practice, Addison Wesley, 1997
  • A. Watt, 3D Computer Graphics, 3rd edition, Addison-Wesley, 1999
  • D. Hearn and M. P. Baker, Computer Graphics, 3rd edition, Addison-Wesley, 2003
  • J. Blinn, Jim Blinn’s Corner: A Trip Down the Graphics Pipeline, Morgan Kaufman, 1996
  • J. Blinn, Jim Blinn’s Corner: Dirty Pixels, Morgan Kaufman, 1998
  • R. Fosner, OpenGL Programming for Windows95 and NT, Addison Wesley, 1998
  • D. S. Ebert et al., Texturing and Modeling, 2nd edition, Academic Press, 1998
  • G. Wolberg, Digital Image Warping, IEEE Computer Society Press, 1990


15%In-tutorial test: Oct 30
35%Final exam

There will be three assignments in total, composing 10%, 15% and 25% of the total grade, respectively. Assignments will be roughly tri-weekly. The assignments will have a written portion and a programming portion.

Late Policy

Assignments are due by 11:59pm on the due date. Assignments (including the written part) should be submitted to the TA in electronic form. Exact submission instructions will be provided with the first assignment. The written portions if hand-written should be legibly scanned and submitted electronically as well.

For each day late, including weekends, 15% of the total possible points will be deducted (a day ends at the due time).

No work will be accepted if it is more than five days late.

Academic Honesty

Academic honesty is a very serious matter and can result in very serious consequences. Note that academic offences may be discovered and handled retroactively, even after the semester in which the course was taken for credit. This is a challenging class aimed at teaching you the fundamentals of computer graphics. You wont learn much if you cheat but you might get a good grade if you get away with it. If all you want is a good grade take an easier class where you wont have to cheat!

For purposes of this class, academic dishonesty is defined as:

  • Any attempt to pass off work on a test that didn’t come straight out of your own head.
  • Any collaboration on written or programming assignments (its ok to share ideas on programming assignments but the code MUST be your own) in which the collaborating parties don’t clearly and prominently explain exactly who did what, at turn-in time.
  • Any activity that has the effect of significantly impairing the ability of another student to learn. Examples here might include destroying the work of others, interfering with their access to resources (e.g., digital cameras), or deliberately providing them with misleading information.

Email & Bulletin Board Traffic

  • Please do not send email directly to the TAs. They will not be replied.
  • Main forum for answering questions about class or about the assignments is the class bulletin board. The TAs will be monitoring the board.
  • Appropriate use of the board: clarifications on assignment, on lecture material, general concerns about the course, or other remarks that are appropriate for all students to see/participate in.
  • Do NOT broadcast pieces of your code or answers to written assignments to the bulletin board. Specific or general implementation questions whose answer would benefit all students in the class are appropriate. However: the bulletin board is NO replacement for the tutorial hour. That should be the main forum for asking/answering questions of this sort.
  • Questions of the form “I cannot find the problem with my code; here it is, can you help me” are unlikely to be replied, so don’t count on it. If you have a question with code, take it to the TA office hours or to the tutorials.

0 thoughts on “Csc418 Assignment 1

Leave a Reply

Your email address will not be published. Required fields are marked *