Returns true iff ab properly intersects cd: they share a point interior to both segments. The properness of the intersection is ensured by using strict leftness.
| 198 | // a point interior to both segments. The properness of the |
| 199 | // intersection is ensured by using strict leftness. |
| 200 | static bool intersectProp(const int* a, const int* b, const int* c, const int* d) |
| 201 | { |
| 202 | // Eliminate improper cases. |
| 203 | if (collinear(a,b,c) || collinear(a,b,d) || |
| 204 | collinear(c,d,a) || collinear(c,d,b)) |
| 205 | return false; |
| 206 | |
| 207 | return xorb(left(a,b,c), left(a,b,d)) && xorb(left(c,d,a), left(c,d,b)); |
| 208 | } |
| 209 | |
| 210 | // Returns T iff (a,b,c) are collinear and point c lies |
| 211 | // on the closed segement ab. |
no test coverage detected