| 236 | } |
| 237 | |
| 238 | bool Vec2::isLineIntersect(const Vec2& A, const Vec2& B, const Vec2& C, const Vec2& D, float* S, float* T) |
| 239 | { |
| 240 | // FAIL: Line undefined |
| 241 | if ((A.x == B.x && A.y == B.y) || (C.x == D.x && C.y == D.y)) |
| 242 | { |
| 243 | return false; |
| 244 | } |
| 245 | |
| 246 | const float denom = crossProduct2Vector(A, B, C, D); |
| 247 | |
| 248 | if (denom == 0) |
| 249 | { |
| 250 | // Lines parallel or overlap |
| 251 | return false; |
| 252 | } |
| 253 | |
| 254 | if (S != nullptr) |
| 255 | *S = crossProduct2Vector(C, D, C, A) / denom; |
| 256 | if (T != nullptr) |
| 257 | *T = crossProduct2Vector(A, B, C, A) / denom; |
| 258 | |
| 259 | return true; |
| 260 | } |
| 261 | |
| 262 | bool Vec2::isLineParallel(const Vec2& A, const Vec2& B, const Vec2& C, const Vec2& D) |
| 263 | { |
nothing calls this directly
no test coverage detected