DGI/SUDOA Diverse grundbegrepp. Translation. Linjens ekvation. Linjens ekvation. Linjens ekvation

Relevanta dokument
Module 1: Functions, Limits, Continuity

Pre-Test 1: M0030M - Linear Algebra.

ASSEMBLY INSTRUCTIONS SCALE SQUARE - STANDARD

12.6 Heat equation, Wave equation

denna del en poäng. 1. (Dugga 1.1) och v = (a) Beräkna u (2u 2u v) om u = . (1p) och som är parallell

Isometries of the plane

Tentamen i Matematik 2: M0030M.

1. Compute the following matrix: (2 p) 2. Compute the determinant of the following matrix: (2 p)

Preschool Kindergarten

ASSEMBLY INSTRUCTIONS SCALE CIRCLE - STANDARD

Support Manual HoistLocatel Electronic Locks

Exempel på uppgifter från 2010, 2011 och 2012 års ämnesprov i matematik för årskurs 3. Engelsk version

and u = och x + y z 2w = 3 (a) Finn alla lösningar till ekvationssystemet

Module 6: Integrals and applications

1. Varje bevissteg ska motiveras formellt (informella bevis ger 0 poang)

Tentamen MMG610 Diskret Matematik, GU

This exam consists of four problems. The maximum sum of points is 20. The marks 3, 4 and 5 require a minimum

Tentamen i Matematik 3: M0031M.

Styrteknik: Binära tal, talsystem och koder D3:1

Module 4 Applications of differentiation

