blob: aa15a7f7369f856867013f4d393746cb41ec06cc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
/**
* c_m3d_g_aab.cpp
*
*/
#include "SSystem/SComponent/c_m3d_g_aab.h"
void cM3dGAab::Set(const cXyz* min, const cXyz* max) {
mMin = *min;
mMax = *max;
}
bool cM3dGAab::CrossY(const cXyz* other) const {
if (mMin.x > other->x || mMax.x < other->x || mMin.z > other->z || mMax.z < other->z) {
return false;
} else {
return true;
}
}
bool cM3dGAab::UnderPlaneYUnder(f32 y) const {
if (mMin.y < y) {
return true;
}
return false;
}
bool cM3dGAab::TopPlaneYUnder(f32 y) const {
if (mMax.y < y) {
return true;
}
return false;
}
void cM3dGAab::ClearForMinMax() {
mMin.x = mMin.y = mMin.z = G_CM3D_F_INF;
mMax.x = mMax.y = mMax.z = -G_CM3D_F_INF;
}
void cM3dGAab::SetMinMax(const cXyz& pMinMax) {
this->SetMin(pMinMax);
this->SetMax(pMinMax);
}
void cM3dGAab::SetMinMax(const cM3dGAab& other) {
this->SetMinMax(other.mMin);
this->SetMinMax(other.mMax);
}
void cM3dGAab::SetMin(const cXyz& min) {
if (mMin.x > min.x) {
mMin.x = min.x;
}
if (mMin.y > min.y) {
mMin.y = min.y;
}
if (mMin.z > min.z) {
mMin.z = min.z;
}
}
void cM3dGAab::SetMax(const cXyz& max) {
if (mMax.x < max.x) {
mMax.x = max.x;
}
if (mMax.y < max.y) {
mMax.y = max.y;
}
if (mMax.z < max.z) {
mMax.z = max.z;
}
}
void cM3dGAab::CalcCenter(cXyz* out) const {
PSVECAdd(&mMin, &mMax, out);
PSVECScale(out, out, 0.5f);
}
void cM3dGAab::PlusR(f32 r) {
mMin.x -= r;
mMin.y -= r;
mMin.z -= r;
mMax.x += r;
mMax.y += r;
mMax.z += r;
}
|