C语言中异或显示问题
大家好,我目前编了一个程序,希望可以通过异或显示来实现图形的旋转,但为设么旋转时还是会出现重叠交叉的现象呢,下面是我的程序的源代码,请各位牛人帮忙#include<stdio.h>
#include<graphics.h>
#include<stdlib.h>
#include<dos.h>
#include<conio.h>
#include<math.h>
#define ml 20
#define mw 10
#define mh 10
#define PI 3.14159
#define bkcolor WHITE
#define ftcolor GREEN
void drawmissle1(int x,int y,int angle);
void main()
{
int gd=DETECT,gm;
int i;
initgraph(&gd,&gm,"");
setbkcolor(bkcolor);
setcolor(ftcolor);
for(i=0;i<=180;i++)
{
setwritemode(XOR_PUT);
drawmissle1(100,100,i);
delay(200);
drawmissle1(100,100,i);
}
getch();
closegraph();
}
void drawmissle1(int x,int y,int angle)
{
float b;
b=-angle*PI/180;
int a[11];
a[0]=x;
a[1]=y;
a[2]=x+ml*cos(b);
a[3]=y+ml*sin(b);
a[6]=x+ml*cos(b)+mw*cos(b+PI/2);
a[7]=y+ml*sin(b)+mw*sin(b+PI/2);
a[8]=x+mw*cos(b+PI/2);
a[9]=y+mw*sin(b+PI/2);
a[4]=x+(mw*cos(b+PI/2))/2+(ml+mh)*cos(b);
a[5]=y+(mw*sin(b+PI/2))/2+(ml+mh)*sin(b);
a[10]=x;
a[11]=y;
fillpoly(5,a);
putpixel(a[4],a[5],RED);
}