Returns true if a line intersects another line
| 370 | |
| 371 | // Returns true if a line intersects another line |
| 372 | static inline bool LineIntersectsLine(g3Point *ls, g3Point *le, float x1, float y1, float x2, float y2) { |
| 373 | float num, denom; |
| 374 | num = ((ls->p3_sy - y1) * (x2 - x1)) - ((ls->p3_sx - x1) * (y2 - y1)); |
| 375 | denom = ((le->p3_sx - ls->p3_sx) * (y2 - y1)) - ((le->p3_sy - ls->p3_sy) * (x2 - x1)); |
| 376 | float r = num / denom; |
| 377 | if (r >= 0.0 && r <= 1.0) |
| 378 | return true; |
| 379 | num = ((ls->p3_sy - y1) * (le->p3_sx - ls->p3_sx)) - ((ls->p3_sx - x1) * (le->p3_sy - ls->p3_sy)); |
| 380 | denom = ((le->p3_sx - ls->p3_sx) * (y2 - y1)) - ((le->p3_sy - ls->p3_sy) * (x2 - x1)); |
| 381 | float s = num / denom; |
| 382 | if (s >= 0.0 && s <= 1.0) |
| 383 | return true; |
| 384 | return false; |
| 385 | } |
| 386 | // Returns true if a face intersects the passed in portal in any way |
| 387 | static inline bool FaceIntersectsPortal(room *rp, face *fp, clip_wnd *wnd) { |
| 388 | g3Codes cc; |
no outgoing calls
no test coverage detected