source: GTP/trunk/Lib/Vis/Preprocessing/src/Tetrahedron3.cpp @ 860

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