@return true if the polygons of other and this overlap.
| 302 | |
| 303 | /// @return true if the polygons of other and this overlap. |
| 304 | bool POLY_BLOCK::overlap(POLY_BLOCK *other) { |
| 305 | inT16 count; // winding count |
| 306 | ICOORDELT_IT it = &vertices; // iterator |
| 307 | ICOORD vertex; |
| 308 | |
| 309 | if (!box.overlap(*(other->bounding_box()))) |
| 310 | return false; // can't be any overlap. |
| 311 | |
| 312 | /* see if a vertex of this is inside other */ |
| 313 | |
| 314 | do { |
| 315 | vertex = *it.data (); |
| 316 | // get winding number |
| 317 | count = other->winding_number (vertex); |
| 318 | if (count != INTERSECTING) |
| 319 | if (count != 0) |
| 320 | return true; |
| 321 | it.forward (); |
| 322 | } |
| 323 | while (!it.at_first ()); |
| 324 | |
| 325 | /* see if a vertex of other is inside this */ |
| 326 | |
| 327 | // switch lists |
| 328 | it.set_to_list (other->points ()); |
| 329 | do { |
| 330 | vertex = *it.data(); |
| 331 | // try other way round |
| 332 | count = winding_number (vertex); |
| 333 | if (count != INTERSECTING) |
| 334 | if (count != 0) |
| 335 | return true; |
| 336 | it.forward (); |
| 337 | } |
| 338 | while (!it.at_first ()); |
| 339 | return false; |
| 340 | } |
| 341 | |
| 342 | |
| 343 | ICOORDELT_LIST *PB_LINE_IT::get_line(inT16 y) { |
no test coverage detected