Bounding boxes

«*»= void RecalcConnectionBox(Item *t) UInt max_x=0,min_x,max_y,min_y; UInt i;

return;

if(t->type != CONNECTION) return;

if(t->itemdata.con.vertexnum<1) t->bounds.topLeft.x=0; t->bounds.topLeft.y=0; t->bounds.extent.x=0; t->bounds.extent.y=0; return;

min_x=max_x=t->itemdata.con.vertices[0].x; min_y=max_y=t->itemdata.con.vertices[0].y;

for(i=1;i<t->itemdata.con.vertexnum;i++) min_x=MIN(min_x,t->itemdata.con.vertices[i].x); min_y=MIN(min_y,t->itemdata.con.vertices[i].y); max_x=MAX(max_x,t->itemdata.con.vertices[i].x); max_y=MAX(max_y,t->itemdata.con.vertices[i].y); t->bounds.topLeft.x=min_x; t->bounds.topLeft.y=min_y; t->bounds.extent.x=max_x-min_x; t->bounds.extent.y=max_y-min_y;

void RecalcConnectionExtents(Section *sec) UInt i;

for(i=0;i<sec->itemNum;i++) if(sec->items[i].type == CONNECTION) RecalcConnectionBox(&sec->items[i]); @