-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFourDimensionalObject.h
49 lines (40 loc) · 1.14 KB
/
FourDimensionalObject.h
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
#ifndef __FourDimensionalObject_h_
#define __FourDimensionalObject_h_
#include "HyperPlane.h"
#include "ThreeDimensionalObject.h"
#include "Vector4f.h"
#include <vector>
#include <memory>
class FourDimensionalObject
{
public:
FourDimensionalObject(void);
~FourDimensionalObject(void);
virtual std::auto_ptr<ThreeDimensionalObject> Slice(const HyperPlane &) const;
protected:
FourDimensionalObject(
size_t verticesCount, size_t edgesCount, size_t tetrahedronsCount);
size_t AddVertex(const Vector4f &);
size_t AddTetrahedron(
size_t v1, size_t v2, size_t v3, size_t v4, const Vector4f &normal);
private:
struct Edge
{
size_t vertices[2];
bool operator == (const Edge &);
};
struct Tetrahedron
{
size_t vertices[4];
size_t edges[6]; // Ïåðâûå òðè ðåáðà îòõîäÿò î âåðøèíû 0 ê âåðøèíàì 1, 2 è 3
// Îñòàëüíûå ðåáðà 1->2, 2->3, 3->1
Vector4f normal;
bool operator == (const Tetrahedron &);
};
// TODO: rename members
std::vector<Vector4f> vertices;
std::vector<Edge> edges;
std::vector<Tetrahedron> tetrahedrons;
size_t AddEdge(size_t, size_t);
};
#endif //__FourDimensionalObject_h_