source: GTP/trunk/Lib/Vis/Preprocessing/src/Rectangle3.cpp @ 863

Revision 863, 961 bytes checked in by mattausch, 19 years ago (diff)

working on preprocessor integration
added iv stuff

Line 
1#include "Rectangle3.h"
2
3namespace GtpVisibilityPreprocessor {
4
5
6void
7Rectangle3::Split(const int axis,
8                  Rectangle3 &r1,
9                  Rectangle3 &r2
10                  ) const
11{
12  if (axis==0) {
13    Vector3 v1 = (mVertices[0] + mVertices[1])*0.5f;
14    Vector3 v2 = (mVertices[2] + mVertices[3])*0.5f;
15   
16    r1.mVertices[0] = mVertices[0];
17    r1.mVertices[1] = v1;
18    r1.mVertices[2] = v2;
19    r1.mVertices[3] = mVertices[3];
20
21    r2.mVertices[0] = v1;
22    r2.mVertices[1] = mVertices[1];
23    r2.mVertices[2] = mVertices[2];
24    r2.mVertices[3] = v2;
25  } else {
26    Vector3 v1 = (mVertices[0] + mVertices[3])*0.5f;
27    Vector3 v2 = (mVertices[1] + mVertices[2])*0.5f;
28   
29    r1.mVertices[0] = mVertices[0];
30    r1.mVertices[1] = mVertices[1];
31    r1.mVertices[2] = v2;
32    r1.mVertices[3] = v1;
33   
34    r2.mVertices[0] = v1;
35    r2.mVertices[1] = v2;
36    r2.mVertices[2] = mVertices[2];
37    r2.mVertices[3] = mVertices[3];
38  }
39 
40}
41
42}
Note: See TracBrowser for help on using the repository browser.