Index: src/route-rnd/rtpoly.c =================================================================== --- src/route-rnd/rtpoly.c (revision 1470) +++ src/route-rnd/rtpoly.c (revision 1471) @@ -85,6 +85,18 @@ { rtp_vertex_t *v, *vn; + for(v = gdl_first(&poly->lst); v != NULL; v = gdl_next(&poly->lst, v)) { + vn = gdl_next(&poly->lst, v); + if (vn == NULL) vn = gdl_first(&poly->lst); + poly->area += (v->x - vn->x) * (v->y + vn->y); + } + + /* make sure about the orientation */ + if (poly->area < 0) { + gdl_reverse(&poly->lst); + poly->area = -poly->area; + } + poly->bbox = g2d_box_invalid(); for(v = gdl_first(&poly->lst); v != NULL; v = gdl_next(&poly->lst, v)) { g2d_vect_t pt; @@ -95,17 +107,11 @@ v->bbox.x2 = RTP_MAX(v->x, vn->x); v->bbox.y2 = RTP_MAX(v->y, vn->y); rtrnd_rtree_insert(&poly->tree, v, &v->bbox); - poly->area += (v->x - vn->x) * (v->y + vn->y); pt.x = v->x; pt.y = v->y; g2d_box_bump_pt(&poly->bbox, pt); } - /* make sure about the orientation */ - if (poly->area < 0) { - gdl_reverse(&poly->lst); - poly->area = -poly->area; - } poly->area /= 2; poly->valid = rtpoly_is_valid_selfi(poly) && (poly->lst.length > 2);