Horizon
Loading...
Searching...
No Matches
import.hpp
1#pragma once
2#include <deque>
3#include <string>
4#include <vector>
5#include <tuple>
6
7namespace horizon::STEPImporter {
8class Color {
9public:
10 float r;
11 float g;
12 float b;
13 Color(double ir, double ig, double ib) : r(ir), g(ig), b(ib)
14 {
15 }
16 Color() : r(0), g(0), b(0)
17 {
18 }
19};
20
21template <typename T> class TVertex {
22private:
23 auto as_tuple() const
24 {
25 return std::make_tuple(x, y, z);
26 }
27
28public:
29 TVertex(T ix, T iy, T iz) : x(ix), y(iy), z(iz)
30 {
31 }
32
33 T x, y, z;
34
35 bool operator==(const TVertex &other) const
36 {
37 return x == other.x && y == other.y && z == other.z;
38 }
39
40 bool operator<(const TVertex &other) const
41 {
42 return as_tuple() < other.as_tuple();
43 }
44
45 auto &operator+=(const TVertex &other)
46 {
47 x += other.x;
48 y += other.y;
49 z += other.z;
50 return *this;
51 }
52
53 auto &operator/=(T other)
54 {
55 x /= other;
56 y /= other;
57 z /= other;
58 return *this;
59 }
60};
61
63
64class Face {
65public:
66 Color color;
67 std::vector<Vertex> vertices;
68 std::vector<Vertex> normals;
69 std::vector<std::tuple<size_t, size_t, size_t>> triangle_indices;
70};
71
73using Faces = std::deque<Face>;
74
75class Result {
76public:
77 Faces faces;
78 std::deque<Point> points;
79};
80
81Result import(const std::string &filename);
82} // namespace horizon::STEPImporter
Definition import.hpp:8
Definition import.hpp:64
Definition import.hpp:75
Definition import.hpp:21