| 63 | */ |
| 64 | |
| 65 | void POLY_BLOCK::compute_bb() { //constructor |
| 66 | ICOORD ibl, itr; //integer bb |
| 67 | ICOORD botleft; //bounding box |
| 68 | ICOORD topright; |
| 69 | ICOORD pos; //current pos; |
| 70 | ICOORDELT_IT pts = &vertices; //iterator |
| 71 | |
| 72 | botleft = *pts.data (); |
| 73 | topright = botleft; |
| 74 | do { |
| 75 | pos = *pts.data (); |
| 76 | if (pos.x () < botleft.x ()) |
| 77 | //get bounding box |
| 78 | botleft = ICOORD (pos.x (), botleft.y ()); |
| 79 | if (pos.y () < botleft.y ()) |
| 80 | botleft = ICOORD (botleft.x (), pos.y ()); |
| 81 | if (pos.x () > topright.x ()) |
| 82 | topright = ICOORD (pos.x (), topright.y ()); |
| 83 | if (pos.y () > topright.y ()) |
| 84 | topright = ICOORD (topright.x (), pos.y ()); |
| 85 | pts.forward (); |
| 86 | } |
| 87 | while (!pts.at_first ()); |
| 88 | ibl = ICOORD (botleft.x (), botleft.y ()); |
| 89 | itr = ICOORD (topright.x (), topright.y ()); |
| 90 | box = TBOX (ibl, itr); |
| 91 | } |
| 92 | |
| 93 | |
| 94 | /** |