Computer Graphics: Two Dimensional Viewing

Similar documents
Computer Graphics. The Two-Dimensional Viewing. Somsak Walairacht, Computer Engineering, KMITL

2D Viewing. Viewing Pipeline: Window-Viewport Transf.

Unit 3 Transformations and Clipping

Computer Graphics Viewing Objective

Two-Dimensional Viewing. Chapter 6

DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI

Computer Graphics: Geometric Transformations

window World space (Object space)

Part 3: 2D Transformation

CSCI 4620/8626. Computer Graphics Clipping Algorithms (Chapter 8-5 )

Three-Dimensional Viewing Hearn & Baker Chapter 7

MODULE - 9. Subject: Computer Science. Module: Line Clipping. Module No: CS/CGV/9

CSCI 4620/8626. The 2D Viewing Pipeline

Lecture 3 Sections 2.2, 4.4. Mon, Aug 31, 2009

Viewing Transformation. Clipping. 2-D Viewing Transformation

Part IV. 2D Clipping

Roll No. : Invigilator's Signature :.. GRAPHICS AND MULTIMEDIA. Time Allotted : 3 Hours Full Marks : 70

UNIT 2 2D TRANSFORMATIONS

Clipping Points Consider a clip window which is rectangular in shape. P(x, y) is a point to be displayed.

UNIVERSITY OF NEBRASKA AT OMAHA Computer Science 4620/8626 Computer Graphics Spring 2014 Homework Set 1 Suggested Answers

Clipping Algorithms; 8-5. Computer Graphics. Spring CS4815

UNIT 2. Translation/ Scaling/ Rotation. Unit-02/Lecture-01

Projection Lecture Series

Chapter 8 Three-Dimensional Viewing Operations

3D Rendering Pipeline (for direct illumination)

Clipping Lines. Dr. Scott Schaefer

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

3D Polygon Rendering. Many applications use rendering of 3D polygons with direct illumination

CSE528 Computer Graphics: Theory, Algorithms, and Applications

Computer Graphics. Chapter 10 Three-Dimensional Viewing

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

3D Graphics Pipeline II Clipping. Instructor Stephen J. Guy

Section III: TRANSFORMATIONS

CSE328 Fundamentals of Computer Graphics

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

CS488. Implementation of projections. Luc RENAMBOT

2D TRANSFORMATIONS AND MATRICES

Two Dimensional Viewing

Binghamton University. EngiNet. Thomas J. Watson. School of Engineering and Applied Science. Computer Graphics. State University of New York.

Computer Graphics (CS 543) Lecture 9 (Part 2): Clipping. Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)

Computer Graphics 7: Viewing in 3-D

Computer Science 474 Spring 2010 Viewing Transformation

From Vertices To Fragments-1

CS 4204 Computer Graphics

Clipping. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015

More on Coordinate Systems. Coordinate Systems (3) Coordinate Systems (2) Coordinate Systems (5) Coordinate Systems (4) 9/15/2011

CS 591B Lecture 9: The OpenGL Rendering Pipeline

Clipping and Scan Conversion

Evening s Goals. Mathematical Transformations. Discuss the mathematical transformations that are utilized for computer graphics

Overview. Pipeline implementation I. Overview. Required Tasks. Preliminaries Clipping. Hidden Surface removal

Perspective Mappings. Contents

Overview of Projections: From a 3D world to a 2D screen.

UNIT 3 2D TRANSFORMATIONS Unit-03/Lecture-01

Last class. A vertex (w x, w y, w z, w) - clipping is in the - windowing and viewport normalized view volume if: - scan conversion/ rasterization

CS602- Computer Graphics Solved MCQS From Midterm Papers. MIDTERM EXAMINATION Spring 2013 CS602- Computer Graphics

Last week. Machiraju/Zhang/Möller/Fuhrmann

Chapter 8: Implementation- Clipping and Rasterization

CS 325 Computer Graphics

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

Projection: Mapping 3-D to 2-D. Orthographic Projection. The Canonical Camera Configuration. Perspective Projection

Lecture 6 Sections 4.3, 4.6, 4.7. Wed, Sep 9, 2009

CHETTINAD COLLEGE OF ENGINEERING & TECHNOLOGY CS2401 COMPUTER GRAPHICS QUESTION BANK

Examples. Clipping. The Rendering Pipeline. View Frustum. Normalization. How it is done. Types of operations. Removing what is not seen on the screen

CSC 305 The Graphics Pipeline-1

From 3D World to 2D Screen. Hendrik Speleers

Chapter 5. Projections and Rendering

Three-Dimensional Coordinate Systems

Notes on Assignment. Notes on Assignment. Notes on Assignment. Notes on Assignment

CSE452 Computer Graphics

CS184 : Foundations of Computer Graphics Professor David Forsyth Final Examination

Lecture 4. Viewing, Projection and Viewport Transformations

INTRODUCTION TO COMPUTER GRAPHICS. cs123. It looks like a matrix Sort of. Viewing III. Projection in Practice 1 / 52

Graphics (Output) Primitives. Chapters 3 & 4

INTRODUCTION TO COMPUTER GRAPHICS. It looks like a matrix Sort of. Viewing III. Projection in Practice. Bin Sheng 10/11/ / 52

Viewing with Computers (OpenGL)

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

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

FROM VERTICES TO FRAGMENTS. Lecture 5 Comp3080 Computer Graphics HKBU

Introduction to Computer Graphics 4. Viewing in 3D

Graph Drawing via Canonical Orders

