Exemplo n.º 1
0
static ScFillVert *addedgetoscanlist(EditEdge *eed, int len)
{
	/* inserts edge at correct location in ScFillVert list */
	/* returns sc when edge already exists */
	ScFillVert *sc,scsearch;
	EditVert *eve;

	/* which vert is left-top? */
	if(eed->v1->co[coy] == eed->v2->co[coy]) {
		if(eed->v1->co[cox] > eed->v2->co[cox]) {
			eve= eed->v1;
			eed->v1= eed->v2;
			eed->v2= eve;
		}
	}
	else if(eed->v1->co[coy] < eed->v2->co[coy]) {
		eve= eed->v1;
		eed->v1= eed->v2;
		eed->v2= eve;
	}
	/* find location in list */
	scsearch.v1= eed->v1;
	sc= (ScFillVert *)bsearch(&scsearch,scdata,len,
		sizeof(ScFillVert), vergscdata);

	if(sc==0) printf("Error in search edge: %p\n", (void *)eed);
	else if(addedgetoscanvert(sc,eed)==0) return sc;

	return 0;
}
Exemplo n.º 2
0
static ScanFillVertLink *addedgetoscanlist(ScanFillVertLink *scdata, ScanFillEdge *eed, unsigned int len)
{
	/* inserts edge at correct location in ScanFillVertLink list */
	/* returns sc when edge already exists */
	ScanFillVertLink *sc, scsearch;
	ScanFillVert *eve;

	/* which vert is left-top? */
	if (eed->v1->xy[1] == eed->v2->xy[1]) {
		if (eed->v1->xy[0] > eed->v2->xy[0]) {
			eve = eed->v1;
			eed->v1 = eed->v2;
			eed->v2 = eve;
		}
	}
	else if (eed->v1->xy[1] < eed->v2->xy[1]) {
		eve = eed->v1;
		eed->v1 = eed->v2;
		eed->v2 = eve;
	}
	/* find location in list */
	scsearch.vert = eed->v1;
	sc = (ScanFillVertLink *)bsearch(&scsearch, scdata, len,
	                                 sizeof(ScanFillVertLink), vergscdata);

	if (UNLIKELY(sc == NULL)) {
		printf("Error in search edge: %p\n", (void *)eed);
	}
	else if (addedgetoscanvert(sc, eed) == false) {
		return sc;
	}

	return NULL;
}
Exemplo n.º 3
0
static ScanFillVertLink *addedgetoscanlist(ScanFillContext *sf_ctx, ScanFillEdge *eed, int len)
{
	/* inserts edge at correct location in ScanFillVertLink list */
	/* returns sc when edge already exists */
	ScanFillVertLink *sc, scsearch;
	ScanFillVert *eve;

	/* which vert is left-top? */
	if (eed->v1->xy[1] == eed->v2->xy[1]) {
		if (eed->v1->xy[0] > eed->v2->xy[0]) {
			eve = eed->v1;
			eed->v1 = eed->v2;
			eed->v2 = eve;
		}
	}
	else if (eed->v1->xy[1] < eed->v2->xy[1]) {
		eve = eed->v1;
		eed->v1 = eed->v2;
		eed->v2 = eve;
	}
	/* find location in list */
	scsearch.vert = eed->v1;
	sc = (ScanFillVertLink *)bsearch(&scsearch, sf_ctx->_scdata, len,
	                                 sizeof(ScanFillVertLink), vergscdata);

	if (sc == 0) printf("Error in search edge: %p\n", (void *)eed);
	else if (addedgetoscanvert(sc, eed) == 0) return sc;

	return 0;
}