how to get a perfect score
DESCRIPTION
How to get a perfect score. By Johnny Ho. Why get a perfect score?. Free Gold Medal Pride Beat Gennady Korotkevich 2009-2011: 1st place 2012: 2nd place Fame Get Interviewed Get mentioned at rallies (but don't go and play frisbee outside instead) GIRLS - PowerPoint PPT PresentationTRANSCRIPT
How to get a perfect score
By Johnny Ho
Why get a perfect score?
• Free Gold Medal• Pride
o Beat Gennady Korotkevich 2009-2011: 1st place 2012: 2nd place
• Fameo Get Interviewedo Get mentioned at rallies (but don't go and play frisbee outside
instead)
• GIRLSo Many, many girls will be gazing at your face all dayo You will need a priority queue to handle them allo Johnny Ho has many many girls.
Computer graphics
the actual meeting topic
How to draw a point
• Fill in a pixel:
• *applause*
How to draw on an LCD screen
• Most LCDs come with three channels• Mix the red, green, and blue channels to make
colors
How to draw a line segment
• Imagine the bounding box of the line segment• Take the maximum of the two dimensions• Sweep across that dimension and fill in the
corresponding pixel
• To be lazy, first decompose into triangles• How to draw a triangle:
o Sweep across y coordinate and fill in points that lie within left and right intersection
o Round x coordinates properly to avoid aliasing
How to draw a polygon
• Remember this?• Take advantage of subpixel structure• Calibri 8pt, zoomed in:
o Microsoft ClearType
• ~3x horizontal resolution• Variation in color is largely undetectable by
human eye
How to draw text (very trickily)
How to draw a 3d object
• Again, first decompose into triangles• Give each triangle a color depending on angle
towards light source• How to draw a 3D triangle:• Apply a perspective transformation
o Basically, just divide x and y coordinates by z coordinate to obtain x' and y' coordinates
o Then draw 2d triangle
Demo
• Link• [code not included because of ugliness]• Z-buffering
o Save Z coordinate as well as actual colorso Determine which pixels of the object are closer to camera
• Interpolationo Interpolate between the three points of each triangle to improve
smoothness
Phong shading
• Adds a specular layer• Previously named techniques only incorporate
diffuse• Results in plastic texture
Shadow maps
Soft shadows
Raytracing
Credits to http://users.softlab.ntua.gr/~ttsiod/renderer.html for his amazing renderer/raytracer
Solution to last week's PotWFind # common factors = # factors of gcd
int ans=0, g=gcd(n, m);for(int i=1;i*i<=g;i++) {if(g%i==0) {
ans+=2;if(i*i==g) ans--;}
}return ans;
public int gcd(int a, int b) {return b==0 ? a : gcd(b, a%b);}
PotW
• Go home and search up more awesome computer graphics stuff! :D
• (no, you don't actually get points for this)