您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 项目/工程管理 > 三角形的bresenham算法实现
三角形Bresenham画线算法LINE_TPROCNEARPUSHBPMOVBP,SPSUBSP,16MOVWORDPTR[BP-6],0;X=0MOVWORDPTR[BP-8],0;Y=0MOVWORDPTR[BP-14],1;INCX=1MOVWORDPTR[BP-16],1;INCY=1MOVAX,WORDPTR[BP+6];AX=X2SUBAX,WORDPTR[BP+10];AX=X2-X1JNCL1;IFX2=X1,JMPL1NEGAX;IFX2X1,DELTA_X=-DELTA_XMOVWORDPTR[BP-14],-1;INCX=-1L1:CMPAX,0;IFDELTA_X!=0,JMPL11JNEL11MOVWORDPTR[BP-14],0;INCX=0L11:MOVWORDPTR[BP-10],AX;DELTA_X=AXMOVAX,WORDPTR[BP+4];AX=Y2SUBAX,WORDPTR[BP+8];AX=Y2-Y1JNCL2;IFY2=Y1,JMPL2NEGAX;IFY2Y1,DELTA_Y=-DELTA_YMOVWORDPTR[BP-16],-1;INCY=-1L2:;CMPAX,0;IFDELTA_Y!=0,JMPL22JNEL22;MOVWORDPTR[BP-16],0;INCY=0L22:MOVWORDPTR[BP-12],AX;DELTA_Y=AXLP4:MOVAX,WORDPTR[BP-10];AX=DELTA_XCMPAX,WORDPTR[BP-12];JGLP5;DELTA_XDELTA_YMOVAX,WORDPTR[BP-12];MOVWORDPTR[BP-4],AX;DISTANCE=DELTA_YJMPLP51;LP5:MOVAX,WORDPTR[BP-10];MOVWORDPTR[BP-4],AX;DISTANCE=DELTA_XLP51:INCAXMOVWORDPTR[BP-2],AXLP6:PUSHWORDPTR[BP+10]PUSHWORDPTR[BP+8]PUSHCOLORCALLPIXELPUSHCXCALLDELAY_TPOPCXMOVAX,WORDPTR[BP-6];AX=XADDAX,WORDPTR[BP-10];AX=X+DELTA_XMOVWORDPTR[BP-6],AX;X=X+DELTA_XMOVAX,WORDPTR[BP-8];AX=YADDAX,WORDPTR[BP-12];AX=Y+DELTA_YMOVWORDPTR[BP-8],AX;Y=Y+DELTA_YMOVAX,WORDPTR[BP-6];AX=XCMPAX,WORDPTR[BP-4]JLELP7;IFX=DISTANCE,JMPLP7MOVAX,WORDPTR[BP-6];XDISTANCESUBAX,WORDPTR[BP-4];AX=X-DISTANCEMOVWORDPTR[BP-6],AX;X=X-DISTANCEMOVAX,WORDPTR[BP+10];AX=X1ADDAX,WORDPTR[BP-14];AX=X1+INCXMOVWORDPTR[BP+10],AX;X1=X1+INCXLP7:MOVAX,WORDPTR[BP-8];AX=YCMPAX,WORDPTR[BP-4]JLELP8;IFY=DISTANCE,JMPLP8MOVAX,WORDPTR[BP-8];YDISTANCESUBAX,WORDPTR[BP-4];AX=Y-DISTANCEMOVWORDPTR[BP-8],AX;Y=Y-DISTANCEMOVAX,WORDPTR[BP+8];AX=Y1ADDAX,WORDPTR[BP-16];AX=Y1+INCYMOVWORDPTR[BP+8],AX;Y1=Y1+INCYLP8:DECWORDPTR[BP-2];IFT!=0,JMPLP6JZLP9JMPLP6LP9:MOVSP,BPPOPBPRET8LINE_TENDP
本文标题:三角形的bresenham算法实现
链接地址:https://www.777doc.com/doc-2781538 .html