fixed incorrect coord functionality
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
* @brief A C++ file containing the functionality need to read in a .stl file.
|
* @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
|
* The ReadSTL class allows the min/max coordinates and total count of the STL
|
||||||
* facets be stored. The appropriate getters are also included.
|
* facets be stored. The appropriate getters are also included.
|
||||||
* @version 1.0
|
* @version 1.1
|
||||||
* @date 2022-03-15
|
* @date 2022-03-15
|
||||||
*
|
*
|
||||||
* @copyright Copyright (c) 2022
|
* @copyright Copyright (c) 2022
|
||||||
@@ -55,6 +55,33 @@ class ReadSTL {
|
|||||||
// Facet header
|
// Facet header
|
||||||
// Iterate past "normal"
|
// Iterate past "normal"
|
||||||
lineStream >> token;
|
lineStream >> token;
|
||||||
|
// No additional functionality required for facet normal vectors
|
||||||
|
// Normal X
|
||||||
|
lineStream >> token;
|
||||||
|
// Normal Y
|
||||||
|
lineStream >> token;
|
||||||
|
// Z Normal
|
||||||
|
lineStream >> token;
|
||||||
|
// End facet header
|
||||||
|
do {
|
||||||
|
// Get next line
|
||||||
|
getline(inputfile, line);
|
||||||
|
// Set string stream to new line
|
||||||
|
lineStream.str(line);
|
||||||
|
// Clear sstream error state
|
||||||
|
lineStream.clear();
|
||||||
|
lineStream >> token;
|
||||||
|
if (!token.compare("outer")) {
|
||||||
|
do {
|
||||||
|
// Get next line
|
||||||
|
getline(inputfile, line);
|
||||||
|
// Set string stream to new line
|
||||||
|
lineStream.str(line);
|
||||||
|
// Clear sstream error state
|
||||||
|
lineStream.clear();
|
||||||
|
lineStream >> token;
|
||||||
|
if(!token.compare("vertex")) {
|
||||||
|
// Process vertex
|
||||||
// Coord double value
|
// Coord double value
|
||||||
double coord;
|
double coord;
|
||||||
// X Coord
|
// X Coord
|
||||||
@@ -84,33 +111,6 @@ class ReadSTL {
|
|||||||
if((coord > Zmax) || numFacet == 0) {
|
if((coord > Zmax) || numFacet == 0) {
|
||||||
Zmax = coord;
|
Zmax = coord;
|
||||||
}
|
}
|
||||||
// End facet header
|
|
||||||
do {
|
|
||||||
// Get next line
|
|
||||||
getline(inputfile, line);
|
|
||||||
// Set string stream to new line
|
|
||||||
lineStream.str(line);
|
|
||||||
// Clear sstream error state
|
|
||||||
lineStream.clear();
|
|
||||||
lineStream >> token;
|
|
||||||
if (!token.compare("outer")) {
|
|
||||||
do {
|
|
||||||
// Get next line
|
|
||||||
getline(inputfile, line);
|
|
||||||
// Set string stream to new line
|
|
||||||
lineStream.str(line);
|
|
||||||
// Clear sstream error state
|
|
||||||
lineStream.clear();
|
|
||||||
lineStream >> token;
|
|
||||||
if(!token.compare("vertex")) {
|
|
||||||
// Process vertex
|
|
||||||
// No additional functionality required
|
|
||||||
// X coord
|
|
||||||
lineStream >> token;
|
|
||||||
// Y coord
|
|
||||||
lineStream >> token;
|
|
||||||
// Z coord
|
|
||||||
lineStream >> token;
|
|
||||||
} // End vertex line
|
} // End vertex line
|
||||||
} while(token.compare("endloop")); // Endloop
|
} while(token.compare("endloop")); // Endloop
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
* ReadSTL class. The user enters the file location of the STL file as a
|
* 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
|
* command line arg and the console returns the min/max coords of the solid's
|
||||||
* facets as well as the total number of facets.
|
* facets as well as the total number of facets.
|
||||||
* @version 1.0
|
* @version 1.1
|
||||||
* @date 2022-03-15
|
* @date 2022-03-15
|
||||||
*
|
*
|
||||||
* @copyright Copyright (c) 2022
|
* @copyright Copyright (c) 2022
|
||||||
@@ -16,8 +16,12 @@
|
|||||||
#include "ReadSTL.cpp"
|
#include "ReadSTL.cpp"
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
//int main(int argc, char** argv) {
|
||||||
ReadSTL stl1(argv[1]);
|
int main(){
|
||||||
|
// Debug mode
|
||||||
|
ReadSTL stl1("STLFiles/shape.stl");
|
||||||
|
// End debug mode
|
||||||
|
//ReadSTL stl1(argv[1]);
|
||||||
cout << endl << "File read successfully!" << endl;
|
cout << endl << "File read successfully!" << endl;
|
||||||
// Formatted file info output
|
// Formatted file info output
|
||||||
cout << "Facets in file: " << stl1.getNumFacets() << endl << endl;
|
cout << "Facets in file: " << stl1.getNumFacets() << endl << endl;
|
||||||
|
|||||||
Reference in New Issue
Block a user