CPSC (T1) 2nd Midterm Exam

Similar documents
Geometric transformations

1 Quad-Edge Construction Operators

Stained Glass Design. Teaching Goals:

9.1 apply the distance and midpoint formulas

MA1008. Calculus and Linear Algebra for Engineers. Course Notes for Section B. Stephen Wills. Department of Mathematics. University College Cork

INTRODUCTION TO SIMPLICIAL COMPLEXES

Fall 2018 Midterm 1 October 11, ˆ You may not ask questions about the exam except for language clarifications.

a(e, x) = x. Diagrammatically, this is encoded as the following commutative diagrams / X

6.2 Volumes of Revolution: The Disk Method

Section 10.4 Hyperbolas

ECE 468/573 Midterm 1 September 28, 2012

Viewing and Projection

1 Drawing 3D Objects in Adobe Illustrator

Midterm 2 Sample solution

Unit #9 : Definite Integral Properties, Fundamental Theorem of Calculus

MTH 146 Conics Supplement

10.5 Graphing Quadratic Functions

MATH 2530: WORKSHEET 7. x 2 y dz dy dx =

Ray surface intersections

CS311H: Discrete Mathematics. Graph Theory IV. A Non-planar Graph. Regions of a Planar Graph. Euler s Formula. Instructor: Işıl Dillig

50 AMC LECTURES Lecture 2 Analytic Geometry Distance and Lines. can be calculated by the following formula:

6.3 Volumes. Just as area is always positive, so is volume and our attitudes towards finding it.

Lecture 7: Building 3D Models (Part 1) Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)

Physics 208: Electricity and Magnetism Exam 1, Secs Feb IMPORTANT. Read these directions carefully:

Midterm I Solutions CS164, Spring 2006

Fall 2017 Midterm Exam 1 October 19, You may not use any books, notes, or electronic devices during this exam.

Orientation & Quaternions. CSE169: Computer Animation Instructor: Steve Rotenberg UCSD, Winter 2017

Spring 2018 Midterm Exam 1 March 1, You may not use any books, notes, or electronic devices during this exam.

12-B FRACTIONS AND DECIMALS

2 Computing all Intersections of a Set of Segments Line Segment Intersection

Fall 2018 Midterm 2 November 15, 2018

Pythagoras theorem and trigonometry (2)

COMP 423 lecture 11 Jan. 28, 2008

Angle Properties in Polygons. Part 1 Interior Angles

such that the S i cover S, or equivalently S

1. SEQUENCES INVOLVING EXPONENTIAL GROWTH (GEOMETRIC SEQUENCES)

Matrices and Systems of Equations

x )Scales are the reciprocal of each other. e

Answer Key Lesson 6: Workshop: Angles and Lines

Topic 3: 2D Transformations 9/10/2016. Today s Topics. Transformations. Lets start out simple. Points as Homogeneous 2D Point Coords

Essential Question What are some of the characteristics of the graph of a rational function?

Unit 5 Vocabulary. A function is a special relationship where each input has a single output.

Graphing Conic Sections

MATH 25 CLASS 5 NOTES, SEP

2D Projective transformation

CS201 Discussion 10 DRAWTREE + TRIES

Functor (1A) Young Won Lim 10/5/17

Class-XI Mathematics Conic Sections Chapter-11 Chapter Notes Key Concepts

4452 Mathematical Modeling Lecture 4: Lagrange Multipliers

Hyperbolas. Definition of Hyperbola

What are suffix trees?

Thirty-fourth Annual Columbus State Invitational Mathematics Tournament. Instructions

CS380: Computer Graphics Modeling Transformations. Sung-Eui Yoon ( 윤성의 ) Course URL:

Stack. A list whose end points are pointed by top and bottom

Functor (1A) Young Won Lim 8/2/17

SOME EXAMPLES OF SUBDIVISION OF SMALL CATEGORIES

