/* * decomposition.c * --------------- * ji Mar 25, 1987 * * separate overlapping chromosomes * */ #include #include #include #include #include over_split(inobj, objlist, num, parent) struct object *inobj; struct object **objlist; int *num, parent; { struct polygondomain *plgd, *boundary(); struct object *obj, *sobj[2]; struct object *disoverlap(), *distouching(); struct polygondomain *ptr; struct polygondomain *ovortouch(); struct object *splithole(), *ibound(); struct boundlist *blist; int i; struct chromplist *plist; /* * if there is a hole split it at first */ obj = inobj; blist = (struct boundlist *) ibound(obj, 1)->idom; if(blist->down != 0){ obj = splithole(obj, blist); plgd = boundary(obj, 0); } else plgd = blist->poly; /* * test if it is an overlapping chromsome */ if((ptr = ovortouch(obj, plgd)) == NULL){ fprintf(stderr,"The object is not overlaps \n"); return(0); } else { switch(ptr->nvertices){ case 3: fprintf(stderr,"this is a touching or uncomplete overlap object, try other program\n"); /* objlist[0] = distouching(obj, ptr->vtx); */ return(0); case 5: sobj[0] = disoverlap(obj, ptr->vtx); break; default: sobj[0] = obj; sobj[0]->assoc = NULL; } } sobj[1] = sobj[0]->assoc; for(i = 0; i < 2; i++){ sobj[i]->plist = (struct propertylist *) makechromplist(); plist = (struct chromplist *) sobj[i]->plist; plist->pnumber = parent; plist->history[2] = 1; restoregrey(sobj[i], inobj); objlist[*num] = sobj[i]; num++; } free(plgd); return(1); }