Returns true iff the diagonal (i,j) is strictly internal to the polygon P in the neighborhood of the i endpoint.
| 267 | // Returns true iff the diagonal (i,j) is strictly internal to the |
| 268 | // polygon P in the neighborhood of the i endpoint. |
| 269 | static bool inCone(int i, int j, int n, const int* verts, int* indices) |
| 270 | { |
| 271 | const int* pi = &verts[(indices[i] & 0x0fffffff) * 4]; |
| 272 | const int* pj = &verts[(indices[j] & 0x0fffffff) * 4]; |
| 273 | const int* pi1 = &verts[(indices[next(i, n)] & 0x0fffffff) * 4]; |
| 274 | const int* pin1 = &verts[(indices[prev(i, n)] & 0x0fffffff) * 4]; |
| 275 | |
| 276 | // If P[i] is a convex vertex [ i+1 left or on (i-1,i) ]. |
| 277 | if (leftOn(pin1, pi, pi1)) |
| 278 | return left(pi, pj, pin1) && left(pj, pi, pi1); |
| 279 | // Assume (i-1,i,i+1) not collinear. |
| 280 | // else P[i] is reflex. |
| 281 | return !(leftOn(pi, pj, pi1) && leftOn(pj, pi, pin1)); |
| 282 | } |
| 283 | |
| 284 | // Returns T iff (v_i, v_j) is a proper internal |
| 285 | // diagonal of P. |