| 3279 | }; |
| 3280 | |
| 3281 | static void insertInterval(dtSegInterval* ints, int& nints, const int maxInts, |
| 3282 | const short tmin, const short tmax, const dtPolyRef ref) |
| 3283 | { |
| 3284 | if (nints+1 > maxInts) return; |
| 3285 | // Find insertion point. |
| 3286 | int idx = 0; |
| 3287 | while (idx < nints) |
| 3288 | { |
| 3289 | if (tmax <= ints[idx].tmin) |
| 3290 | break; |
| 3291 | idx++; |
| 3292 | } |
| 3293 | // Move current results. |
| 3294 | if (nints-idx) |
| 3295 | memmove(ints+idx+1, ints+idx, sizeof(dtSegInterval)*(nints-idx)); |
| 3296 | // Store |
| 3297 | ints[idx].ref = ref; |
| 3298 | ints[idx].tmin = tmin; |
| 3299 | ints[idx].tmax = tmax; |
| 3300 | nints++; |
| 3301 | } |
| 3302 | |
| 3303 | /// @par |
| 3304 | /// |