32 Pages

CS1114-lec12

Course: CS 100, Fall 2008
School: Cornell
Rating:
 
 
 
 
 

Word Count: 856

Document Preview

CS1114 Polygonsandtheconvexhull Prof.NoahSnavely http://cs1114.cs.cornell.edu Administrivium Assignment3duethisFridayby5pm PleasesignupforslotsonCMS Thelastproblemhasyoucontrollingtherobots withthecamera;youllneedtousethe robotGetFrame function 2 Fishandgraphs Havetofindahomefornfish Someofthefishwouldeachotherfish Howdoweknowhowmanytankstoorder? 3 Fishandgraphs:Solution1...

Register Now

Unformatted Document Excerpt

Coursehero >> New York >> Cornell >> CS 100

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
CS1114 Polygonsandtheconvexhull Prof.NoahSnavely http://cs1114.cs.cornell.edu Administrivium Assignment3duethisFridayby5pm PleasesignupforslotsonCMS Thelastproblemhasyoucontrollingtherobots withthecamera;youllneedtousethe robotGetFrame function 2 Fishandgraphs Havetofindahomefornfish Someofthefishwouldeachotherfish Howdoweknowhowmanytankstoorder? 3 Fishandgraphs:Solution1 Everyfishisavertex,eachpairofconflictingfish isanedge Tuna Tiger shark Gupp y Walley e Acoloringofthegraphgivesyouavalid assignmentoffishtotanks 4 Fishandgraphs:Solution2 Everyfishisavertex,eachpairofcompatible fishisanedge Tuna Tiger shark The complement of the previous graph Gupp y Walley e Acliqueinthegraphcanbeassignedtothe sametank 5 Cliques Asetofnodesinagraphthatareallconnected 6 Doesitmakesense? tofindthemedianateachstageofquicksort? Yesandno: Foreachsubarray(ofsizen),wealreadydoO(n)workto partitionthatsubarray. WecanfindthemedianinO(n)time(expected) FindingthemediandoesntincreasethebigOrunningtimefrom O(nlogn) Usuallyslowsthingsdowninpractice 7 Doesitmakesense? FromWikipedia: 8 O(n)vs.O(n2) AlgorithmXisO(n),algorithmYisO(n2) XwilleventuallycatchuptoY butwedontknowwhen n=1,000,000,000mightnotbelargeenough (seebubblesort) (butusuallywillbe) 9 Introspectionsort function S = introsort(A) n = length(A); if n < 2000 S = bubblesort(A); else S= quicksort(A); end 10 Findingthelightstickcenter 1. 2. 3. 4. Thresholdtheimage Findblobs(connectedcomponents) FindthelargestblobB ComputethemedianvectorofB 11 Findingthelightstickcenter Butwealsowanttocontroltherobotbasedon theorientationofthelightstick 12 Findingthelightstickcenter Sofarweveonlybuiltfunctionsthattakeasetof pointsandreturnanotherpoint Withoneexception Howcanweexpresstheshapeofthelightstick? 13 Findingthelightstickcenter Welltrytocomeupwith asimplepolygonto describethelightstick Simplestpolygon:the boundingbox 14 Boundingbox Notasinformativeaswemightlike Letscomeupwithapolygonthatfitsbetter 15 Detour:convexpolygons ApolygonPisconvexif,foranytwopointsA,B insideP,allpointsonalineconnectingAandB Whichpolygonsareconvex? 2 arealsoinsideP B A 16 Convexpolygons 1 4 17 3 Testingconvexity HowcanwetestifapolygonPisconvex? Considerthesmallestconvexpolygoncontaining P CalledtheCONVEXHULL WhatistheconvexhullifPisconvex? 18 Convexhull Canalsodefineforsetsof2Dpoints:the smallestconvexshapecontainingasetof2D points from http://en.wikipedia.org/wiki/Convex_hull 19 Convexhullofpointsets Wecanusethistofindasimpledescriptionof thelightsticksshape http://www.cs.princeton.edu/~ah/alg_anim/version1/ConvexHull.html Howcanwecomputetheconvexhull? 20 Computingconvexhulls Idea:twopointsareanedgeintheconvexhullif ___________________ 21 Computingconvexhull Whichtwohorizontallinestouchpointsontheconvex hull? Whichtwoverticallines? Itiseasytoidentifyatleastfourpointsthatarepartof theconvexhull 22 Giftwrappingalgorithm 1. Startatlowestpoint 2. Rotatethelineuntilwehit anotherpoint Allotherpointswilllieonone sideofthisline Lookforthepointthatgives youthelargestanglewiththe currentline 3. Repeat 4. Youredonewhenyouget backtothestartingpoint Figurecredit:CraigGotsman 23 Thedetails... 1. Startatlowestpoint 2. Rotatethelineuntilwehit anotherpoint Allotherpointswilllieonone sideofthisline Lookforthepointthatgives youthelargestanglewiththe curre...

Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