Lecture Overview. Knowledge-based systems in Bioinformatics, 1MB602. Procedural abstraction. The sum procedure. Integration as a procedure

Subtracting Fractions

EECS 281: Homework #4 Due: Thursday, October 7, 2004

CS143 Handout 07 Summer 2011 June 24 th, 2011 Written Set 1: Lexical Analysis

In the last lecture, we discussed how valid tokens may be specified by regular expressions.

Mid-term exam. Scores. Fall term 2012 KAIST EE209 Programming Structures for EE. Thursday Oct 25, Student's name: Student ID:

CHAPTER III IMAGE DEWARPING (CALIBRATION) PROCEDURE

Lecture 5: Spatial Analysis Algorithms

arxiv: v1 [cs.cg] 9 Dec 2016

Grade 7/8 Math Circles Geometric Arithmetic October 31, 2012

MIPS I/O and Interrupt

Introduction Transformation formulae Polar graphs Standard curves Polar equations Test GRAPHS INU0114/514 (MATHS 1)

EXPONENTIAL & POWER GRAPHS

Angle properties of lines and polygons

arxiv: v1 [cs.cg] 1 Jun 2016

a < a+ x < a+2 x < < a+n x = b, n A i n f(x i ) x. i=1 i=1

10/12/17. Motivating Example. Lexical and Syntax Analysis (2) Recursive-Descent Parsing. Recursive-Descent Parsing. Recursive-Descent Parsing

Math 35 Review Sheet, Spring 2014

Quiz2 45mins. Personal Number: Problem 1. (20pts) Here is an Table of Perl Regular Ex

AVolumePreservingMapfromCubetoOctahedron

3 FRACTIONS. Before you start. Objectives

Fig.25: the Role of LEX

4-1 NAME DATE PERIOD. Study Guide. Parallel Lines and Planes P Q, O Q. Sample answers: A J, A F, and D E

ΕΠΛ323 - Θεωρία και Πρακτική Μεταγλωττιστών

TASK SPECIFIC DESCRIPTION

Theory of Computation CSE 105

Before We Begin. Introduction to Spatial Domain Filtering. Introduction to Digital Image Processing. Overview (1): Administrative Details (1):

Compilers Spring 2013 PRACTICE Midterm Exam

SIMPLIFYING ALGEBRA PASSPORT.

Section 3.1: Sequences and Series

CSCI 104. Rafael Ferreira da Silva. Slides adapted from: Mark Redekopp and David Kempe

Ma/CS 6b Class 1: Graph Recap

Integration. September 28, 2017

Rigid Body Transformations

Ma/CS 6b Class 1: Graph Recap

Fig.1. Let a source of monochromatic light be incident on a slit of finite width a, as shown in Fig. 1.

9 4. CISC - Curriculum & Instruction Steering Committee. California County Superintendents Educational Services Association

CSCI1950 Z Computa4onal Methods for Biology Lecture 2. Ben Raphael January 26, hhp://cs.brown.edu/courses/csci1950 z/ Outline

Yoplait with Areas and Volumes

CMSC 331 First Midterm Exam

arxiv:cs.cg/ v1 18 Oct 2005

CSCE 531, Spring 2017, Midterm Exam Answer Key

Integration. October 25, 2016

The Math Learning Center PO Box 12929, Salem, Oregon Math Learning Center

Transcription:

Signture: Fire Alrm Code: CPSC 44 2-2 (T) 2nd Midterm Exm Deprtment of Computer Science University of British Columbi K. Booth & R. Schrein Exm Instructions (Red Crefully). Sign the first pge of the exm with your Signture in the spce provided on the upper left immeditely. 2. Continue reding the instructions, but do not open the exm booklet until you re told to do so by proctor. 3. Print your Nme nd Student Identifiction Number on every pge in the spce provided t the top of ech pge before you strt the exm. 4. Cheting is n cdemic offense. Your signture on the exm indictes tht you understnd nd gree to the University s policies regrding cheting on exms. 5. Plese red the entire exm before nswering ny ofthe questions. 6. There re four questions on this exm, ech worth the indicted number of mrks. Answer s mny questions s you cn. 7. Write ll of your nswers on these pges. If you need more spce, there is blnk spce t the end of the exm. Be sure to indicte when question is continued, both on the pge for tht question nd on the continution pge. 8. Interpret the exm questions s written. No questions will be nswered by the proctor(s) during the exm period. 9. The exm is closed book. There re no ids permitted, except for clcultor.. You hve 7 minutes in which to work. Budget your time wisely.. In the event of fire lrm during the exm, enter the four-chrcter code provided by the proctor(s) in the spce on the upper right, then gther your belongings nd exit the room, hnding your exm to proctor s you exit. 2. No one will be permitted to leve the exm room during the lst ten minutes of the exm. Question Men SD Mx (-b) 6.7.9 8 (c-d) 2.6 3.6 6 2(-d) 7..2 8 2(e-h) 6. 2. 8 3 5.6 4.2 2 4(-l) 2. 3.6 24 4(m-t) 5..5 6 Totl 82.9. CPSC 44 2-2 (T) of3 2nd Midterm Exm (7 minutes)

Question # [24 mrks totl] This question tests your knowledge of how 2D polygon clipping is performed. The questions will refer to window-edge coordintes, Sutherlnd-Cohen outcodes, nd the Sutherlnd-Hodgmn polygon clipper discussed in lecture. Below is the min body of the clipping function given in the lecture nd on the course Web pges. It clips ginst single clipping boundry, then psses its output to the next boundry. Assume tht the clipping boundries re the stndrd ones for 2 2squre window centred on the origin,. x, y +., nd tht clipping is performed ginst the four clipping boundries in four stges using the order Left, Right, Bottom, nd then Top. You my ssume tht ll necessry initiliztion hs been performed, nd tht the function WEC(i,x,y) returns the i-th window edge coordinte for the point (x,y). int flg[maxout]; /* flg[i] = FALSE if first vertex */ flot Fx[MAXOUT], Fy[MAXOUT]; /* first vertex t i-th level*/ flot Sx[MAXOUT], Sy[MAXOUT]; /* sved vertex t i-th level*/ flot wecs[maxout]; /* outcode for sved vertex t i-th level */ void Clip ( int i, flot Px, flot Py ) { flot lph, wecp, Ix, Iy; if (i==maxout) { Output(Px,Py); return; } wecp = WEC( i, Px, Py ); /* Get ith Window Edge Coordinte */ if (!flg[i]) { Fx[i]=Px; Fy[i]=Py; flg[i]=true; } else { if (wecs[i]>=) { if (wecp>=) /* Cse ++, S nd P re both OK */ Clip(i+, Px, Py ); /* Pss long P to next level */ else { /* Cse +-, S is OK but P is not */ lph = wecs[i] / (wecs[i] - wecp); Ix = Sx[i] + lph*(px-sx[i]); Iy = Sy[i] + lph*(py-sy[i]); Clip(i+, Ix, Iy ); /* Pss long I to next level */ } } else { if (wecp>=) { /* Cse -+, S is not OK but P is OK */ lph = wecs[i] / (wecs[i] - wecp); Ix = Sx[i] + lph*(px-sx[i]); Iy = Sy[i] + lph*(py-sy[i]); Clip(i+, Ix, Iy ); /* Pss long I to next level */ Clip(i+, Px, Py ); /* Pss long P to next level */ } } } Sx[i]=Px; Sy[i]=Py; wecs[i]=wecp; } void End ( int i ) { if (i<maxout) { /* If never clled, then nothing to do t or fter this level */ if (flg[i]) { Clip( i, Fx[i], Fy[i] ); End(i+); flg[i] = FALSE; } } } void Strt ( int i ) { if (i<maxout) { flg[i] = FALSE; Strt(i+); } } CPSC 44 2-2 (T) 2of3 2nd Midterm Exm (7 minutes)

