2D Raster Graphics. Integer grid Sequential (left-right, top-down) scan. Computer Graphics

Similar documents
Scan Conversion & Shading

Scan Conversion & Shading

Multi-stable Perception. Necker Cube

3D vector computer graphics

Range images. Range image registration. Examples of sampling patterns. Range images and range surfaces

LEAST SQUARES. RANSAC. HOUGH TRANSFORM.

Model Clipping Triangle Strips and Quad Meshes.

Introduction to Geometrical Optics - a 2D ray tracing Excel model for spherical mirrors - Part 2

R s s f. m y s. SPH3UW Unit 7.3 Spherical Concave Mirrors Page 1 of 12. Notes

TEST-05 TOPIC: OPTICS COMPLETE

Assignment # 2. Farrukh Jabeen Algorithms 510 Assignment #2 Due Date: June 15, 2009.

CMPS 10 Introduction to Computer Science Lecture Notes

Machine Learning. Topic 6: Clustering

Computer Graphics. Jeng-Sheng Yeh 葉正聖 Ming Chuan University (modified from Bing-Yu Chen s slides)

Collision Detection. Overview. Efficient Collision Detection. Collision Detection with Rays: Example. C = nm + (n choose 2)

Machine Learning: Algorithms and Applications

Calibrating a single camera. Odilon Redon, Cyclops, 1914

Geometric Transformations and Multiple Views

Hermite Splines in Lie Groups as Products of Geodesics

Sequential search. Building Java Programs Chapter 13. Sequential search. Sequential search

CSCI 104 Sorting Algorithms. Mark Redekopp David Kempe

Brave New World Pseudocode Reference

Lecture 3: Computer Arithmetic: Multiplication and Division

Chapter 4. Non-Uniform Offsetting and Hollowing by Using Biarcs Fitting for Rapid Prototyping Processes

High level vs Low Level. What is a Computer Program? What does gcc do for you? Program = Instructions + Data. Basic Computer Organization

Graphics Output Primitives

Virtual Memory. Background. No. 10. Virtual Memory: concept. Logical Memory Space (review) Demand Paging(1) Virtual Memory

The Codesign Challenge

Fitting: Deformable contours April 26 th, 2018

Computer Animation and Visualisation. Lecture 4. Rigging / Skinning

Structure from Motion

9. BASIC programming: Control and Repetition

TN348: Openlab Module - Colocalization

Active Contours/Snakes

Insertion Sort. Divide and Conquer Sorting. Divide and Conquer. Mergesort. Mergesort Example. Auxiliary Array

Image warping and stitching May 5 th, 2015

Parallel matrix-vector multiplication

GRAPHICS OUTPUT PRIMITIVES

An efficient method to build panoramic image mosaics

CSE 326: Data Structures Quicksort Comparison Sorting Bound

The Research of Ellipse Parameter Fitting Algorithm of Ultrasonic Imaging Logging in the Casing Hole

Computer Graphics. Geometric Transformations

Welcome to the Three Ring %CIRCOS: An Example of Creating a Circular Graph without a Polar Axis

Today s Outline. Sorting: The Big Picture. Why Sort? Selection Sort: Idea. Insertion Sort: Idea. Sorting Chapter 7 in Weiss.

Interpolation of the Irregular Curve Network of Ship Hull Form Using Subdivision Surfaces

Computer Graphics. - Spline and Subdivision Surfaces - Hendrik Lensch. Computer Graphics WS07/08 Spline & Subdivision Surfaces

ELEC 377 Operating Systems. Week 6 Class 3

Computer Graphics. Geometric Transformations

Line Clipping by Convex and Nonconvex Polyhedra in E 3

12/2/2009. Announcements. Parametric / Non-parametric. Case-Based Reasoning. Nearest-Neighbor on Images. Nearest-Neighbor Classification

Shape Representation Robust to the Sketching Order Using Distance Map and Direction Histogram

Color in OpenGL Polygonal Shading Light Source in OpenGL Material Properties Normal Vectors Phong model

Conditional Speculative Decimal Addition*

