source: trunk/VUT/GtpVisibilityPreprocessor/src/Triangle3.h @ 191

Revision 191, 756 bytes checked in by bittner, 19 years ago (diff)

basic sampling strategies

Line 
1#ifndef __TRIANGLE3_H
2#define __TRIANGLE3_H
3
4#include "Vector3.h"
5
6struct Triangle3 {
7 
8  Vector3 mVertices[3];
9 
10  Triangle3() {}
11  Triangle3(const Vector3 &a,
12                 const Vector3 &b,
13                 const Vector3 &c
14                 ) {
15    Init(a, b, c);
16  }
17
18  void
19  Init(const Vector3 &a,
20       const Vector3 &b,
21       const Vector3 &c
22       ) {
23    mVertices[0] = a;
24    mVertices[1] = b;
25    mVertices[2] = c;
26   
27  }
28
29  Vector3 GetNormal() const {
30    Vector3 v1=mVertices[0]-mVertices[1], v2=mVertices[2]-mVertices[1];
31    return Normalize(CrossProd(v2,v1));
32  }
33
34  Vector3 GetCenter() const {
35    return (mVertices[0] + mVertices[1] + mVertices[2])/3.0f;
36  }
37
38  float GetSpatialAngle(const Vector3 &point) const;
39};
40
41
42#endif
43
Note: See TracBrowser for help on using the repository browser.