-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFacet.hpp
50 lines (28 loc) · 922 Bytes
/
Facet.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#pragma once
#include <array>
namespace kSTL {
class Facet {
public:
typedef std::array<float, 3> Point;
typedef std::array<char, 2> Tabbing;
Facet(Point A, Point B, Point C, Point N, Tabbing T);
void translate(float x, float y, float z);
void scale(float x, float y, float z);
void rotateZYX(float x, float y, float z);
const Point* get_corner(const std::size_t ci) const;
const Point* get_normal() const;
float get_min(const std::size_t ci) const;
float get_max(const std::size_t ci) const;
private:
void compute_normal();
void rotateX(float x);
void rotateY(float y);
void rotateZ(float z);
void rotate_point(float& x, float& y, float angle_u);
std::array<Point, 3> mPoints;
Point mNormal;
Tabbing mTabbing;
Point mMin = { std::numeric_limits<float>::max() };
Point mMax = { std::numeric_limits<float>::min() };
};
}