CSE 326: Data Structures Quicksort Comparison Sorting Bound

K-means and Hierarchical Clustering

CE 221 Data Structures and Algorithms

CS1100 Introduction to Programming

Image Segmentation. Image Segmentation

An Optimal Algorithm for Prufer Codes *

Analysis of Continuous Beams in General

Algorithm To Convert A Decimal To A Fraction

MULTISPECTRAL IMAGES CLASSIFICATION BASED ON KLT AND ATR AUTOMATIC TARGET RECOGNITION

Feature Reduction and Selection

Complex Numbers. Now we also saw that if a and b were both positive then ab = a b. For a second let s forget that restriction and do the following.

6.854 Advanced Algorithms Petar Maymounkov Problem Set 11 (November 23, 2005) With: Benjamin Rossman, Oren Weimann, and Pouya Kheradpour

News. Recap: While Loop Example. Reading. Recap: Do Loop Example. Recap: For Loop Example

Kent State University CS 4/ Design and Analysis of Algorithms. Dept. of Math & Computer Science LECT-16. Dynamic Programming

Image Alignment CSC 767

Computer Graphics. Lecture 3 Graphics Output Primitives. Somsak Walairacht, Computer Engineering, KMITL

Support Vector Machines

Accounting for the Use of Different Length Scale Factors in x, y and z Directions

3D Virtual Eyeglass Frames Modeling from Multiple Camera Image Data Based on the GFFD Deformation Method

Computer Graphics. Modelling in 2D. 2D primitives. Lines and Polylines. OpenGL polygon primitives. Special polygons

Dynamic wetting property investigation of AFM tips in micro/nanoscale

The AVL Balance Condition. CSE 326: Data Structures. AVL Trees. The AVL Tree Data Structure. Is this an AVL Tree? Height of an AVL Tree

A Novel Accurate Algorithm to Ellipse Fitting for Iris Boundary Using Most Iris Edges. Mohammad Reza Mohammadi 1, Abolghasem Raie 2

Programming in Fortran 90 : 2017/2018

Computer models of motion: Iterative calculations

Mathematics 256 a course in differential equations for engineering students

An Object Detection Method based on the Separability Measure using an Optimization Approach

FEATURE EXTRACTION. Dr. K.Vijayarekha. Associate Dean School of Electrical and Electronics Engineering SASTRA University, Thanjavur

Sorting. Sorting. Why Sort? Consistent Ordering

Image Fusion With a Dental Panoramic X-ray Image and Face Image Acquired With a KINECT

Accelerating X-Ray data collection using Pyramid Beam ray casting geometries

Intra-Parametric Analysis of a Fuzzy MOLP

CS240: Programming in C. Lecture 12: Polymorphic Sorting

A Comparison and Evaluation of Three Different Pose Estimation Algorithms In Detecting Low Texture Manufactured Objects

Takahiro ISHIKAWA Takahiro Ishikawa Takahiro Ishikawa Takeo KANADE

Type-2 Fuzzy Non-uniform Rational B-spline Model with Type-2 Fuzzy Data

Subspace clustering. Clustering. Fundamental to all clustering techniques is the choice of distance measure between data points;

A Neighbor-finding Algorithm Involving the Application of SNAM in Binary-Image Representation

Agenda & Reading. Simple If. Decision-Making Statements. COMPSCI 280 S1C Applications Programming. Programming Fundamentals

A Binarization Algorithm specialized on Document Images and Photos

Concurrent Apriori Data Mining Algorithms

Region Segmentation Readings: Chapter 10: 10.1 Additional Materials Provided

Some Tutorial about the Project. Computer Graphics

Fitting & Matching. Lecture 4 Prof. Bregler. Slides from: S. Lazebnik, S. Seitz, M. Pollefeys, A. Effros.

Non-Split Restrained Dominating Set of an Interval Graph Using an Algorithm

Sketch-Based User Interface for Inputting Graphic Objects on Small Screen Devices

The Greedy Method. Outline and Reading. Change Money Problem. Greedy Algorithms. Applications of the Greedy Strategy. The Greedy Method Technique

Transcription:

