diff --git a/Lab1/ReadSTL.cpp b/Lab1/ReadSTL.cpp index 23acd15..d70635f 100644 --- a/Lab1/ReadSTL.cpp +++ b/Lab1/ReadSTL.cpp @@ -4,7 +4,7 @@ * @brief A C++ file containing the functionality need to read in a .stl file. * The ReadSTL class allows the min/max coordinates and total count of the STL * facets be stored. The appropriate getters are also included. - * @version 1.0 + * @version 1.1 * @date 2022-03-15 * * @copyright Copyright (c) 2022 @@ -55,35 +55,13 @@ class ReadSTL { // Facet header // Iterate past "normal" lineStream >> token; - // Coord double value - double coord; - // X Coord + // No additional functionality required for facet normal vectors + // Normal X lineStream >> token; - coord = stod(token); - if((coord < Xmin) || numFacet == 0) { - Xmin = coord; - } - if((coord > Xmax) || numFacet == 0) { - Xmax = coord; - } - // Y Coord + // Normal Y lineStream >> token; - coord = stod(token); - if((coord < Ymin) || numFacet == 0) { - Ymin = coord; - } - if((coord > Ymax) || numFacet == 0) { - Ymax = coord; - } - // Z Coord + // Z Normal lineStream >> token; - coord = stod(token); - if((coord < Zmin) || numFacet == 0) { - Zmin = coord; - } - if((coord > Zmax) || numFacet == 0) { - Zmax = coord; - } // End facet header do { // Get next line @@ -104,13 +82,35 @@ class ReadSTL { lineStream >> token; if(!token.compare("vertex")) { // Process vertex - // No additional functionality required - // X coord + // Coord double value + double coord; + // X Coord lineStream >> token; - // Y coord + coord = stod(token); + if((coord < Xmin) || numFacet == 0) { + Xmin = coord; + } + if((coord > Xmax) || numFacet == 0) { + Xmax = coord; + } + // Y Coord lineStream >> token; - // Z coord + coord = stod(token); + if((coord < Ymin) || numFacet == 0) { + Ymin = coord; + } + if((coord > Ymax) || numFacet == 0) { + Ymax = coord; + } + // Z Coord lineStream >> token; + coord = stod(token); + if((coord < Zmin) || numFacet == 0) { + Zmin = coord; + } + if((coord > Zmax) || numFacet == 0) { + Zmax = coord; + } } // End vertex line } while(token.compare("endloop")); // Endloop } diff --git a/Lab1/main.cpp b/Lab1/main.cpp index 02b256b..b79cb88 100644 --- a/Lab1/main.cpp +++ b/Lab1/main.cpp @@ -5,7 +5,7 @@ * ReadSTL class. The user enters the file location of the STL file as a * command line arg and the console returns the min/max coords of the solid's * facets as well as the total number of facets. - * @version 1.0 + * @version 1.1 * @date 2022-03-15 * * @copyright Copyright (c) 2022 @@ -16,8 +16,12 @@ #include "ReadSTL.cpp" using namespace std; -int main(int argc, char** argv) { - ReadSTL stl1(argv[1]); +//int main(int argc, char** argv) { +int main(){ + // Debug mode + ReadSTL stl1("STLFiles/shape.stl"); + // End debug mode + //ReadSTL stl1(argv[1]); cout << endl << "File read successfully!" << endl; // Formatted file info output cout << "Facets in file: " << stl1.getNumFacets() << endl << endl;