In this question, the input polygon to be clipped ginst the 2 2window isgiven bythe following 2D coordintes. Vertex x y P.. P. 5 +. 5 P 2. 5 +. 5 P 3 2.. () [4 mrks] Determine the vlues of the four one-bit outcodes for ech of the vertices with respect to the four boundries of the clipping region. Use the stndrd convention for outcodes. Vertex L R B T P P P 2 P 3 NOTE: The nswers T or TRUE (insted of ), nd F or FALSE (insted of ) re lso cceptble (this is the convention in the textbook). (b) [4 mrks] Determine the numeric vlues of the four window edge coordintes with respect to the four boundries of the clipping region for just the third vertex P 2 = (. 5, +. 5) in the input polygon. WEC[Left]: + x =+. 5 WEC[Right]: x =+. 5 WEC[Bottom]: + y =+2. 5 WEC[Top]: y =. 5 CPSC 44 2-2 (T) 3of3 2nd Midterm Exm (7 minutes)

(c) [8 mrks] Indicte the coordintes fter the clipper is clled with ll points for the Left clipping boundry (i.e., provide the output from the first stge of clipping). Unused entries should be left blnk. Vertices should be listed in order so they form proper polygon (you cn strt with ny vertex, but the rest must come in the correct cyclic order). Vertex x y P. 5 +. 5 P 2. 5 +. 5 L. +. L.. P.. The order bove is wht the C code ctully produces if it is run with just the Left clipping boundry. Your nswer cn be ny cyclic shift of this. (d) [8 mrks] Indicte the coordintes t the very end fter the clipper is clled with ll points for the Top clipping boundry (i.e., provide the output from the lst stge of clipping). Unused entries should be left blnk. Vertices should be listed in order so they form proper polygon (you cn strt with ny vertex, but the rest must come in the correct cyclic order). Vertex x y L.. P.. P. 5 +. 5 T. 5 +. T. +. L. +. NOTICE tht T nd L hve the sme coordintes! CPSC 44 2-2 (T) 4of3 2nd Midterm Exm (7 minutes)

Question #2 [6 mrks totl] This question tests your knowledge of properties nd conventions for 3D polygons. Below re the 3-D coordintes for polygon (similr to the polygon used in Question #, but this one hs 3D coordintes rther thn just 2D coordintes). Vertex x y z P... P. 5 +. 5. P 2. 5 +. 5. P 3 2... Use these coordintes for the first four prts of this question. () [2 mrks] Assume tht the eyepoint is locted t (.,., 3. ). Using our stndrd convention for polygons, is the polygon (P, P, P 2, P 3 )front-fcing or bck-fcing polygon? Why? IT is FRONT-FACING becuse the vertices re seen in COUNTER- CLOCKWISE order from the eyepoint. Newell s formul provides norml of (,,), which points towrd the eyepoint. (b) [2 mrks] Is the polygon (P, P, P 2, P 3 )plnr or non-plnr polygon? Why? It is PLANAR becuse ll of the vertices lie in the z = plne. (c) [2 mrks] Is the polygon (P, P, P 2, P 3 )convex or non-convex polygon? Why? It is NON-CONVEX becuse the line P P 2 is not completely contined within the polygon interior or boundry. (d) [2 mrks] Is the 2D projection onto the screen of the polygon (P, P, P 2, P 3 )simple or nonsimple polygon? Why? It is SIMPLE becuse no edges cross in the projected polygon. CPSC 44 2-2 (T) 5of3 2nd Midterm Exm (7 minutes)