2D Graphcs

2D Raster Graphcs Integer grd Sequental (left-rght, top-down scan j

Lne drawng A ver mportant operaton used frequentl, block dagrams, bar charts, engneerng drawng, archtecture plans, etc. curves as concatenaton of small lne segments Crtera lne should appear straght llumnate nearest grd pont

Lne drawng Lne should termnate correctl Lne should have a constant ntenst specf both end ponts nstead of end pont + slope +length 5 / 4 2 brghtness adjustment (antalasng 5/4 ntenst ~ # of dots/unt length

Lne drawng Lne should not have gaps =f( f slope < =f( f slope > =f(

Lne drawng Lne should be drawn as fast as possble Brute-force method DDA (dgtal dfferental analzer for( m m b ; o m m( b n b m b m ; m b fp * fp + fp +

Bresenham s Lne Algorthm nteger operatons onl t slope (, ( 2, 2 (, (, f s t or s t t else s t or s t s s

possble current ntersecton range 45 o 45 o possble net ntersecton range

Bresenham s Lne Algorthm d s ( d (, (, d t ( ( d d s t 2 ( d 2 d( s t 2( d d 2d d d floatng pont t s d d Integer!! (

( 2 2 ( 2 2 ( 2 ( 2 2 2( 2 2( d d d d d d d d d d d d d d d d d d d d d d Bresenham s Lne Algorthm

d d 2d 2d( f d choose t d d 2( d d f d Bresenham s Lne Algorthm choose s d d 2d ntal condton d 2d d (, (, Complet: left shft + 2 nteger addtons

Crcle Drawng Smmetr reduces drawng to /8 (-, (-,- (-, (, (, (,- r c c cos r sn (-,- (,-

Bresenham s Crcle Algorthm nteger operatons onl (, t (, (, c o c 45 9 o (, s 2 2 2 2 2 2 D( s ( ( r D( s D( t t D( t ( r D( s D( t s

Bresenham s Crcle Algorthm d D( s D( t D( s D( t 2 2 2 2 d 2r 2( ( 2 2 2 2 d 2r 2( 2 ( 2 2 d d 4 6 2( 2(

Bresenham s Crcle Algorthm d 3 2r (, (, r f d choose t, d d 4 6 f d choose s, d d 4 4 6 Complet: onl nteger and shft operatons

Ellpse Other prmtves smmetr reduces to /4 Bresenhem s ellpse algorthm Curve dffcult appromaton usng short lne segments general curve forms (Bezer, B-splne, etc. Characters rectangular grd patterns

Arbtrar # of sdes Conve or concave Holes Y olgon Flng X

Scan Lne Algorthm Edge table sort edges b scanlne (usng mn Y ma record coordnate of mn ma to be added (, mn

Scan Lne Algorthm Set to smallest n ET Intalze AET to be Null Repeat untl AET and ET are empt move from ET bucket to AET those edges whose mn= sort edges n AET b (nserton sort fll n pel values n between pars remove from AET those edges whose ma = ncrement b update for all edges n AET

olgon atterned Fllng Y Y logcal and X X X

olgon atterned Fllng attern can be anchored at a fed pont: transparent object moves on a patterned background a polgon corner: patterned object

2D Transformaton For anmaton, manpulaton, user nteracton translaton, rotaton, scalng T T S S ' ' ' ' cos sn sn cos ' '

A Ver Common Confuson What s beng transformed? onts or coordnate sstem? For CG, ppelne operatons are alwas appled to features (ponts, lnes, curves, planes But ou can thnk n ether wa: onts are phscall moved n a fed coordnate sstem (e.g., n modelng transform, or A coordnate sstem s moved, whle ponts sta statonar (e.g., n vewng transform Both nterpretatons are useful

2D Rgd Transformatons A rgd transformaton maps one coordnate sstem nto another reserves dstances and angles To transform ponts from one coordnate frame to another, fnd the rgd transformaton that brngs the two coordnate frames n algnment Translate so that ther orgns concde Rotate so that ther aes concde ( wth, wth, and z wth z

2D eamples Rot Trans Trans+Rot

2D Translaton Translate the coordnate sstem b (T,T What s the translated pont? T T (T,T

2D rotaton matr Rotate θ counterclockwse What s the transformaton R? R cos sn sn cos

2D Rgd Transformatons A rgd transformaton moves an object from one locaton to another locaton reserves dstances and angles To transform ponts from one place to another, fnd the rgd transformaton that Translate so that the object moves Rotate so that the object reorents

2D eamples Trans Rot Trans+Rot

2D Translaton Translate the coordnate sstem b (T,T What s the translated pont? (T,T T T (-T,-T

2D rotaton matr Rotate θ counterclockwse What s the transformaton R? R - cos sn sn cos

2D Transformaton For anmaton, manpulaton, user nteracton translaton, rotaton, scalng T T S S ' ' ' ' cos sn sn cos ' '

2D Transformaton (cont. Inconsstent representaton for translaton Cannot be concatenated Troublesome for Herarchcal transforms Interactve, ncremental dspla R n ( R3( R2( R T T2 T3 T n

Homogeneous Coordnates consstent representaton for all three can be concatenated & pre-computed (, ( w, w, w, w ( w, w, w ( w / w, w / w

' T ' T ' cos sn ' sn cos ' S ' S ' ' ( TRS

How about other transforms? For eample, reflecton Mrrored mages of each other

Tr to represent the new transform as a composte of T, R, S ( tan cos sn sn cos a b, ( b a ( tan cos sn sn cos a b

Clppng Aganst Uprght Rectangular Wndow onts f & mn ma mn ma then accept otherwse reject

Clppng Aganst Uprght Rectangular Wndow boundar wndow of ponts end : ', ',( ', ' ( lne of ponts end :,,(, ( ', ' ' ( ' ' ( ' ' ( ' ' ( 2 2 2 2 2 2 2 2 t t t t t t Lnes trvall accepted f both end ponts nsde otherwse onts

Cohen-Sutherland Lne-Clppng Algorthm mn ma ma mn Outcodes bt --above: ma- bt2 --below: -mn bt3 --rght of: ma- bt4 --left of: -mn

Trvall-accept: both end ponts havng outcode Trvall-reject: correspondng bts n two outcodes are set, or outcode & outcode2 nonzero

Nether: need more testng E.g. md-pont algorthm dvde a lne segment nto two lne segments (,,(( / 2,( / 2 test each lne ndependentl recursve dvson f necessar (,,( 2, 2 2 2 (( / 2,( / 2,(, 2 2 2 2 guarantee to stop n O(logn steps

Crus-Beck (Lang-Bask Lne Clppng Can be more effcent when ntersecton tests are unavodable Work n the parameter (t space to locate true ntersectons before calculatng 2D coordnates Work for all knds of clppng polgons and n 3D Two basc steps: fnd ntersectons (t classf ntersectons

Fnd ntersectons c b a, ( b a N o (t E ( ( E t N ( ( E t N ( ( E t N ( ( ( ( ( ( ( ( o E o E o o E o o E N N t N N t t N t N Crus-Beck (Lang-Bask Lne Clppng

Intersectons outsde (, range are not vald But ntersecton nsde (, range mght not be vald ether

Crus-Beck (Lang-Bask Lne Clppng Classf ntersectons N N ( ( o o E (potental l enterng L (potental l leavng N N

Locate the largest E pont & t> Locate the smallest L pont & t< E E < L for a vald lne L L L E L E E

olgon Clppng (Sutherland-Hodgman Gven an ordered sequence of polgon vertces And a conve clppng polgon Output ordered clpped polgon vertces Usng dvde-and-conquer, one clppng edge at a tme

IN OUT IN OUT IN OUT IN OUT

6 2 4 2 5 4 3 3 Orgnal Rght boundar clppng

7 7 6 6 5 8 5 2 3 4 2 3 4 Bottom boundar clppng Left boundar clppng

7 6 5 8 9 4 3 2 Top boundar clppng

Other rmtves Use of etents (etents for a whole strng, words, ndvdual characters Dvde and Conquer