rebl-AMR
parse_stl.h
Go to the documentation of this file.
1 #ifndef PARSE_STL_H
2 #define PARSE_STL_H
3 
4 #include <string>
5 #include <vector>
6 #include <cassert>
7 #include <fstream>
8 #include <iostream>
9 #include <sstream>
10 #include <streambuf>
11 
12 namespace stl {
13 
19  struct point {
20  float x;
21  float y; ;
22  float z; ;
25  point() : x(0), y(0), z(0) {}
26  point(float xp, float yp, float zp) : x(xp), y(yp), z(zp) {}
27  };
35  struct triangle {
40  triangle(point normalp, point v1p, point v2p, point v3p) :
41  normal(normalp), v1(v1p), v2(v2p), v3(v3p) {}
42  };
43 
44  std::ostream& operator<<(std::ostream& out, const triangle& t);
45 
55  struct stl_data {
56  std::string name;
57  std::vector<triangle> triangles;
58  //triangle *triangles;
59  stl_data(std::string namep) : name(namep) {}
60  };
61 
62  stl_data parse_stl(const std::string& stl_path);
63  //void parse_stl(const std::string& stl_path,stl_data& info);
64 
65 }
66 
67 class Vector3 //Class for 3d Vector Magnitude and Normalization
68 {
69 public:
70  Vector3(void);
71  Vector3(float X, float Y, float Z);
72  ~Vector3(void);
73  float Length();
75  Vector3 Vectors();
76  float X, Y, Z;
77 };
78 
79 void checkMesh(std::vector<stl::triangle> &triangles);
80 
81 
82 
83 
84 
85 #endif
float y
Definition: parse_stl.h:21
Vector3 Vectors()
Structure to hold coordinates of a point.
Definition: parse_stl.h:19
structure to store normals and vertices of a triangle
Definition: geomSTL.h:29
point normal
Definition: parse_stl.h:36
float Z
Definition: parse_stl.h:76
std::string name
Definition: parse_stl.h:56
stl_data parse_stl(const std::string &stl_path)
std::vector< triangle > triangles
Definition: parse_stl.h:57
Vector3(void)
float z
Definition: parse_stl.h:21
float X
Definition: parse_stl.h:76
structure to store vector of triangles read in from *.stl file
Definition: parse_stl.h:55
float x
Definition: parse_stl.h:20
std::ostream & operator<<(std::ostream &out, const triangle &t)
Definition: parse_stl.h:12
triangle(point normalp, point v1p, point v2p, point v3p)
Definition: parse_stl.h:40
float Length()
structure to store vector of triangles read in from *.stl file
Definition: geomSTL.h:45
~Vector3(void)
structure to store normals and vertices of a triangle
Definition: parse_stl.h:35
point(float xp, float yp, float zp)
Definition: parse_stl.h:26
point v2
Definition: parse_stl.h:38
Definition: parse_stl.h:67
void checkMesh(std::vector< stl::triangle > &triangles)
stl_data(std::string namep)
Definition: parse_stl.h:59
point()
Definition: parse_stl.h:25
point v3
Definition: parse_stl.h:39
float Y
Definition: parse_stl.h:76
point v1
Definition: parse_stl.h:37
Vector3 Normalize()