CS Exam 1 Review Problems Fall 2017

Similar documents
CS 130 Final. Fall 2015

CS602 Midterm Subjective Solved with Reference By WELL WISHER (Aqua Leo)

Graphics Pipeline 2D Geometric Transformations

For each question, indicate whether the statement is true or false by circling T or F, respectively.

Chapter 5. Projections and Rendering

CS 112 The Rendering Pipeline. Slide 1

CS559 Computer Graphics Fall 2015

Pipeline Operations. CS 4620 Lecture 10

CS 381 Computer Graphics, Fall 2008 Midterm Exam Solutions. The Midterm Exam was given in class on Thursday, October 23, 2008.

2D rendering takes a photo of the 2D scene with a virtual camera that selects an axis aligned rectangle from the scene. The photograph is placed into

CS 381 Computer Graphics, Fall 2012 Midterm Exam Solutions. The Midterm Exam was given in class on Tuesday, October 16, 2012.

Rasterization Overview

CHETTINAD COLLEGE OF ENGINEERING & TECHNOLOGY CS2401 COMPUTER GRAPHICS QUESTION BANK

Drawing in 3D (viewing, projection, and the rest of the pipeline)

Drawing in 3D (viewing, projection, and the rest of the pipeline)

CS184 : Foundations of Computer Graphics Professor David Forsyth Final Examination

CS 4204 Computer Graphics

Rendering. Converting a 3D scene to a 2D image. Camera. Light. Rendering. View Plane

CS 4620 Midterm, March 21, 2017

The Importance of Matrices in the DirectX API. by adding support in the programming language for frequently used calculations.

CS4620/5620: Lecture 14 Pipeline

Basic Elements. Geometry is the study of the relationships among objects in an n-dimensional space

3D Viewing. CS 4620 Lecture 8

CS184 : Foundations of Computer Graphics Professor David Forsyth Final Examination (Total: 100 marks)

CS 130 Exam I. Fall 2015

2D Object Definition (1/3)

CS 4620 Program 3: Pipeline

Perspective Mappings. Contents

CS 184, Fall 1996 Midterm #1 Professor: unknown

Name. Center axis. Introduction to Conic Sections

Homework #2 and #3 Due Friday, October 12 th and Friday, October 19 th

Computer Graphics 7: Viewing in 3-D

CS 184, Fall 1996 Midterm #1 Professor: unknown

Introduction to Transformations. In Geometry

Part 3: 2D Transformation

CS 130 Exam I. Fall 2015

521493S Computer Graphics Exercise 1 (Chapters 1-3)

CS 464 Review. Review of Computer Graphics for Final Exam

EXAMINATIONS 2017 TRIMESTER 2

Scanline Rendering 2 1/42

CHAPTER 1 Graphics Systems and Models 3

Overview. By end of the week:

Warm-Up. Write the standard equation of the circle with the given radius and center. 1) 9; (0,0) 2) 1; (0,5) 3) 4; (-8,-1) 4) 5; (4,2)

3D Viewing. CS 4620 Lecture Steve Marschner. Cornell CS4620 Spring 2018 Lecture 9

Institutionen för systemteknik

Graphics Hardware and Display Devices

Drawing in 3D (viewing, projection, and the rest of the pipeline)

1 Projective Geometry

C P S C 314 S H A D E R S, O P E N G L, & J S RENDERING PIPELINE. Mikhail Bessmeltsev

CS230 : Computer Graphics Lecture 6: Viewing Transformations. Tamar Shinar Computer Science & Engineering UC Riverside

Today. Rendering pipeline. Rendering pipeline. Object vs. Image order. Rendering engine Rendering engine (jtrt) Computergrafik. Rendering pipeline

6.837 Introduction to Computer Graphics Quiz 2 Thursday November 20, :40-4pm One hand-written sheet of notes allowed

Three-Dimensional Viewing Hearn & Baker Chapter 7

Midterm Exam Fundamentals of Computer Graphics (COMP 557) Thurs. Feb. 19, 2015 Professor Michael Langer

(a) rotating 45 0 about the origin and then translating in the direction of vector I by 4 units and (b) translating and then rotation.

Section 7.2 Volume: The Disk Method

CSE 167: Lecture #4: Vertex Transformation. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012

Announcements. Submitting Programs Upload source and executable(s) (Windows or Mac) to digital dropbox on Blackboard

Pipeline Operations. CS 4620 Lecture Steve Marschner. Cornell CS4620 Spring 2018 Lecture 11

CSC 305 The Graphics Pipeline-1

Viewing with Computers (OpenGL)

Computer Graphics: Viewing in 3-D. Course Website:

CS 4620 Midterm 1. Tuesday 22 October minutes

Ciril Bohak. - INTRODUCTION TO WEBGL

The Viewing Pipeline adaptation of Paul Bunn & Kerryn Hugo s notes

