DOC PREVIEW
GT LCC 6310 - Shapes, Rockets, Mice, Cookies and Random Stuff

This preview shows page 1-2-3-19-20-38-39-40 out of 40 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 40 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 40 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 40 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 40 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 40 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 40 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 40 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 40 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 40 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Computation as an Expressive Computation as an Expressive MediumMediumMediumMediumLab Lab 33: Shapes, : Shapes, Rockets, MiceRockets, Mice, , Cookies and Random StuffCookies and Random StuffJoshua CuneoJoshua CuneoJoshua CuneoJoshua CuneoAgenda TimeAgenda TimeggProjectProject11Project Project 11 Array Loops, PImage, FontsArray Loops, PImage, FontsDi lDi lDrawing polygonsDrawing polygons Trigonometry reviewTrigonometry review random()random()Methods and objectsMethods and objectsMethods and objectsMethods and objects Mouse functions (again)Mouse functions (again)22 Assignment Assignment 22!!ProjectProject11Project Project 11From the central heartbeat of the central From the central heartbeat of the central processor, to the obsessive timestamping of files processor, to the obsessive timestamping of files dbl l kd ldbl l kd land blog entries, to ever present clock displays, and blog entries, to ever present clock displays, time is a fundamental feature of computation. time is a fundamental feature of computation. Display the progress of time in a nonDisplay the progress of time in a non--traditionaltraditionalDisplay the progress of time in a nonDisplay the progress of time in a nontraditional traditional way. It is OK to consider large temporal scales way. It is OK to consider large temporal scales (e.g. seasons), but smaller temporal scales (e.g. seasons), but smaller temporal scales should also be displayed (or be available to be should also be displayed (or be available to be displayed, perhaps as a function of user input). displayed, perhaps as a function of user input). You may make use of mouse input if you wishYou may make use of mouse input if you wishYou may make use of mouse input if you wish.You may make use of mouse input if you wish.Debugging TipsDebugging Tipsgg g pgg g p CommentingCommenting println()println()TracingTracinggg Common errorsCommon errors SemicolonsSemicolons Parentheses and bracesParentheses and braces Speling erorzSpeling erorz Program arrangementProgram arrangement Variable declarationVariable declarationt()t() setup()setup()  draw()draw()Array LoopsArray LoopsArray LoopsArray Loops90 150 300 1 2for(int i = 0; i < numbers.length; i++){numbers[i] =3;numbers[i] = 3;}Array LoopsArray LoopsArray LoopsArray Loops90 150 300 1 2for(int i = 0; i < numbers.length; i++){numbers[i] =3;numbers[i] = 3;}Array LoopsArray LoopsArray LoopsArray Loops3 150 300 1 2for(int i = 0; i < numbers.length; i++){numbers[i] =3;numbers[i] = 3;}Array LoopsArray LoopsArray LoopsArray Loops150 3030 1 2for(int i = 0; i < numbers.length; i++){numbers[i] =3;numbers[i] = 3;}Array LoopsArray LoopsArray LoopsArray Loops33030 1 2for(int i = 0; i < numbers.length; i++){numbers[i] =3;numbers[i] = 3;}Array LoopsArray LoopsArray LoopsArray Loops33030 1 2for(int i = 0; i < numbers.length; i++){numbers[i] =3;numbers[i] = 3;}Array LoopsArray LoopsArray LoopsArray Loops3330 1 2for(int i = 0; i < numbers.length; i++){numbers[i] =3;numbers[i] = 3;}PImagePImagePImagePImage1.1. Bring the image into ProcessingBring the image into ProcessingPIttkldI ("ttkj")PImage startrek = loadImage("startrek.jpg"); 2.2. Load the image to our canvasLoad the image to our canvasimage(startrek, 0, 0);FontsFontsFontsFontsCreate a font on the flyCreate a font on the flyCreate a font on the flyCreate a font on the flyPFont verdana = createFont("Verdana”, 32); OR Import a .vlw fileOR Import a .vlw filePfont tng = loadFont("tng-32.vlw"); Use the fontUse the fonttextFont(tng);text("To Boldly Go", 10, 30);Getting Ready for Assignment Getting Ready for Assignment 22BildingPolgonsBildingPolgonsBuilding PolygonsBuilding Polygons beginShape(POLYGON);beginShape(POLYGON); Start the polygonStart the polygon vertex(x, y);vertex(x, y); One per vertex pointOne per vertex point endShape();endShape(); Finish the polygonFinish the polygon…BildingPolgonsBildingPolgonsBuilding PolygonsBuilding Polygons beginShape(POLYGON);beginShape(POLYGON);vertex(vertex(10105050););vertex(vertex(1010, , 5050););BildingPolgonsBildingPolgonsBuilding PolygonsBuilding Polygons vertex(vertex(2020, , 1010););vertex(vertex(30304040););vertex(vertex(3030, , 4040);); vertex(vertex(8080, , 6060););t(t(40408080)) vertex(vertex(4040, , 8080););BildingPolgonsBildingPolgonsBuilding PolygonsBuilding Polygons endShape();endShape();Let’s Use A a sLet’s Use A a sLet’s Use ArraysLet’s Use Arraysint[] xvals = {10, 20, 30, 80, 40};int[] yvals = {50, 10, 40, 60, 80};beginShape(POLYGON);for(int i0;i<xvals length; i++)for(int i = 0; i < xvals.length; i++) {vertex(xvals[i], yvals[i]);}endShape();WTF?WTF?TrigTrig101101Trig Trig 101101hsin(Θ) = opphopphyphypcos(Θ) adjΘoppcos(Θ) = adjhypΘdjtan(Θ) = oppadjadjadjSo What?So What?So What?So What?So What?So What?So What?So What?Working ExampleWorking ExampleWorking ExampleWorking Examplecos(Θ) = adjhyp5 feetcos(60°) = adj560°55*cos(60°)=adj605cos(60) adjadj=25???adj 2.5Working ExampleWorking ExampleWorking ExampleWorking Exampleint x = 0;5 feetInt y = 0;void draw()(){x = x + 5*cos(60);y=y+5*sin(60);60°y y 5sin(60);}A Pox on RadiansA Pox on RadiansA Pox on RadiansA Pox on Radiansint x = 0;Int y = 0;void draw()(){x = x + 5*cos(radians(60));y=y+5*sin(radians(60));y y 5sin(radians(60));}random()random()random()random()float r = random(float r = random(00, , 55););00005500..5522..332277677622..77677633..7543929754392944999999999999999999999999999944..9999999999999999999999999999……random()random()random()random()int int r = r = int(random(int(random(00, , 55));));003333225555445555random()random()random()random()Name some usesName some usesMethods aka F nctionsMethods aka F nctionsMethods, aka FunctionsMethods, aka FunctionsMthdd l tiMthdd l tiMethod declarationMethod declarationvoid meansparametervoid vendingMachine( int coinCents )void means doesn't return anything{println("You inserted "+coinCents+" cents."); }Method callMethod callMethod callMethod callint quarter = 25;vendingMachine(quarter);argumentg(q);ClassesClassesClassesClassesClasses aka Bl ep intsClasses aka Bl ep intsClasses, aka BlueprintsClasses, aka Blueprintsclass MyToy{//fi ld(l ibl )// fields(class variables)// methods (class functions)


View Full Document

GT LCC 6310 - Shapes, Rockets, Mice, Cookies and Random Stuff

Documents in this Course
Load more
Download Shapes, Rockets, Mice, Cookies and Random Stuff
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Shapes, Rockets, Mice, Cookies and Random Stuff and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Shapes, Rockets, Mice, Cookies and Random Stuff 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?