Line | |
---|
1 | #ifndef __TETRAHEDRON3_H
|
---|
2 | #define __TETRAHEDRON3_H
|
---|
3 |
|
---|
4 | #include "Triangle3.h"
|
---|
5 | #include "Vector3.h"
|
---|
6 |
|
---|
7 | class Tetrahedron3
|
---|
8 | {
|
---|
9 | public:
|
---|
10 | Vector3 mVertices[4];
|
---|
11 |
|
---|
12 | Tetrahedron3() {}
|
---|
13 |
|
---|
14 | Tetrahedron3(const Vector3 &a,
|
---|
15 | const Vector3 &b,
|
---|
16 | const Vector3 &c,
|
---|
17 | const Vector3 &d)
|
---|
18 | {
|
---|
19 | Init(a, b, c, d);
|
---|
20 | }
|
---|
21 |
|
---|
22 | Tetrahedron3(const Triangle3 &t, const Vector3 &a)
|
---|
23 | {
|
---|
24 | Init(t.mVertices[0], t.mVertices[1], t.mVertices[2], a);
|
---|
25 | }
|
---|
26 |
|
---|
27 | void Init(const Vector3 &a,
|
---|
28 | const Vector3 &b,
|
---|
29 | const Vector3 &c,
|
---|
30 | const Vector3 &d)
|
---|
31 | {
|
---|
32 | mVertices[0] = a;
|
---|
33 | mVertices[1] = b;
|
---|
34 | mVertices[2] = c;
|
---|
35 | mVertices[3] = c;
|
---|
36 | }
|
---|
37 |
|
---|
38 | Triangle3 GetTriangle(const int i) const
|
---|
39 | {
|
---|
40 | switch(i)
|
---|
41 | {
|
---|
42 | case 0:
|
---|
43 | return Triangle3(mVertices[0], mVertices[1], mVertices[2]);
|
---|
44 | break;
|
---|
45 | case 1:
|
---|
46 | return Triangle3(mVertices[0], mVertices[1], mVertices[3]);
|
---|
47 | break;
|
---|
48 | case 2:
|
---|
49 | return Triangle3(mVertices[1], mVertices[2], mVertices[3]);
|
---|
50 | break;
|
---|
51 | case 3:
|
---|
52 | return Triangle3(mVertices[0], mVertices[3], mVertices[2]);
|
---|
53 | break;
|
---|
54 | }
|
---|
55 | return Triangle3();
|
---|
56 | }
|
---|
57 |
|
---|
58 |
|
---|
59 | float GetArea() const;
|
---|
60 | float GetVolume() const;
|
---|
61 | bool Valid() const;
|
---|
62 |
|
---|
63 | };
|
---|
64 |
|
---|
65 |
|
---|
66 | #endif
|
---|
67 |
|
---|
Note: See
TracBrowser
for help on using the repository browser.