COMP3421. Vector geometry, Clipping

Module Contact: Dr Stephen Laycock, CMP Copyright of the University of East Anglia Version 1

The point (x, y) lies on the circle of radius r and center (h, k) iff. x h y k r

Pipeline Operations. CS 4620 Lecture 14

CS488. Implementation of projections. Luc RENAMBOT

1 OpenGL - column vectors (column-major ordering)

CSE528 Computer Graphics: Theory, Algorithms, and Applications

3D GRAPHICS. design. animate. render


Chapter 10. Exploring Conic Sections

CS2401 COMPUTER GRAPHICS ANNA UNIV QUESTION BANK

EXAMINATIONS 2016 TRIMESTER 2

Part I. Problems in this section are mostly short answer and multiple choice. Little partial credit will be given. 5 points each.

6.837 Introduction to Computer Graphics Final Exam Tuesday, December 20, :05-12pm Two hand-written sheet of notes (4 pages) allowed 1 SSD [ /17]

UNIT 2 2D TRANSFORMATIONS

GEOMETRIC TRANSFORMATIONS AND VIEWING

Vector Algebra Transformations. Lecture 4

CS 563 Advanced Topics in Computer Graphics Camera Models. by Kevin Kardian

Surface Graphics. 200 polys 1,000 polys 15,000 polys. an empty foot. - a mesh of spline patches:

Algebra II Lesson 10-5: Hyperbolas Mrs. Snow, Instructor

Texture Mapping. Michael Kazhdan ( /467) HB Ch. 14.8,14.9 FvDFH Ch. 16.3, , 16.6

CSE328 Fundamentals of Computer Graphics

CS602 MCQ,s for midterm paper with reference solved by Shahid

CSE 167: Lecture #5: Rasterization. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012

The 3-D Graphics Rendering Pipeline

ALGEBRA II UNIT X: Conic Sections Unit Notes Packet

CMSC427 Final Practice v2 Fall 2017

Projection Lecture Series

COMP30019 Graphics and Interaction Perspective Geometry

COMP30019 Graphics and Interaction Perspective & Polygonal Geometry

CIS 580, Machine Perception, Spring 2016 Homework 2 Due: :59AM

Rendering If we have a precise computer representation of the 3D world, how realistic are the 2D images we can generate? What are the best way to mode

file:///c /Documents%20and%20Settings/Jason%20Raftery/My%20Doc...e%20184%20-%20Spring%201998%20-%20Sequin%20-%20Midterm%202.htm

GAUTENG DEPARTMENT OF EDUCATION SENIOR SECONDARY INTERVENTION PROGRAMME. MATHEMATICS Grade 11 SESSION 17 LEARNER NOTES

CMSC427 Transformations II: Viewing. Credit: some slides from Dr. Zwicker

Transcription:

CS 45500 Exam 1 Review Problems Fall 2017 1. What is a FrameBuffer data structure? What does it contain? What does it represent? How is it used in a graphics rendering pipeline? 2. What is a Scene data structure? What does it contain? What does it represent? How is it used in a graphics rendering pipeline? 3. Briefly describe the contents of a ppm file. As an image file format, what advantage does it have? What is its disadvantage? 4. Briefly describe each of the following coordinate systems. (a) model coordinates (b) camera coordinates 5. Briefly describe each of the following stages of the graphics rendering pipeline and put them in the correct order. (a) Clip (b) Model2Camera (c) Rasterize (d) Project (e) Viewport 6. When is it preferable to use orthographic (parallel) projection? When is it preferable to use perspective projection? Explain why. 7. Give one important reason for using homogeneous coordinates in a graphics system. 8. Demonstrate, using algebra or pictures, that order matters when composing (concatenating) two transformations. 9. What would be the 16 entries in the 4 4 homogeneous matrix in the Position object after executing the following lines of code? position.matrix2identity(); position.translate(1.5, 2.0, -3.0); position.scale(3, 2, 0.5); 10. What would be the 16 entries in the 4 4 homogeneous matrix in the Position object after executing the following lines of code? position.matrix2identity(); position.rotatez(90);

