| 174 | } |
| 175 | |
| 176 | bool LuaSTGPlus::OBBAABBHitTest(fcyVec2 P, fcyVec2 Size, float Angle, fcyRect Rect) |
| 177 | { |
| 178 | // �����OBB���ε�4������ |
| 179 | fcyVec2 tFinalPos[2][4] = |
| 180 | { |
| 181 | { |
| 182 | fcyVec2(-Size.x, -Size.y), |
| 183 | fcyVec2(Size.x, -Size.y), |
| 184 | fcyVec2(Size.x, Size.y), |
| 185 | fcyVec2(-Size.x, Size.y) |
| 186 | }, |
| 187 | { |
| 188 | Rect.a, |
| 189 | fcyVec2(Rect.b.x, Rect.a.y), |
| 190 | Rect.b, |
| 191 | fcyVec2(Rect.a.x, Rect.b.y) |
| 192 | } |
| 193 | }; |
| 194 | |
| 195 | float tSin, tCos; |
| 196 | { |
| 197 | /* |
| 198 | tSin = sin(Angle); |
| 199 | tCos = cos(Angle); |
| 200 | */ |
| 201 | SinCos(Angle, tSin, tCos); |
| 202 | |
| 203 | for (int i = 0; i<4; i++) |
| 204 | { |
| 205 | tFinalPos[0][i].RotationSC(tSin, tCos); |
| 206 | tFinalPos[0][i] += P; |
| 207 | } |
| 208 | } |
| 209 | |
| 210 | // ����������������� |
| 211 | for (int i = 0; i<2; i++) |
| 212 | { |
| 213 | fcyVec2 tAxis[2] = |
| 214 | { |
| 215 | tFinalPos[i][1] - tFinalPos[i][0], |
| 216 | tFinalPos[i][2] - tFinalPos[i][1] |
| 217 | }; |
| 218 | |
| 219 | // ������� |
| 220 | tAxis[0].Normalize(); |
| 221 | tAxis[1].Normalize(); |
| 222 | |
| 223 | // ���ͶӰ�߶� |
| 224 | fcyVec2 tAxisLine[2] = |
| 225 | { |
| 226 | fcyVec2(tFinalPos[i][0] * tAxis[0], tFinalPos[i][1] * tAxis[0]), |
| 227 | fcyVec2(tFinalPos[i][1] * tAxis[1], tFinalPos[i][2] * tAxis[1]) |
| 228 | }; |
| 229 | |
| 230 | // ��ÿһ������ |
| 231 | for (int j = 0; j<2; j++) |
| 232 | { |
| 233 | // ������һ���������ϵ�ͶӰ�������߶� |
nothing calls this directly
no test coverage detected