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