Java代写:CS206 Convex Hulls

代写Computational Geometry基础算法Convex Hull的Lab作业,按照书上的伪代码,用任意语言编写即可。

Important Information

  1. Your solution must be electronically submitted.
  2. This programming assignment must be solved individually.
  3. You can code your solution in Matlab, C/C++, or Java. The choice is up to you. But you have to properly document your submission to explain how your program can be compiled and run. Important: if you solve your assignment in C/C++, it must compile with gcc. Other languages will not be accepted. Do not include solutions depending on the availability of IDEs (e.g., Eclipse or similar). If you use C/C++ or java, please provide instructions to compile your code from the command line.
  4. Submissions that do not compile will receive 0 points without further consideration.
  5. Your code will be closely inspected to see whether you followed the algorithm presented in class. Solutions not following the algorithm presented in class will receive 0 points.

Convex hulls

Implement the algorithm to compute the convex hull of n points in the plane. Your code should print to the screen the points in the convex hull in clockwise order, starting from the leftmost point (one point per line). The input to the algorithm is a text file called input.txt where the input points are given one per line. For example, if the file input.txt is as follows:

1 1
3.5 2
0 0
2 1.7
3 5
4 0
6 0

your solution should print to the screen the following:

0 0
3 5
6 0

Important

  1. your solution must be able to handle inputs of arbitrary size (i.e., you do not know beforehand how many rows are in input.txt);
  2. your code must be able to handle special cases, including collinear points, empty inputs, and possible repetitions on the input (i.e., the same point appearing more than once);
  3. your code will be tested against various test cases and must work correctly on all of them.