示例#1
0
void BuildEdgeList(ILuint cnt, ILpointi *pts, Edge **edges)
{
	Edge *edge;
	ILpointi v1, v2;
	ILuint i;
	ILint yPrev = pts[cnt - 2].y;

	v1.x = pts[cnt-1].x;
	v1.y = pts[cnt-1].y;

	for (i = 0; i < cnt; i++) {
		v2 = pts[i];
		if (v1.y != v2.y) {			// nonhorizontal line
			edge = (Edge*)ialloc(sizeof(Edge));
			if (v1.y < v2.y) {		// up-going edge
				MakeEdgeRec(v1, v2, yNext(i, cnt, pts), edge, edges);
			}
			else {					// down-going edge
				MakeEdgeRec(v2, v1, yPrev, edge, edges);
			}
		}
		yPrev = v1.y;
		v1 = v2;
	}
}
示例#2
0
文件: freeselect.c 项目: jalkanen/ppt
///
/// BuildEdgeList()
VOID BuildEdgeList( int cnt, Point *pts, EdgePtr *edges )
{
    EdgePtr edge;
    Point v1,v2;
    int yPrev,i;

    D(bug("\tBuildEdgeList(cnt=%d)\n",cnt));

    v1 = pts[cnt-1];
    yPrev = pts[cnt-2].y;
    for( i = 0; i < cnt; i++ ) {
        v2 = pts[i];

        if( v1.y != v2.y ) {
            /* non-horizontal line */
            edge = smalloc( sizeof( EdgeRec ) );
            bzero(edge,sizeof(edge));

            if( v1.y < v2.y )
                MakeEdgeRec( v1, v2, YNext(i,cnt,pts), edges, edge );
            else
                MakeEdgeRec( v2, v1, yPrev, edges, edge );
        }

        yPrev = v1.y;
        v1 = v2;
    }
}