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

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

basic sampling strategies

Line 
1#ifndef __RECTANGLE3_H
2#define __RECTANGLE3_H
3
4#include "Vector3.h"
5
6class Rectangle3 {
7public:
8  Vector3 mVertices[4];
9
10  Rectangle3(const Vector3 &v0,
11             const Vector3 &v1,
12             const Vector3 &v2,
13             const Vector3 &v3) {
14    mVertices[0] = v0;
15    mVertices[1] = v1;
16    mVertices[2] = v2;
17    mVertices[3] = v3;
18  }
19 
20  Vector3 GetNormal() {
21    return Normalize(CrossProd(mVertices[0]-mVertices[1],
22                               mVertices[2]-mVertices[1]
23                               ));
24  }
25 
26  Vector3 GetCenter() {
27    return (mVertices[0] + mVertices[1] + mVertices[2] + mVertices[3])/4.0f;
28  }
29
30 
31};
32
33
34#endif
Note: See TracBrowser for help on using the repository browser.