Recomputes the bounding box from the points in the loop.
| 223 | |
| 224 | // Recomputes the bounding box from the points in the loop. |
| 225 | void TESSLINE::ComputeBoundingBox() { |
| 226 | int minx = MAX_INT32; |
| 227 | int miny = MAX_INT32; |
| 228 | int maxx = -MAX_INT32; |
| 229 | int maxy = -MAX_INT32; |
| 230 | |
| 231 | // Find boundaries. |
| 232 | start = loop->pos; |
| 233 | EDGEPT* this_edge = loop; |
| 234 | do { |
| 235 | if (!this_edge->IsHidden() || !this_edge->prev->IsHidden()) { |
| 236 | if (this_edge->pos.x < minx) |
| 237 | minx = this_edge->pos.x; |
| 238 | if (this_edge->pos.y < miny) |
| 239 | miny = this_edge->pos.y; |
| 240 | if (this_edge->pos.x > maxx) |
| 241 | maxx = this_edge->pos.x; |
| 242 | if (this_edge->pos.y > maxy) |
| 243 | maxy = this_edge->pos.y; |
| 244 | } |
| 245 | this_edge = this_edge->next; |
| 246 | } while (this_edge != loop); |
| 247 | // Reset bounds. |
| 248 | topleft.x = minx; |
| 249 | topleft.y = maxy; |
| 250 | botright.x = maxx; |
| 251 | botright.y = miny; |
| 252 | } |
| 253 | |
| 254 | // Computes the min and max cross product of the outline points with the |
| 255 | // given vec and returns the results in min_xp and max_xp. Geometrically |
no test coverage detected