11. (a) Compute the 16 number that make up the 4 4 homogeneous matrix in the Position object after executing the following lines of code. position.matrix2identity(); position.translate(3.0, 0.0, 0.0); position.scale(3.0, 1.0, 1.0); (b) Compute the 16 number that make up the 4 4 homogeneous matrix in the Position object after executing the following lines of code. position.matrix2identity(); position.scale(3.0, 1.0, 1.0); position.translate(3.0, 0.0, 0.0); (c) Compute the 16 number that make up the 4 4 homogeneous matrix in the Position object after executing the following lines of code. position.matrix2identity(); position.scale(3.0, 1.0, 1.0); position.translate(1.0, 0.0, 0.0); (d) How would you explain to someone, without doing the actual calculations, why the matrices in parts (a) and (b) are different, but the matrices in parts (a) and (c) are the same? 12. Which is better? Why is it better than the other two? clipping in camera coordinates (just before projection) clipping in view plane coordinates (just after projection) clipping while rasterizing 13. Draw a simple diagram that explains how to derive the projection formula for the x- coordinate. 14. Let v 0 = (1.5, 1.0, 1.0) and v 1 = (0.0, 2.0, 1.0) be two vertices in the viewplane z = 1 and suppose that they define a LineSegment. Suppose that v 0 has the color (r, g, b) = (0.5, 0.5, 0.5) and v 1 has the color (r, g, b) = (0.0, 1.0, 0.7). (a) Draw a simple (2D) picture of the viewplane, the view rectangle, and this line segment. (b) Compute the vertices of the new line segment that this line segment will be clipped to. (c) Compute the value of the red color component at one of the new vertices. Indicate in your picture above for which vertex you are computing the new red value. NOTE: The line segment gets clipped into three equal size pieces, so you can almost do this in your head.

15. Consider the following block of code. Vertex[] v = {new Vertex(0, 1, -1), new Vertex(1, -1, -1), new Vertex(1, 1, -1)}; Model m = new Model(); m.addlinesegment(v[0], v[1]); m.addlinesegment(v[1], v[2]); m.addlinesegment(v[2], v[0]); (a) What picture would be drawn if we rendered the model m built by this code (assume an orthographic projection looking down the z-axis)? In your picture, label the appropriate points in the order v[0] to v[2]. (b) How many Java objects does this code instantiate (count the objects that are composed in other objects)? Draw a detailed picture of what the objects look like in the Java heap (which objects refer to which objects?). (c) Write a minimal(!) Java program that will compile and run and draw the above model (by draw I mean write the FrameBuffer to a file that can be viewed). 16. Consider the following block of code. How many Java objects does this code instantiate (count the objects that are composed in other objects)? Draw a detailed picture of what the objects look like in the Java heap (which objects refer to which objects?). Vertex[] v = {new Vertex(0, 1, -1), new Vertex(1, -1, -1), new Vertex(1, 1, -1)}; Model m = new Model(); model.addvertex(v[0], v[1], v[2]); model.addlinesegment(0, 1); model.addlinesegment(1, 2); model.addlinesegment(2, 0);

17. Suppose we have defined a subclass DrawModel of Model that represents the following image in the xy-plane. Draw a sketch of the scene that the following code would produce. For each of the three model images, give the coordinates of the model s origin point. Model drawmodel = new DrawModel(); Position p1 = new Position(); Position p2 = new Position(drawModel); Position p3 = new Position(); Position p4 = new Position(drawModel); Position p5 = new Position(drawModel); p1.addnestedposition(p2); p1.addnestedposition(p3); p3.addnestedposition(p4); p3.addnestedposition(p5); p3.translate(1.0, 0.0, 0.0); p4.translate(0.0, 3.0, 0.0); p4.rotatez(45.0); p5.translate(1.0, 0.0, 0.0); p2.translate(-2.0, -2.0, 0.0); p2.rotatez(-90.0); Scene scene = new Scene(); scene.addposition(p1);

18. Using the same DrawModel class from the previous problem, write code that would generate the following image. Do this two different ways, one way with a translation preceding a rotation, and the second way with a rotation preceding a translation. (a) Translation and then rotation. (b) Rotation and then translation. 19. Using the same DrawModel class from the previous problem, write code that would generate the following image. Do this two different ways, one way with a translation preceding a rotation, and the second way with a rotation preceding a translation. (a) Translation and then rotation. (b) Rotation and then translation.

20. Suppose you have available to you a subclass DrawUnitCircle of Model that draws in the xy-plane a circle of radius one centered at the origin. What would the following code draw in the xy-plane? Model circle = new DrawUnitCircle(); Position p1 = new Position(); Position p2 = new Position(circle); Position p3 = new Position(circle); Position p4 = new Position(circle); p1.addnestedposition(p2); p1.addnestedposition(p3); p1.addnestedposition(p4); p2.scale(2.0, 2.0, 2.0); p3.rotatez(theta1); p3.translate(3.0, 0.0, 0.0); p4.rotatez(theta2); p4.translate(1.5, 0.0, 0.0); p4.scale(0.5, 0.5, 1.0); 21. Suppose you have available to you a subclass DrawUnitCircle of Model that draws in the xy-plane a circle of radius one centered at the origin. Use a single instance of this model, several instances of Position, and any of the methods addnestedposition(), translate(), rotate(), and scale(), to draw the following F-shape. The vertical ellipse has its bottom at the point (0, 0) and its top at the point (0, 4), and at its widest it is 1 unit across. The upper horizontal ellipse is 2 units long. The lower horizontal ellipse is 1.5 units long. Its right hand end point has coordinates (2, 2). The two horizontal ellipses are 0.5 units tall.

