| 368 | //========================================================================== |
| 369 | |
| 370 | int64_t checkforinside(double x, double y, const DVector2& pt1, const DVector2& pt2) |
| 371 | { |
| 372 | // Perform the checks here in 48.16 fixed point. |
| 373 | // Doing it directly with floats and multiplications does not work reliably due to underflows. |
| 374 | // Unfortunately, due to the conversions, this is a bit slower. :( |
| 375 | int64_t xs = int64_t(0x10000 * (pt1.X - x)); |
| 376 | int64_t ys = int64_t(0x10000 * (pt1.Y - y)); |
| 377 | int64_t xe = int64_t(0x10000 * (pt2.X - x)); |
| 378 | int64_t ye = int64_t(0x10000 * (pt2.Y - y)); |
| 379 | |
| 380 | if ((ys ^ ye) < 0) |
| 381 | { |
| 382 | int64_t val; |
| 383 | |
| 384 | if ((xs ^ xe) >= 0) val = xs; |
| 385 | else val = ((xs * ye) - xe * ys) ^ ye; |
| 386 | return val; |
| 387 | } |
| 388 | return 0; |
| 389 | } |
| 390 | |
| 391 | //========================================================================== |
| 392 | // |
no outgoing calls
no test coverage detected