COL 106 Assignment 6

Clarifications

Assignment

In this assignment, you will deal with 3D geometric models. The first step is to read and store in a data structure one model at a time. A model is listed triangle by triangle, one triangle per line in the following format:
X1 Y1 Z1 X2 Y2 Z2 X3 Y3 Z3
The given values are strings representing decimal values of the X, Y, and Z coordinates of each vertex of the triangle.

The internal data structure will store the model as a graph. In fact, you will read all the files in a given input directory. Thus there may be a number of 3D models, aka graphs.

The goal is to find, for each 3D model, other models with a similar shape. Two models have a similar shape if minor modifications to one of the models yields the other one. The modifications can be one of these:

  1. merger of adjacent triangles lying on the same plane (Two triangles are adjacent if they share an edge.)
  2. a rotation, translation or scale
As an approximation, after merger of planar facets, two models match if they have the same
  1. number of triangles, edges and vertices
  2. number of shared and open edges (a shared edge is shared by two trianglesfacets, an open edge belongs to only one trianglefacet.)
  3. set of all dihedral angles (Dihedral angle is the angle between adjacent polygon's planes)
  4. correctness (a model is correct if no edge is shared by more than two trianglesfacets)
You may use a hash function to check for matches. The output will contain one line per input model. The first word on the line is the name of the model file. It is followed by blank-separated names all its matching models' file names. The output is in the sorted order of model file names. You must implement you own sorting.

Implementation

Implement public class Assignment6, with a static main that takes on the command line, only the (path)name of a directory that contains all the input model files. It reads each file in the directory (one model per file), merging co-planar adjacent triangles and storing the details of the resulting shape for later matching. It then iterates over each model, find its matches. Speed is important.

At the end, it print the sorted model matches on standard output.

Examples

Input Directory
Output:
tri1 tri2
tri2 tri1
Input Directory
Output:
model1 model2 model3
model2 model1 model3
model3 model1 model2

Submission instructions

Submission will be at moodle.

Please ensure that you follow the following set of instructions meticulously while submitting the assignment on Moodle. Also, please note that in case of deviation from this procedure will render your submission faulty, and your assignment might not be evaluated at all by the script. Please follow these steps:

  1. On eclipse, by default, all your source files (.java files) are saved into a directory called "src" inside your project. You have to compress this directory (to zip format) and rename the zip file in this format:
    your-entry-number_assignment6.zip
    
    Example: If your entry number is 2012CSZ8019, the zip file should be named 2012CSZ8019_assignment6.zip. It should expand to a directory called src, which contains all your .java files. Please make sure that you follow exactly this naming format.
  2. Next, convert the zip file to base64 format. On any linux system, you can do this easily by issuing the following command on the terminal :
       base64 entrynumber_assignment6.zip > entrynumber_assignment6.zip.b64
    
    This will create a file with the same name with a b64 extension appended at the end.
  3. Upload this b64 file on moodle and submit it (in the "Submission" section). After Submission, there is an option of "Evaluate" in the "Edit" section. Click on "Evaluate". On the right side of the window, you will get information about the submission status. On clicking the "Evaluate" link, you should see a script running and producing an output of your codes' performance against the standard set of test cases that we supply internally for the assessment. A dialog box will show you the messages on how your codes performed against the benchmarks that we provided.
        Important notes