This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: 15-121: Introduction to Data StructuresFall 2009Exercise10/09/2009TriangulationsDue: Fri, Oct 238amRelevant Reading:•Section 7.3of the online text by Eck on ArrayLists. •Noteson Java Collections•Sample programs on Backtracking. The online text has an additional example in section 10.5NOTE: Each of these problems has a separate place in the handin systemAssignment: (worth 15 exercise points - 5 points for each of the 3 parts) In each of the problems, there are working versions of classes Point, Edge, and Geometry. See the API here.For this homework, these classes should not need to be modified, but you are welcome to do so if you wish. If you change these three classes, you need to document your changes well.•Describe your changes in the comment at the top of the file.•Create a file that lists the changes you made AND WHY you made them The file should be named "changes.txt" or "changes.doc" or "changes.pdf" depending on what format you choose.•You are also welcome to create ADDITIONAL classes if you wish.For this homework, you will need to work with .class files in order to use the provided testers. See here for help inusing these in Eclipse.Definition clarification for this homework:For an edge to be "possible", it must not have any points on it other than its endpoints. (In other words, 3 collinearpoints give only two possible edges. EG: •P1 = (1,1) •P2 = (2,1)•P3 = (3,1)Edge from P1 to P3 is NOT allowed, because it contains P2.)1) Simple Triangulation. Download SimpleTri.zipA Triangulationof a set of points is a set of edges connecting those points such that:•no two edges cross•no additional edges can be added to the setNote that this is NOT the same as finding a location via GPS coordinates or the like (although there are relations between the concepts). Further, note that there is not a unique set of edges that meet this criteria. See the pictures at the bottom of this page.Specific Task:•Fill in the class SimpleTriangulation so that it computes a triangulation of the given set of points. The constructor is responsible for calculating the triangulation. Be sure to link your answer to the proper accessor methods. Code Notes:•For Sets, you are welcome to use HashSet, and for Lists, use ArrayList.•You are welcome to do all of your operations on arrays, with conversions to and from Sets/Lists as necessary. However, it is probably easier to deal with the Sets and Lists directly.Algorithm:A suggested algorithm is as follows:•Create a list of edges that is initially empty.•Look at each possible edge that can be made from a pair of points....
View Full Document
This document was uploaded on 12/19/2009.
- Spring '09
- Data Structures