VISIBILITY & CULLING. Don t draw what you can t see. Thomas Larsson, Afshin Ameri DVA338, Spring 2018, MDH

3D Graphics for Game Programming (J. Han) Chapter II Vertex Processing

EXAMINATIONS 2017 TRIMESTER 2

CS452/552; EE465/505. Clipping & Scan Conversion

Today s class. Viewing transformation Menus Mandelbrot set and pixel drawing. Informationsteknologi

Time: 3 hours Max. Marks: 80. Note: Answer FIVE full questions, choosing one full question from each module.

Overview. By end of the week:

CS 112 The Rendering Pipeline. Slide 1

Each point P in the xy-plane corresponds to an ordered pair (x, y) of real numbers called the coordinates of P.

HOUGH TRANSFORM. Plan for today. Introduction to HT. An image with linear structures. INF 4300 Digital Image Analysis

form are graphed in Cartesian coordinates, and are graphed in Cartesian coordinates.

COMP3421. Vector geometry, Clipping

COMP30019 Graphics and Interaction Three-dimensional transformation geometry and perspective

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

Ray Tracing Basics I. Computer Graphics as Virtual Photography. camera (captures light) real scene. photo. Photographic print. Photography: processing

Topics. From vertices to fragments

Clipping & Culling. Lecture 11 Spring Trivial Rejection Outcode Clipping Plane-at-a-time Clipping Backface Culling

The Rendering Pipeline (1)

MET71 COMPUTER AIDED DESIGN

Course Title: Computer Graphics Course no: CSC209

Transcription:

Computer Graphics: Two Dimensional Viewing Clipping and Normalized Window By: A. H. Abdul Hafez Abdul.hafez@hku.edu.tr, 1

Outlines 1. End 2

Transformation between 2 coordinate systems To transform positioned object descriptions from xy coordinates to x'y' coordinates, we set up a transformation that superimposes the x'y' axes onto the xy axes. This is done in two steps: 1. Translate so that the origin (x 0, y 0 ) of the x'y' system is moved to the origin (0, 0) of the xy system 2. Rotate the x' axis onto the x axis. 3

Transformation between 2 coordinate systems Specify a vector V that indicates the direction for the positive y' axis And we obtain the unit vector u along the x' axis by applying a 90 o clockwise rotation to vector v: Example: 4

2D viewing pipeline A clipping window is the section of a two-dimensional scene that is selected for display, because all parts of the scene outside the selected section are "clipped off. Sometimes the clipping window is alluded to as the world window or the viewing window. Graphics packages also allow us to control the placement within the display window using another "window" called the viewport. Objects inside the clipping window are mapped to the viewport, and it is the viewport that is then positioned within the display window. 5

2D viewing pipeline The clipping window selects what we want to see; the viewport indicates where it is to be viewed on the output device. World: What do we want to see? Screen: Where do we want to see it? A clipping window and associated viewport, specified as rectangles aligned with the coordinate axes 6

2D viewing pipeline The mapping of a two-dimensional, world-coordinate scene description to device coordinates is called a two-dimensional viewing transformation. To make the viewing process independent of the requirements of any output device, graphics systems convert object descriptions to normalized coordinates and apply the clipping routines. Some systems use normalized coordinates in the range from 0 to 1, and others use a normalized range from -1 to 1. 7

2D viewing pipeline example object 8

Viewing-coordinate clipping Window A viewing-coordinate frame is moved into coincidence with the world frame by a) applying a translation matrix T to move the viewing origin to the world origin, then b) applying a rotation matrix R to align the axes of the two systems. 9

Viewport Transformation scale and translate A point (xw, yw) in a world-coordinate clipping window is mapped to viewport coordinates (xv, yv), within a unit square, so that the relative positions of the two points in their respective rectangles are the same. 10

Viewport Transformation scale and translate Scale the clipping window to the size of the viewport using a fixedpoint position of (xw min, yw min ). (xw min, yw min ). (xv min, yv min ). Translate (xw min, yw min ) to (xv min, yv min ). (xv min, yv min ). 11 (xw min, yw min ).

Viewport Transformation The scaling factors required to keep the relative position of the two points (xw, yw) and (xv, yv) invariant are given as If the two scale factors are unequal, then the aspect-ratio changes : distortion! 12

Viewport Transformation Scale the clipping window to the size of the viewport using a fixedpoint position of (xw min, yw min ). Translate (xw min, yw min ) to (xv min, yv min ). 13

Viewport Transformation Clipping window to Normalized square Normalized square to screen viewport 14

2D viewing using OpenGL To prevent distortion, make sure that: (ywmax ywmin)/(xwmax xwmin) = vpwidth/vpheight 15

2D Clipping Clipping: removing parts outside clipping window Many algorithms: points, lines, fill-area, curves, Save point P = (x,y) if it s in the box Clipping straight-line segments using a standard rectangular clipping window 16

2D Clipping Cohen-Sutherland algorithm: Assign to each point a four-bit region code C; 1 is outside, 0 is inside A possible ordering for the clipping window boundaries corresponding to the bit positions in the Cohen- Sutherland endpoint region code. The nine binary region codes for identifying the position of a line endpoint, relative to the clippingwindow boundaries. 17

2D Clipping Cohen-Sutherland algorithm: Assign to each point a four-bit region code C; 1 is outside, 0 is inside Fast test on status end points line with codes C0 en C1 : if [C0 (bitwise-or) C1 = 0000], then completely in; else if [C0 (bitwise-and) C1 <> 0000], then completely out; else: fast intersection-calculation using codes 18

The end of the Lecture Thanks for your time Questions are welcome 19