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