Robotran C Documentation
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 
7 namespace stl {
8 
9  struct point {
10  float x;
11  float y;
12  float z;
13 
14  point() : x(0), y(0), z(0) {}
15  point(float xp, float yp, float zp) : x(xp), y(yp), z(zp) {}
16  };
17 
18  struct triangle {
23  triangle(point normalp, point v1p, point v2p, point v3p) :
24  normal(normalp), v1(v1p), v2(v2p), v3(v3p) {}
25  };
26 
27  std::ostream& operator<<(std::ostream& out, const triangle& t);
28 
29  struct stl_data {
30  std::string name;
31  std::vector<triangle> triangles;
32 
33  stl_data(std::string namep) : name(namep) {}
34  };
35 
36  stl_data parse_stl(const std::string& stl_path);
37 
38 }
39 
40 #endif
parse_stl.h
stl::point
Definition: parse_stl.h:9
stl::point::point
point(float xp, float yp, float zp)
Definition: parse_stl.h:15
stl::triangle
Definition: parse_stl.h:18
stl::stl_data
Definition: parse_stl.h:29
stl::parse_float
float parse_float(std::ifstream &s)
Definition: parse_stl.cpp:25
stl::parse_stl
stl_data parse_stl(const std::string &stl_path)
Definition: parse_stl.cpp:39
stl::operator<<
std::ostream & operator<<(std::ostream &out, const point p)
Definition: parse_stl.cpp:11
stl::triangle::v3
point v3
Definition: parse_stl.h:22
stl
Definition: parse_stl.cpp:9
stl::point::z
float z
Definition: parse_stl.h:12
stl::stl_data::stl_data
stl_data(std::string namep)
Definition: parse_stl.h:33
stl::point::point
point()
Definition: parse_stl.h:14
stl::point::x
float x
Definition: parse_stl.h:10
stl::stl_data::triangles
std::vector< triangle > triangles
Definition: parse_stl.h:31
stl::point::y
float y
Definition: parse_stl.h:11
stl::parse_point
point parse_point(std::ifstream &s)
Definition: parse_stl.cpp:32
stl::triangle::normal
point normal
Definition: parse_stl.h:19
stl::triangle::v2
point v2
Definition: parse_stl.h:21
stl::stl_data::name
std::string name
Definition: parse_stl.h:30
stl::triangle::v1
point v1
Definition: parse_stl.h:20
stl::triangle::triangle
triangle(point normalp, point v1p, point v2p, point v3p)
Definition: parse_stl.h:23