#include "qline.h"
#include "qdebug.h"
#include "qdatastream.h"
#include <private/qnumeric_p.h>
#include <math.h>
Include dependency graph for qline.cpp:

Go to the source code of this file.
Defines | |
| #define | M_2PI 6.28318530717958647692528676655900576 |
| #define | SAME_SIGNS(a, b) ((a) * (b) >= 0) |
Functions | |
| QDebug | operator<< (QDebug d, const QLine &p) |
| static bool | qt_linef_intersect (qreal x1, qreal y1, qreal x2, qreal y2, qreal x3, qreal y3, qreal x4, qreal y4) |
| QDebug | operator<< (QDebug d, const QLineF &p) |
| #define M_2PI 6.28318530717958647692528676655900576 |
| #define SAME_SIGNS | ( | a, | |||
| b | ) | ((a) * (b) >= 0) |
| static bool qt_linef_intersect | ( | qreal | x1, | |
| qreal | y1, | |||
| qreal | x2, | |||
| qreal | y2, | |||
| qreal | x3, | |||
| qreal | y3, | |||
| qreal | x4, | |||
| qreal | y4 | |||
| ) | [static] |
Definition at line 504 of file qline.cpp.
References SAME_SIGNS.
Referenced by QLineF::intersect().
00506 { 00507 qreal a1, a2, b1, b2, c1, c2; /* Coefficients of line eqns. */ 00508 qreal r1, r2, r3, r4; /* 'Sign' values */ 00509 00510 a1 = y2 - y1; 00511 b1 = x1 - x2; 00512 c1 = x2 * y1 - x1 * y2; 00513 00514 r3 = a1 * x3 + b1 * y3 + c1; 00515 r4 = a1 * x4 + b1 * y4 + c1; 00516 00517 if ( r3 != 0 && r4 != 0 && SAME_SIGNS( r3, r4 )) 00518 return false; 00519 00520 a2 = y4 - y3; 00521 b2 = x3 - x4; 00522 c2 = x4 * y3 - x3 * y4; 00523 00524 r1 = a2 * x1 + b2 * y1 + c2; 00525 r2 = a2 * x2 + b2 * y2 + c2; 00526 00527 if ( r1 != 0 && r2 != 0 && SAME_SIGNS( r1, r2 )) 00528 return false; 00529 00530 return true; 00531 }
1.5.1