For the next four prts of this question, consider the following polygon for ll of your nswers. Its vertices re different both in order nd in coordintes from the previous polygon. Vertex x y z P 4 2... P 5. 5 +. 5. P 6... P 7. +. 5. (e) [2 mrks] Assume tht the eyepoint is locted t (.,., 3. ). Using our stndrd convention for polygons, is the polygon (P 4, P 5, P 6, P 7 )front-fcing or bck-fcing polygon? Why? IT is BACK-FACING becuse the vertices re seen in CLOCKWISE order from the eyepoint. Newell s formul provides norml of (.499,.66,-.9986), which points wy from the eyepoint. The polygon is non-plnr (see (f) below) nd non-simple (see (h) below). This mkes it more difficult to nswer this question, but the lrger portion is clockwise nd the smller is counterclockwise, nd Newell s formul weights this ccordingly to produce net result tht corresponds to clockwise ordering. (f) [2 mrks] Is the polygon (P 4, P 5, P 6, P 7 )plnr or non-plnr polygon? Why? It is NON-PLANAR becuse three of the vertices lie in the z = plne but one does not, so there cnnot be ny plne in which they ll four lie. (g) [2 mrks] Is the polygon (P 4, P 5, P 6, P 7 )convex or non-convex polygon? Why? It is NON-CONVEX becuse the line P 5 P 7 is not completely contined within the polygon interior or boundry. The fct tht it is nonplnr mens it cnnot be convex. (h) [2 mrks] Is the 2D projection onto the screen of the polygon simple or non-simple polygon? Why? It is NON-SIMPLE becuse the two edges P 5 P 6 nd P 7 P 4 cross in the projected polygon. CPSC 44 2-2 (T) 6of3 2nd Midterm Exm (7 minutes)

Question #3 [2 mrks totl] This questions tests you knowledge of hierrchicl disply list structures s discussed in lecture. Below is DAG tht will disply multiple instnces of the unit cube, centred t the origin, whose geometry is stored in the node C when the Wlk() function is clled to process the root node of the DAG. Refer to this digrm for both prts of this question. The nodes with T lbel re trnsltions. T T T2 T3 T4 T5 R S istrnsltion tht tkes (x, y, z) to(x,y 5, z). istrnsltion tht tkes (x, y, z) to(x,y,z). istrnsltion tht tkes (x, y, z) to(x,y+5, z). istrnsltion tht tkes (x, y, z) to(x 5, y, z). istrnsltion tht tkes (x, y, z) to(x,y,z). istrnsltion tht tkes (x, y, z) to(x+5, y, z). iscounterclockwise rottion of 6 degrees bout z-xis. is scling tht contrcts everything by fctor of three long the x xis, expnds everything by fctor of seven long the y xis, nd leves things unchnged long the z xis. T T T2 T3 T4 T5 S R C CPSC 44 2-2 (T) 7of3 2nd Midterm Exm (7 minutes)

When cube is drwn fter non-uniform scling hs been pplied, it will in generl be prllellipiped, not cube. If we ssume tht the function Wlk() is invoked with T s its rgument (the root of the DAG), there will be six prllellipipeds (possibly scled nd rotted cubes) drw t vrious plces on the screen. () [2 mrks] For ech of the six prllellipipeds, describe its position (x, y) on the screen, its orienttion (rotted or not), nd its shpe (scled or not). Vertex Position Orienttion Shpe () ( 5, 5) rotted scled (2) (, 5) rotted not scled (3) (+5, 5) rotted scled (4) (+5, ) rotted scled (5) (, +5) rotted not scled (6) (+5, +5) rotted scled (b) [8 mrks] Assume tht the viewing trnsformtion is just the identity mtrix with no perspective. Show the contents of the mtrix stck when the lst prllellipiped is being drwn using the Wlk() function described in lecture. The stck will contin five 4 4 mtrices with the current trnsformtion on the top of the stck nd four sved mtrices in the stck. Show ech of the symbolic expressions (vrious products of the mtrices stored in the DAG) for the five mtrices in the stck. () top: I T 2 T 5 S R (2) I T 2 T 5 S (3) I T 2 T 5 (4) I T 2 (5) bottom: I (the identity mtrix) CPSC 44 2-2 (T) 8of3 2nd Midterm Exm (7 minutes)

