This preview shows page 1. Sign up to view the full content.
Unformatted text preview: d = d/2; Xeno.m x = 0;
d = 1;
for k = 1:20
DrawDisk(x+d/2,0,d/2,'y')
x = x+d;
d = d/2;
end
Insight Through CompuJng • Shouldn’t we see 20 disks? • Since screen is a grid of dots – called pixels • As disks get smaller they don’t get drawn correctly (how could they?) • The 20th disk has radius < .000001 • Mac ReJna = 2560x1600 – Awesome! • Zooming “in” shows eﬀect of storing image/
screen data as discrete grid • PixilaJon, Jaggies, etc. – SJll “not enough” (never enough) 3 2/20/14 Some Physical Pixels Color • Color of these pixel are determined by the amount of red (R) green (G) and blue (B) they produce – RGB are primary colors when working with light (addiJve mixing) ~ Cyan Magenta Yellow paint – Using RGB you can create any color you like They are so small, that at the “usual” distance your eyes just see dots. Color Finiteness • Matlab allows you to specify color using a an RGB vector, [r g b], 0<= r,g,b <=1 – E.g., DrawDisk(0,0,10, [1 .4 .7]) gives a pink disk It shows up all over the place in compuJng. • Computer displays are limited in terms of how many RGB combinaJons they can display (more discreteness!) – Eg. 24 bit color => 2^24 colors available • 256 reds x 256 blues x 256 greens colors Insight Through CompuJng 4 2/20/14 Plovng ConJnuous FuncJons Can only display a bunch of dots Another “collision” between the inﬁnite and the ﬁnite. (More later.) Insight Through CompuJng The Discrete Display of Sine N = 100;
X_spacing = 4*pi/N;
Dot_radius = X_spacing/3;
for k=0:N
x = k*X_spacing;
y = sin(x);
DrawDisk(x,y,Dot_Radius,'r')
end
Insight Through CompuJng The Moral To produce realisJc plots/renderings you must appreciate screen granularity. Insight Through CompuJng Similar Finite “Behavior” with Computer ArithmeJc As discussed before • Memory hardware is ﬁnite. • Computer cannot explicitly store never ending decimals like pi, sqrt(2), 1/3 Remark • Symbolic math systems – Store “descripJons” of numbers and have rules for manipulaJng the descripJons. Great for short calculaJons, but does not work for long calculaJons (the descripJons get too long) Insight Through Comp...
View
Full
Document
This document was uploaded on 03/11/2014 for the course CSCI 004 at Brown.
 Spring '14
 Potter

Click to edit the document details