Line | |
---|
1 | #include "Tetrahedron3.h"
|
---|
2 |
|
---|
3 |
|
---|
4 | float Tetrahedron3::GetArea() const
|
---|
5 | {
|
---|
6 | float area = 0;
|
---|
7 | for (int i = 0; i < 4; ++ i)
|
---|
8 | area += GetTriangle(i).GetArea();
|
---|
9 |
|
---|
10 | return area;
|
---|
11 | }
|
---|
12 |
|
---|
13 |
|
---|
14 | float Tetrahedron3::GetVolume() const
|
---|
15 | {
|
---|
16 | const Vector3 a = mVertices[2] - mVertices[1];
|
---|
17 | const Vector3 b = mVertices[3] - mVertices[1];
|
---|
18 | const Vector3 c = mVertices[4] - mVertices[1];
|
---|
19 |
|
---|
20 | return (1.0f / 6.0f) * fabs(DotProd(a, CrossProd(b, c)));
|
---|
21 | }
|
---|
22 |
|
---|
23 |
|
---|
24 | bool Tetrahedron3::Valid() const
|
---|
25 | {
|
---|
26 | return true;
|
---|
27 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.