Question #4 [4 mrks 2 mrks ech] This question tests your generl knowledge of the concepts nd terminology introduced in the course. The following terms or people s nmes re possible nswers for the questions on subsequent pges. Use the number corresponding to term or nme below sninthe spce provided nswer if you think it is the best mtch for one of the concepts or terms on subsequent pges. Ech term my be used once, more thn once, or not t ll. () DAG (2) ffine (3) child (4) commuttive (5) convex (6) determinnt (7) heterogeneous (8) homogeneous (9) homotopy () indeterminnt () inverse (2) liner (3) non-uniform scling (4) orthogonl (5) orthogrphic (6) prent (7) permnent (8) point (9) point t infinity (2) qudrnt (2) qudruple (22) quternion (23) rottion bout x (24) rottion bout y (25) rottion bout z (26) sher (27) sibling (28) threded (29) trce (3) trnsltion (3) uniform scling (32) vector (33) virtul cmer (34) Weiler-Atherton CPSC 44 2-2 (T) 9of3 2nd Midterm Exm (7 minutes)

For ech sttement below, write the number of the term listed on the previous pge tht best fits into the missing spce mrked by ******** in the sentence. [2 mrks ech] _ 8 _() We often dd this fourth homogeneous coordinte in 3-D grphics to provide uniform mtrix representtion for the vrious trnsformtions tht re used. _8_(b) For point we dd fourth coordinte tht is one (). _32_(c) For vector we dd fourth coordinte tht is zero (). _9_(d) A second interprettion, insted of the one in prt (c), is tht when we dd fourth coordinte tht is zero () we obtin point t infinity. NOTE: The nswers to (c) nd (d) re interchngeble, but credit will not be given twice for the sme nswer. _2_(e) A weighted sum of vectors is liner combintion nd is itself lwys vector. _2_(f) A weighted sum of vectors whose weights sum to unity () is clled ffine. _ 5 _(g) A weighted sum of vectors whose weights re ll non-negtive nd sum to unity () is clled convex. _2_(h) A weighted sum of points must be ffine if the result is point. _28_(i) A threded n-ry tree is one in which the usul pointers from prents to children hve been replced by only two pointers, one to the first child nd one to the next sibling. _6_(j) The difference between tree nd DAG is tht some nodes my hve more thn one prent in DAG. _34_(k) The Weiler-Atherton clipping lgorithm is the most generl polygon clipping lgorithm of those discussed in the textbook. _33_(l) The virtul cmer is useful nlogy or metphor tht ssists in understnding vrious viewing nd perspective prmeters. CPSC 44 2-2 (T) of3 2nd Midterm Exm (7 minutes)

[2 mrks ech] _24_(m) A 4 4mtrix b b where 2 + b 2 = corresponds to rottion bout y trnsformtion. NOTE: An lternte nswer (worth only mrk) is #4, orthogonl. _3_(n) A 4 4mtrix b c corresponds to trnsltion trnsformtion. _3_(o) A 4 4mtrix b c corresponds to non-uniform scling trnsformtion. _3_(p) A 4 4mtrix corresponds to uniform scling trnsformtion. _26_(q) A 4 4mtrix corresponds to sher trnsformtion. _ 6 _(r) The re of polygon fter trnsformtion by mtrix M is relted to the originl re by the determinnt of the mtrix M. _22_(s) The quternion is mthemticl object hs four components nd cn be used to represent rottions in three-dimensionl spce. It ws discovered by Sir Willim Rowen Hmilton in 843 while wlking with his wife one evening long the Royl Cnl in Dublin. _4_(t) Two mtrices A nd B re commuttive if AB = BA. CPSC 44 2-2 (T) of3 2nd Midterm Exm (7 minutes)