22. What does the following code draw in the xy-plane? Hint: Draw a picture of the graph data structure built by this code. Then determine what the transformations do to the geometry. Model m1 = new Model(); m1.addlinesegment(new Vertex(-1, 0, 0), new Vertex(1, 0, 0)); Position p2 = new Position(); Position p3 = new Position(m1); Position p4 = new Position(m1); p2.addnestedposition(p3); p2.addnestedposition(p4); p3.translate(1, 0, 0); p4.translate(2, 0, 0); p4.rotatez(90); p4.scale(0.5, 1, 1); Position p5 = new Position(); Position p6 = new Position(); Position p7 = new Position(); Position p8 = new Position(); p5.addnestedposition(p6); p5.addnestedposition(p7); p5.addnestedposition(p8); p6.addnestedposition(p2); p7.addnestedposition(p2); p8.addnestedposition(p2); p7.rotatez(90); p8.rotatez(-135);

23. Suppose we have a FrameBuffer object that is 200 pixels by 200 pixels. Suppose we define a 100 pixel high by 200 pixel wide viewport within the FrameBuffer so that the viewport is centered in the FrameBuffer. Let v = (4, 3, 6) be a vertex in the camera coordinate system. (a) What vertex in the viewplane z = 1 does the vertex v project to? (b) What (2-dimensional) vertex is the projected v transformed to by the Viewport transformation pipeline stage? (c) Which pixel in the FrameBuffer s viewport represents the vertex v? (Be sure to use the correct viewport pixel coordinate system.) (d) Which pixel in the FrameBuffer represents the vertex v? (Be sure to use FrameBuffer pixel coordinates.) 24. Let v 1 = (0.4, 0.8, 1) and v 2 = (2.2, 0.3, 1) be two vertices in the viewplane z = 1 and suppose that they define a LineSegment ls. Suppose that v 1 has the color (r, g, b) = (0.5, 0.5, 0.5) and v 2 has the color (r, g, b) = (0.0, 1.0, 0.7). Let v c = (1, y c, 1) denote the new vertex created when the LineSegment ls is clipped on the line x = 1. (a) Compute the value y c in the new vertex v c. (b) Compute the new color at the new vertex v c. Hint: Solve for t in the equation (1 t)v 1 + tv 2 = (1, y c ) Then use t to compute y c. Then use t to linearly interpolate each of the three new color components.

25. Suppose we have a FrameBuffer object fb that is 1000 pixels by 1000 pixels and this FrameBuffer s viewport is set to be all of the FrameBuffer. FrameBuffer fb = new FrameBuffer(1000, 1000); Suppose we have a Model object m and this model contains a LineSegment object with the following two vertices. Model m = new Model(); Vertex v0 = new Vertex(1, 1, 0); Vertex v1 = new Vertex(1, 1, -1); m.addlinesegment(v0, v1); Suppose we render this model into the framebuffer. Position p = new Position(m); p.matrix2identity(); p.translate(0, 0, -2); p.scale(0.5, 1.5, 1.0); Scene scene = new Scene(); scene.addposition( p ); Pipeline.render(scene, fb); (a) What vertex in camera space is each vertex v0 and v1 transformed to by the Model2Camera pipeline stage? (b) What vertex in the viewplane z = 1 is each transformed vertex v0 and v1 projected to? (c) What (2-dimensional) vertex is each projected vertex v0 and v1 transformed to by the Viewport transformation pipeline stage? Hint: Notice that the above code is a complete program. You can check your answers to this problem (and also the previous two problems) by using the actual renderer with the following options set on the pipeline. Rasterize.debug = true; Pipeline.debug = true; Pipeline.render(scene, fb);

26. Suppose we have a FrameBuffer object fb that is 10 pixels wide by 3 pixels high and this FrameBuffer s viewport is set to be all of the FrameBuffer. FrameBuffer fb = new FrameBuffer(10, 3); Suppose we have a Model object m and this model contains a single LineSegment that is a diagonal across the view rectangle in the view plane. Model m = new Model(); Vertex v0 = new Vertex(-1, -1, -1); Vertex v1 = new Vertex( 1, 1, -1); m.addlinesegment(v0, v1); Suppose we render this model into the framebuffer. Position p = new Position(m); Scene scene = new Scene(); scene.addposition( p ); Pipeline.render(scene, fb); Which pixels in the framebuffer are turned on by the rasterizer when it draws this line? Hint: Notice that the above code is a complete program. You can check your answer by using the actual renderer with the following options set on the pipeline. Rasterize.debug = true; Pipeline.debug = true; Pipeline.render(scene, fb); 11-02-2017 at 03:24 h