Svenska()(Bruksanvisning(för(handdukstork()(1400(x(250(mm(

(D1.1) 1. (3p) Bestäm ekvationer i ett xyz-koordinatsystem för planet som innehåller punkterna

Second handbook of research on mathematics teaching and learning (NCTM)

ASSEMBLY INSTRUCTIONS SCALE - SYSTEM

STORSEMINARIET 3. Amplitud. frekvens. frekvens uppgift 9.4 (cylindriskt rör)

Algoritmer och Komplexitet ht 08. Övning 6. NP-problem

NP-fullständighetsbevis

Kvalitetsarbete I Landstinget i Kalmar län. 24 oktober 2007 Eva Arvidsson

Innehållsförteckning

LUNDS TEKNISKA HÖGSKOLA Institutionen för Elektro- och Informationsteknik

Rastercell. Digital Rastrering. AM & FM Raster. Rastercell. AM & FM Raster. Sasan Gooran (VT 2007) Rastrering. Rastercell. Konventionellt, AM

Grafiska pipelinen. Edvin Fischer

och v = 1 och vektorn Svar 11x 7y + z 2 = 0 Enligt uppgiftens information kan vi ta vektorerna 3x + 2y + 2z = 1 y z = 1 6x + 6y + 2z = 4

Beijer Electronics AB 2000, MA00336A,

Information technology Open Document Format for Office Applications (OpenDocument) v1.0 (ISO/IEC 26300:2006, IDT) SWEDISH STANDARDS INSTITUTE

Quicksort. Koffman & Wolfgang kapitel 8, avsnitt 9


Rep MEK föreläsning 2

Graphs (chapter 14) 1

Studieteknik för universitetet 2. Books in English and annat på svenska

Problem som kan uppkomma vid registrering av ansökan

Kurskod: TAMS28 MATEMATISK STATISTIK Provkod: TEN1 05 June 2017, 14:00-18:00. English Version

Exempel på uppgifter från års ämnesprov i matematik för årskurs 3. Engelsk version

F ξ (x) = f(y, x)dydx = 1. We say that a random variable ξ has a distribution F (x), if. F (x) =

Om oss DET PERFEKTA KOMPLEMENTET THE PERFECT COMPLETION 04 EN BINZ ÄR PRECIS SÅ BRA SOM DU FÖRVÄNTAR DIG A BINZ IS JUST AS GOOD AS YOU THINK 05

Grundläggande datalogi - Övning 3

Solutions to exam in SF1811 Optimization, June 3, 2014

LARS. Ett e-bokningssystem för skoldatorer.

Högskolan i Skövde (SK, JS) Svensk version Tentamen i matematik

Schenker Privpak AB Telefon VAT Nr. SE Schenker ABs ansvarsbestämmelser, identiska med Box 905 Faxnr Säte: Borås

Ett hållbart boende A sustainable living. Mikael Hassel. Handledare/ Supervisor. Examiner. Katarina Lundeberg/Fredric Benesch

2(x + 1) x f(x) = 3. Find the area of the surface generated by rotating the curve. y = x 3, 0 x 1,

Adding active and blended learning to an introductory mechanics course

Grafer, traversering. Koffman & Wolfgang kapitel 10, avsnitt 4

8 < x 1 + x 2 x 3 = 1, x 1 +2x 2 + x 4 = 0, x 1 +2x 3 + x 4 = 2. x 1 2x 12 1A är inverterbar, och bestäm i så fall dess invers.

x 2 2(x + 2), f(x) = by utilizing the guidance given by asymptotes and stationary points. γ : 8xy x 2 y 3 = 12 x + 3

HYDRAULIK Rörströmning IV

Övning 3 - Tillämpad datalogi 2012

Övning 5 ETS052 Datorkommuniktion Routing och Networking

DVG C01 TENTAMEN I PROGRAMSPRÅK PROGRAMMING LANGUAGES EXAMINATION :15-13: 15

Transformationer i R 2 och R 3

Thesis Production Time plan, preparation and Word templates

Tentamen del 2 SF1511, , kl , Numeriska metoder och grundläggande programmering

SVENSK STANDARD SS :2010

Calculate check digits according to the modulus-11 method

Lektion 3. Anteckningar

Pedagogisk planering. Ron Chlebek. Centralt Innehåll. Svenska/Engelska. Lego Mindstorms. Syfte: Matematik

6 th Grade English October 6-10, 2014

DGI/SUDOA Den historiska utvecklingen. Globala - lokala belysningsmodeller. Lokala belysningsmodeller. Rendering equation

FÖRBERED UNDERLAG FÖR BEDÖMNING SÅ HÄR

f(x) =, x 1 by utilizing the guidance given by asymptotes and stationary points. cos(x) sin 3 (x) e sin2 (x) dx,

Authentication Context QC Statement. Stefan Santesson, 3xA Security AB

Flervariabel Analys för Civilingenjörsutbildning i datateknik

ASSEMBLY INSTRUCTIONS

Klippning i 2D: Cohen-Sutherland. Implementation aspects for display of computer graphics

Kurskod: TAMS11 Provkod: TENB 28 August 2014, 08:00-12:00. English Version

Ren Katt. Författare Deepa Balsavar Illustratör Kanchan Bannerjee. Översatt av Bokkok.se

1. Unpack content of zip-file to temporary folder and double click Setup

1. Find for each real value of a, the dimension of and a basis for the subspace

LÄNKHJUL S3. Monteringsanvisning för: Länkhjul S3

Windlass Control Panel v1.0.1

Förskola i Bromma- Examensarbete. Henrik Westling. Supervisor. Examiner

Measuring void content with GPR Current test with PaveScan and a comparison with traditional GPR systems. Martin Wiström, Ramboll RST

PRESS FÄLLKONSTRUKTION FOLDING INSTRUCTIONS

Lösningar till tentan i SF1861 Optimeringslära, 1 juni 2017

Grafisk teknik IMCDP IMCDP IMCDP. IMCDP(filter) Sasan Gooran (HT 2006) Assumptions:

1. Find an equation for the line λ which is orthogonal to the plane

Provlektion Just Stuff B Textbook Just Stuff B Workbook

Syfte Eleverna får läsa enkla texter och visa sin förståelse genom att rita lösningen.

Vi målar! Författare Cheryl Rao Illustratör Tanvi Choudhury

Kurskod: TAIU06 MATEMATISK STATISTIK Provkod: TENA 15 August 2016, 8:00-12:00. English Version

Workplan Food. Spring term 2016 Year 7. Name:

2. Find, for each real value of β, the dimension of and a basis for the subspace

Mer om geometriska transformationer

Accomodations at Anfasteröd Gårdsvik, Ljungskile

HYDRAULIK Rörströmning IV

Writing with context. Att skriva med sammanhang

Chapter 2: Random Variables

1. Find the 4-tuples (a, b, c, d) that solves the system of linear equations

Annonsformat desktop. Startsida / områdesstartsidor. Artikel/nyhets-sidor. 1. Toppbanner, format 1050x180 pxl. Format 1060x180 px + 250x240 pxl.

Transkript:

DGI/SUDOA - 060324 Följande hann jag inte gå igenom: detaljer i clip-algoritmer, Warnocks algortim, bilderna efter småuppgift nr 3. Some fundamental concepts Transformations Hidden surface elimination Två småuppgifter till denna lektion om 2p resp 3p vardera. Det kommer att behövas 25p för att få betyget 3/G på tentan. Diverse grundbegrepp Vektorer, ekvationer för linje och plan Matriser och transformationer Konvexa och konkava objekt Objektrum - bildrum Jag kommer inte lämna annan feedback än att man blir godkänd eller inte på småuppgifterna. Linjens ekvation Linjens ekvation L P P 0 P 0 P n (P - P 0 ) o n = 0 d = (P - P 0 ) o n P = P 0 + k L Gäller också plan d = avståndet till linjen, tecknet avgör vilken sida vi är på Linjens ekvation Translation t=1 x = x + t x y = y + t y P 1 t=0 P 0 P(t) = P 0 + t*(p 1 - P 0 ) 1

x = Sx * x y = Sy * y Skalning x = x*cosθ - y*sinθ y = x*sinθ + y*cosθ Rotation Homogena koordinater P =T*P Man lägger till en dimension (x,y) representeras med (x,y,1) Tredje komponenter ska alltid vara 1, annars normerar man: (x,y,a) <--> (x/a, y/a, 1) - detta är samma punkter Detta gör det möjligt att få de tre grundtransformationerna på samma form P =R*P P =S*P Sammansättning av transformationer Transformationer kan nu sättas samman med multiplikationer Rotation kring punkt Flytta till origo Rotera Flytta tillbaka Exempel: rotation kring en given punkt 2

Flytta till origo Rotera T(x r,y r )*R(θ)*T(-x r,-y r )*P Flytta tillbaka 3D transformationer Man lägger väsentligen bara till en dimension till P =R z (θ)*p P =R x (θ)*p P =T*P P =R y (θ)*p Spegling och skjuvning (shear) P =S*P 3

Småuppgift nr 2 Diskutera med bänkgrannen - Hur kan spegling och skjuvning (shear) uttryckas i de tre grundtransformationerna (det räcker med att behandla 2D) Transformationer i modellering - Skicka din lösning (svara med matriser och förklarande text) till mig, lassekj@nada.kth.se, senast 060330 som word eller pdf-fil - Värde på tentan: 2p Projektioner Ortogonal projektion Ortogonala (parallella) Perspektiviska Perspektivisk projektion z p = d x p = x*d/z 4

Konvexa och konkava objekt Konvexa och konkava objekt Konvexa och konkava objekt Objektrum och bildrum Objektrum Man arbetar den matematiska beskrivningsnoggrannheten Det blir antalet objekt som avgör komplexiteten Bildrum Man arbetar med den noggrannhet som ges bildpunkterna (pixlarna) Det blir upplösningen som avgör komplexiteten Alla vinklar <180 Vinklar kan vara >180 Implementation of graphics systems Chapter 7 in the book by Angel To implement a system like OpenGL we need fundamentals algorithms for things like: line clipping polygon clipping hidden surface removal line drawing polygon filling antialiasing Implementation aspects Steps in the rendering process: Modeling (definition of objects, e.g. a structure with polygons) Geometric processing (coordinate transformations, clipping, hidden surface elimination) Rasterization (transformation of object descriptions to pixels) Display (display of frame buffer on screen, includes e.g. aliasing) We will focus on some common algorithms in this process 5

The clipping problem The clipping problem window window lines lines clipped Pipeline clipping Cohen-Sutherland's clip algorithm To clip a line between A and B: while NOT done { CompOutCode(A); CompOutCode(B); IF A bitwise_or B == 0 THEN {inside; done=true ELSE IF A bitwise_and B =/= 0 THEN {outside; done=true ELSE intersect(a,b,outsideedge); ; 1001 0001 0101 1000 1010 0000 0010 0100 0110 Parameter clipping (Cyrus-Beck, Liang-Barsky) Use p(α) = (1- α)*p1 + α *p2 Clipping is done by first calculating α for lines that you might clip (less work than to calculate both x and y) To clip with the egde x=xmin we get: α =(xmin-x1)/(x2-x1) α1=0; α2=1; for (all four edges of window) { P1 α =calculate(edgenr); if entering(edgenr) α1 =max(α1,α) else α2 =min(α2,α); if α2 > α1 then drawline(α1, α2); P2 Polygon clipping Can we use the line clipping algorithm to clip a polygon? new point With line clipping the new point could not be included 6

Sutherland-Hodgeman's algorithm Sutherland-Hodgeman's algorithm Clip top s p Clip right Clip left Clip bottom Note that in each clipping phase of the polygon you have to keep the order of the vertices for all_window_edges { p=polypoint(1); for n=2 to n+1 { s=p; p=polypoint(n); if inside(s) and inside(p) then save(p); if inside(s) and outside(p) then save(intersect(s,p)); if outside(s) and inside(p) then {save(intersect(s,p)); save(p) update(polypoint); What happens if the clipping give more than one polygon? Hidden surface removal Two main approaches: investigate visibility for every pixel, i.e. resolution dependent (image space) investigate visibility for every object, i.e. calculate intersections etc for all objects, lines etc with the precision of the computer (object space) Main ideas Try to use the properties the objects, such as: convex objects? few objects, perhaps only one object? objects non intersecting? static view? advanced rendering wanted? 7

Back-face removal Image space hidden surface removal The back-facing polygons can be removed through a simple test abs (θ) < 90 or n o v > 0 n! v eye Z-buffer algorithm Use an extra buffer with depth values for each pixel for every polygon { for each pixel in polygom { if newpolygondepth(x,y) < depthval_in_zbuffer(x,y) then {depthval_in_zbuffer(x,y) <- newpolygondepth(x,y); framebuffervalue <- newpolygonvalue framebuffer Z-buffer framebuffer Z-buffer framebuffer Z-buffer Depth sort algorithm 1. Sort all object according to depth 2. Paint them into frame buffer in the sorted order (start with object far away) increasing depth Depth sort algorithm one problem 8

BSP algorithm, sorting in a BSP tree Divide the space using half planes. Basic idea object2 object3 Objects on one side of the plane belongs to one child in tree and the the objects on the other side belongs to the second child. object1 Divide the space once more and repeat the division process with a new set of children nodes. Draw object3 Draw object2 Draw object1 Basic idea object2 object3 object1 Draw object1 Draw object2 Draw object3 James, Day, CGF 17/1 void Draw_BSP_Tree (BSP_tree *tree, point eye) { if (result > 0) { Draw_BSP_Tree (tree->back, eye); tree->polygons.draw_polygon_list (); Draw_BSP_Tree (tree->front, eye); else if (result < 0) { Draw_BSP_Tree (tree->front, eye); tree->polygons.draw_polygon_list (); Draw_BSP_Tree (tree->back, eye); else // result is 0 { // the eye point is on the partition plane... Draw_BSP_Tree (tree->front, eye); Draw_BSP_Tree (tree->back, eye); Warnock algorithm Divide the plane into four squares 9

Småuppgift nr 3 Prata med bänkgrannen - Beskriv kortfattat varsin algoritm för att ta bort skymda ytor för varandra. Hitta på ett eget sätt att beskriva (med ord och figur) Line drawing (x2,y2) - Beskriv tre algoritmer inkl en figur för att ta bort skymda ytor utan att kopiera mina eller någon annans text/figurer. - Skicka din lösning till mig, lassekj@nada.kth.se, senast 060330 som word eller pdf-fil - Värde på tentan: 3p (x1,y1) A line between two points have two be represented as a set of dots (pixels) in the raster Simple solution (x1,y1) Line drawing (x2,y2) line(x1,y1,x2,y2,value) { int x; float dx,dy,y,m; dy=y2-y1; dx=x2-x1; m=dy/dx; y=y1; for (ix=x1; ix<=x2; ix++) { y+=m; write_pixel(ix, Round(y),line_color); This works for m < 1 What can be do if m > 1? Drawback: includes float and division 10

(x p,y p ) Solution with integer arithmetic (alternative to the book, we don t go into the details at the lecture) d1 NE M E d2 Line equation can be written as F(x,y)=dy*x-dx*y+B*dx=0 The sign of F(x M,y M ) decides if we should choose E or NE We denote d1=f(x M,y M )= dy*(x p +1)-dx*(y p +0.5)+B*dx Suppose we get d1<0, choose E d2=f(x M +1,y M )= dy*(x p +2)-dx*(y p +0.5)+B*dx= d1+dy Similar result if d1>=0 New algorithm with integer arithmetic MidpointLine(x0,y0,x1,y1,value) { int x,y,dx,dy,d,incre,incrne; dy=y1-y0; dx=x1-x0; d=2*dy-dx; incre=2*dy; incrne=2*(dy-dx); x=x0; y=y0; WritePixel(x,y,value); while (x<x1) { if (d<=0) { d+=incre; x++; else { d+=incrne; x++; y++; WritePixel(x,y,value); Further improvements Scan conversion of a polygon (Polyfill) Take two points in each step The first and last pattern can not both appear for the same line j x1 x2 x3 x4 Use the symmetry around the middle point of the line: take identical steps (except sign) from startpoint and endpoint j + 1 x5 x6 j + 2 x7 x8 Polyfill setup_edgetables; y=min_yentry(et); AET=empty; while not(aet=empty and ET=empty) { insert_new_edges(y,et,aet); sort(aet); fill_scanline(y); for all_lines_in_aet {if y=ymax then remove(line,aet); y=y+1; for all_lines_in_aet {x=x-1/m; This algorithm can be extended to perform hidden surface removall 11