Cornell - CS - 100
Polygons and the convex hullProf. Noah Snavely CS1114 http:/cs1114.cs.cornell.eduAdministriviumAssignment 3 due this Friday by 5pm Please sign up for slots on CMS The last problem has you controlling the robots with the camera; you'll need to
Cornell - CS - 100
InterpolationProf. Noah Snavely CS1114 http:/cs1114.cs.cornell.eduAdministrivia Assignment 3 due tomorrow by 5pm Please sign up for a demo slot Assignment 4 will be posted tomorrow Quiz 3 next Thursday2Last time Convex hull the smalles
Cornell - CS - 100
InterpolationProf. Noah Snavely CS1114 http:/cs1114.cs.cornell.eduAdministriviaAssignment 3 due tomorrow by 5pm Please sign up for a demo slotAssignment 4 will be posted tomorrow Quiz 3 next Thursday2Last timeConvex hull the smallest co
Cornell - CS - 100
Image transformationsProf. Noah Snavely CS1114 http:/cs1114.cs.cornell.eduAdministrivia Assignment 4 will be out by tomorrow Due the Friday after spring break Quiz 3 next time Topics: convex hull, interpolation, image transformations2L
Cornell - CS - 100
Image transformationsProf. Noah Snavely CS1114 http:/cs1114.cs.cornell.eduAdministriviaAssignment 4 will be out by tomorrow Due the Friday after spring breakQuiz 3 next time Topics: convex hull, interpolation, image transformations2Last
Cornell - CS - 100
Imagetransformations,Part2Prof.NoahSnavely CS1114 http:/cs1114.cs.cornell.eduAdministrivia Assignment4hasbeenposted DuetheFridayafterspringbreak TAevaluations http:/www.engineering.cornell.edu/TAEval/survey.cfm Midtermcourseevaluations2
Cornell - CS - 100
Image transformations, Part 2Prof. Noah Snavely CS1114 http:/cs1114.cs.cornell.eduAdministriviaAssignment 4 has been posted Due the Friday after spring breakTA evaluations http:/www.engineering.cornell.edu/TAEval/survey.cfmMidterm course e
Cornell - CS - 100
Recognizing objectsProf. Noah Snavely CS1114 http:/cs1114.cs.cornell.eduAdministrivia Assignment 4 due on Friday The first problem is tricky please get started early! Quiz 4 next Tuesday, 3/31 Prelim 2 in two weeks, 4/7 (in class) Covers e
Cornell - CS - 100
Recognizing objectsProf. Noah Snavely CS1114 http:/cs1114.cs.cornell.eduAdministriviaAssignment 4 due on Friday The first problem is tricky please get started early!Quiz 4 next Tuesday, 3/31 Prelim 2 in two weeks, 4/7 (in class) Covers ever
Cornell - CS - 100
Featurebased object recognitionProf. Noah Snavely CS1114 http:/cs1114.cs.cornell.eduAdministrivia Assignment 4 due tomorrow, A5 will be out tomorrow, due in two parts Quiz 4 next Tuesday, 3/31 Prelim 2 in two weeks, 4/7 (in class) Covers eve
Cornell - CS - 100
AdministriviaFeature-based object recognitionAssignment 4 due tomorrow, A5 will be out tomorrow, due in two parts Quiz 4 next Tuesday, 3/31Prof. Noah Snavely CS1114 http:/cs1114.cs.cornell.eduPrelim 2 in two weeks, 4/7 (in class) Covers everyth
Cornell - CS - 100
Computing transformationsProf. Noah Snavely CS1114 http:/cs1114.cs.cornell.eduAdministrivia A5 Part 1 due on Friday, A5 Part 2 out soon Prelim 2 next week, 4/7 (in class) Covers everything since Prelim 1 Review session next Monday (time TBA)
Cornell - CS - 100
Computing transformationsProf. Noah Snavely CS1114 http:/cs1114.cs.cornell.eduAdministriviaA5 Part 1 due on Friday, A5 Part 2 out soon Prelim 2 next week, 4/7 (in class) Covers everything since Prelim 1 Review session next Monday (time TBA)2
Cornell - CS - 100
Optimization and least squaresProf. Noah Snavely CS1114 http:/cs1114.cs.cornell.eduAdministrivia A5 Part 1 due tomorrow by 5pm (please sign up for a demo slot) Part 2 will be due in two weeks (4/17) Prelim 2 on Tuesday 4/7 (in class) Covers
Cornell - CS - 100
Optimization and least squaresProf. Noah Snavely CS1114 http:/cs1114.cs.cornell.eduAdministriviaA5 Part 1 due tomorrow by 5pm (please sign up for a demo slot) Part 2 will be due in two weeks (4/17) Prelim 2 on Tuesday 4/7 (in class) Covers ever
Cornell - CS - 100
CS1114: Study Guide 2This document covers the topics we've covered in the second part of the course. Please refer to the class slides for more details.1Polygons and convex hullsA polygon is a set of 2D points (called vertices, as in a graph) c
Cornell - CS - 100
Markov chainsProf. Noah Snavely CS1114 http:/cs1114.cs.cornell.eduRoadmap for the next month Guest lecture 4/16, Prof. Charles Van Loan Ellipse fitting (this is a much better way to find lightstick shapes) Exams: Assignments: Prelim 3: 4
Cornell - CS - 100
Markov chainsProf. Noah Snavely CS1114 http:/cs1114.cs.cornell.eduRoadmap for the next monthGuest lecture 4/16, Prof. Charles Van Loan Ellipse fitting (this is a much better way to find lightstick shapes)Exams: Prelim 3: 4/30 (Final lecture)
Cornell - CS - 100
Markov chains Part 2Prof. Noah Snavely CS1114 http:/cs1114.cs.cornell.eduAdministrivia Guest lecture on Thursday, Prof. Charles Van Loan Assignments: A5P2 due on Friday by 5pm A6 will be out on Friday Quiz next Thursday, 4/232Administ
Cornell - CS - 100
Markov chains Part 2Prof. Noah Snavely CS1114 http:/cs1114.cs.cornell.eduAdministriviaGuest lecture on Thursday, Prof. Charles Van Loan Assignments: A5P2 due on Friday by 5pm A6 will be out on FridayQuiz next Thursday, 4/232Administrivia
Cornell - CS - 100
Author recognitionProf. Noah Snavely CS1114 http:/cs1114.cs.cornell.eduAdministrivia Quiz 5 this Thursday, 4/23 Focus on Markov chains A6 released, due on Friday There will be demo sessions You will also turn in your code this time Preli
Cornell - CS - 100
Author recognitionProf. Noah Snavely CS1114 http:/cs1114.cs.cornell.eduAdministriviaQuiz 5 this Thursday, 4/23 Focus on Markov chainsA6 released, due on Friday There will be demo sessions You will also turn in your code this timePrelim 3
Cornell - CS - 100
Clustering and greedy algorithmsProf. Noah Snavely CS1114 http:/cs1114.cs.cornell.eduAdministrivia A6 due tomorrow Please sign up for demo sessions You will also turn in your code this time (turnin due Monday) Prelim 3 next Thursday, 4/30
Cornell - CS - 100
Clustering and greedy algorithmsProf. Noah Snavely CS1114 http:/cs1114.cs.cornell.eduAdministriviaA6 due tomorrow Please sign up for demo sessions You will also turn in your code this time (turnin due Monday)Prelim 3 next Thursday, 4/30 (las
Cornell - CS - 100
Clustering and greedy algorithms - Part 2Prof. Noah Snavely CS1114 http:/cs1114.cs.cornell.eduAdministrivia Prelim 3 on Thursday Will be comprehensive, but focused on Markov chains and clustering Review session Wednesday at 7pm, Upson 31
Cornell - CS - 100
Clustering and greedy algorithms - Part 2Prof. Noah Snavely CS1114 http:/cs1114.cs.cornell.eduAdministriviaPrelim 3 on Thursday Will be comprehensive, but focused on Markov chains and clustering Review session Wednesday at 7pm, Upson 315 Ste
Cornell - CS - 100
CS1114: Study Guide 3This document covers the topics we've covered in the final part of the course. Please refer to the class slides for more details.1Markov chainsSequences of things come up all the time when dealing with the real world. The
Cornell - CS - 100
CS1114 Section 2/4 Exercises: Robot arena, recursion, and while loops1Robot arena1. We've set up a virtual robot arena to test your code when all of the physical robots are in use. The first exercise is to start the robot arena, create a robot,
Cornell - CS - 100
CS1114: Assignment 2Assigned: Feb. 6, 2009 First Part Due: Feb. 13, 2007 by 5PM Second Part Due: Feb. 20, 2007 by 5PM1IntroductionIn the first assignment, you had the opportunity to work with a basic image operation (thresholding). Recall that
Cornell - CS - 100
CS1114 Assignment 31 Previously, on Assignment 2out: Feb 20, 2009 due: March 6, 2009 by 5pmIn the last assignment we implemented several robust ways of finding the lightstick center. In this assignment, we will do even better, by using graph tra
Cornell - CS - 100
CS1114 Assignment 41out: March 11th, 2009 due: 5:00PM March 27th, 2009Previously, on Assignment 3..you wrote functions to drive the robot based on the position of the lightstick in the webcam image. Now, wed also like the robot to respond to t
Cornell - CS - 100
CS1114 Assignment 5, Part 1out: Friday, March 27, 2009. due: Friday, April 3, 2009, 5PM.This assignment covers three topics in two parts: interpolation and image transformations (Part 1), and feature-based image recognition (Part 2). This documen
Cornell - CS - 100
CS1114 Assignment 5, Part 2out: Monday, April 6, 2009. due: Friday, April 17, 2009, 5PM.This assignment covers three topics in two parts: interpolation and image transformations (Part 1), and feature-based image recognition (Part 2). This documen
Cornell - CS - 100
CS1114 Assignment 6out: Saturday, April 18, 2009. due: Friday, April 25, 2009, 5PM.In this assignment, you will be implementing an authorship detector which, when given a large sample size of text to train on, can then guess the author of an unkn
Uni. Westminster - RRG - 1024
Prime Realty Author: Date: Purpose: Carol Malloy 6/1/2009 To calculate loan information assuming a constant yearly rateMortgage Analysis WorksheetSummary Information Loan $250,000 Rate 5.00% Years 30 Per Year 12 Total Payments 360 Monthly Payment
Uni. Westminster - RRG - 1024
Current Year Info Sales (in dollars) Variable Cost Fixed Costs Sales (Volume/Unit) Sales Price (each) Variable Cost (each) Forecast Estimates Sales Volume Increase Sales Price Increase Variable Cost Increase Fixed Cost Increase2008 Predicted Info 2
Uni. Westminster - RRG - 1024
Raquel Gilson TechBlog 3 February 6, 2007One thing I am embarrassed to admit is that I am not completely aware of the differences between the World Wide Web and the Internet. Before I come to class again on Thursday February 8th I intend to do more
Uni. Westminster - RRG - 1024
Raquel Gilson TechBlog Notes PageTechBlog 1 Jan. 25, 2007 Ebusiness System of gathering information. TechBlog 2 Jan. 30, 2007 Business Intelligence Systems Systems that disseminate information. MIS - One of the oldest intelligence systems out to
Carnegie Mellon - ANDREW - 213
15-213 Recitation 12Eugene Marinelli Section E 4/16/07Outline Announcements Malloc Course materialAnnouncements No quiz malloc due tomorrowLast day to turn in ThursdayProxy lab out sometime this week (I'm in charge of this one)
Iowa State - CPRE - 211
Assigned: 2/6/04Due: 2/17/04CprE 211 Spring 2004 Homework 2Last Name First Name Section_ __Grading Procedure for Homework: The number of points of each question is given in brackets. You shall turn in your homework in the class when it is
Iowa State - CPRE - 211
Assigned: 2/6/04Due: 2/17/04CprE 211 Spring 2004 Homework 2 SolutionLast Name First Name Section_ __Grading Procedure for Homework: The number of points of each question is given in brackets. You shall turn in your homework in the class wh
Iowa State - CPRE - 211
Assigned: 3/9/04Due: 3/25/04CprE 211 Spring 2004 Homework 4 SolutionLast Name First Name Section _ _ _Grading Procedure for Homework: The number of points of each question is given in brackets. You shall turn in your homework in the class whe
Iowa State - CPRE - 211
Assigned: 4/20/03Completed by: 4/27/03CprE 211 Spring 2004 Homework 6Last Name First Name Section_ __Grading Procedure for Homework: This homework will not be collected and not be graded. The solution will be distributed on-line one week l
University of the West Indies at Mona - GREEN - 4531
San Diego State - DESIGN - 240
Washington - FACULTY - 122
Physics 122 Solutions Ch 2727.1. Visualize:As discussed in Section 27.1, the symmetry of the electric field must match the symmetry of the charge distribution. In particular, the electric field of a cylindrically symmetric charge distribution cann
Washington - FACULTY - 122
Physics 122 Solutions to Chapter 2525.1.Model:Use the charge model.Solve:(a) In the process of charging by rubbing, electrons are removed from one material and transferred to the other because they are relatively free to move. Protons, on the other
Washington - FACULTY - 122
Physics 122 Solutions Ch 2626.31. Model: The electric field is that of three point charges q1, q2 and q3.Visualize: Please refer to Figure P26.31. Assume the charges are in the x-y plane. The 5 nC charge is q1, the 10 nC charge is q3, and the -
Washington - FACULTY - 122
30.1. Solve: The potential difference V between two points in space isV = V ( xf ) - V ( xi ) = - Ex dxxi xfwhere x is the position along a line from point i to point f. When the electric field is uniform, V = - Ex dx = - Ex x = - ( 1000 V/m )
Washington - FACULTY - 122
31.1. Solve: From Table 30.1, the resistivity of carbon is = 3.5 10-5 m. From Equation 31.3, the resistanceof lead from a mechanical pencil is R= 3.5 10 -5 m ( 0.06 m ) L L = 2 = = 5.5 2 A r 0.35 10 -3 m(())31.6. Solve: The slope o
Washington - FACULTY - 122
32.7. Model: The magnetic field is that of a moving charged particle.Visualize: Please refer to Figure Ex32.7. Solve: Using the Biot-Savart law, B= 10 -7 T m/A 1.60 10 -19 C 2.0 107 m/s sin135 0 qv sin = = 1.13 10 -15 T 2 2 -2 -2 4 r 2 1.0 10 m
Washington - FACULTY - 122
33.1. Model: Assume the magnetic field is uniform.Visualize: Please refer to Figure Ex33.1. Since a motional emf was developed the field must be perpendicular to v . The positive charges experienced a magnetic force to the left. By the right-hand r
Washington - FACULTY - 122
34.21. Model: The electric and magnetic field amplitudes of an electromagnetic wave are related.Solve: Using Equation 34.40, E0 = cB0 = 3.0 108 m/s 2.0 10 -3 T = 6.0 10 5 V/m()()34.23. Model: Electromagnetic waves are sinusoidal.Solve:
Washington - FACULTY - 122
35.6.Model:Current and voltage phasors are vectors that rotate counterclockwise around the origin at angularfrequency . Visualize:Please refer to Figure 35.6. Solve:(a) From the figure we note that VR = 10 V and IR = 0.50 A. Using Ohm's law, R= (b)
Washington - FACULTY - 122
Name _Student ID _ Score_ last first III. [20 points] All bulbs in the circuit at right are identical and all batteries are ideal and identical.13A. [8 pts] Rank the bulbs according to brightness in order from brightest to dimmest. Explain your
Washington - FACULTY - 122
Name _Student ID _ Score_last firstIV. [20 pts] In each part below, state whether the magnitude of the net force on the charge labeled +qo in case A is greater than, less than, or equal to the magnitude of the net force on the charge labeled +qo i
Washington - FACULTY - 122
Name _Student ID _ Score_last firstIV. [20 points total] A very large sheet has charge density - o. A side view of a small portion of the sheet is shown to the right. The locations in space A, B, and C are each marked with an X. A. [4 pts] Draw el
Washington - FACULTY - 122
Name _Student ID _ Score_last firstIV. [20 pts] In each part below, state whether the magnitude of the net force on the charge labeled +qo in case A is greater than, less than, or equal to the magnitude of the net force on the charge labeled +qo i
Washington - FACULTY - 122
Name _Student ID _ Score_last firstIV. [20 points] Three charged rods, one with net charge +QO and two with -QO, are held in place as shown in the top view diagram below. A. A small test charge +qO travels from point A to D along the path describe
Washington - FACULTY - 122
Name_Student ID_Score_ last firstI.Multiple Choice: (50 pts total) Please mark the answer that is MOST correct on this sheet and on your bubble sheet.1) An electron moves to the right and is speeding up. The electron moves from: a) high to low
Washington - FACULTY - 122
Name_Student ID_Score_ last firstI.Multiple Choice: (50 pts total) Please mark the answer that is MOST correct on this sheet and on your bubble sheet.1. An electron is moving to the right with a speed v in a uniform magnetic field into the page