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