#include "graphics.h"
#include "math.h"
#define STEP 1
#define MYCOLOR WHITE
#define DELAY 10000
void initGraph(){
int gmode,gdriver=DETECT;
initgraph(&gdriver, &gmode, "");
}
void blendingPoint(float x,float y,float path,int angle){
float i,stepX,stepY;
angle = 360 - (angle%360);
stepX = cos(angle*(M_PI/180.0))*STEP,stepY = sin(angle*(M_PI/180.0))*STEP;
/*printf("%d,%f,%f",angle,stepX,stepY);
getch();*/
for(i=0;i<path;i+=STEP)
{
putpixel(x += stepX,y += stepY,MYCOLOR);
delay(DELAY);
cleardevice();
}
}
void blendingLineMove(float x,float y,float dx,float dy,float length,int angle)
{
dx /= (angle/STEP);dy /= (angle/STEP);
angle = 360 - (angle%360);
/*printf("%d,%f,%f",angle,dx,dy);
printf("%f,%f",dx,dy);
getch();*/
while(angle < 360)
{
cleardevice();
line(x += dx,y += dy,cos(angle*(M_PI/180.0))*length+x,sin(angle*(M_PI/180.0))*length+y);
delay(DELAY);
angle+=STEP;
}
}
void blendingLine(float x,float y,float length,int angle)
{
blendingLineMove(x,y,0,0,length,angle);
}
void blendingpoly(float poly[],float x,float y,float dx,float dy,int angle)
{
}
main()
{
float x,y,dx,dy,length,angle;
x=100;y=200;dx=300;dy=100;length=100;angle=90;
initGraph();
getch();
blendingPoint(x,y,length,angle);
/*getch();*/
blendingLineMove(x,y,dx,dy,length,angle);
getch();
closegraph();
}
#include "math.h"
#define STEP 1
#define MYCOLOR WHITE
#define DELAY 10000
void initGraph(){
int gmode,gdriver=DETECT;
initgraph(&gdriver, &gmode, "");
}
void blendingPoint(float x,float y,float path,int angle){
float i,stepX,stepY;
angle = 360 - (angle%360);
stepX = cos(angle*(M_PI/180.0))*STEP,stepY = sin(angle*(M_PI/180.0))*STEP;
/*printf("%d,%f,%f",angle,stepX,stepY);
getch();*/
for(i=0;i<path;i+=STEP)
{
putpixel(x += stepX,y += stepY,MYCOLOR);
delay(DELAY);
cleardevice();
}
}
void blendingLineMove(float x,float y,float dx,float dy,float length,int angle)
{
dx /= (angle/STEP);dy /= (angle/STEP);
angle = 360 - (angle%360);
/*printf("%d,%f,%f",angle,dx,dy);
printf("%f,%f",dx,dy);
getch();*/
while(angle < 360)
{
cleardevice();
line(x += dx,y += dy,cos(angle*(M_PI/180.0))*length+x,sin(angle*(M_PI/180.0))*length+y);
delay(DELAY);
angle+=STEP;
}
}
void blendingLine(float x,float y,float length,int angle)
{
blendingLineMove(x,y,0,0,length,angle);
}
void blendingpoly(float poly[],float x,float y,float dx,float dy,int angle)
{
}
main()
{
float x,y,dx,dy,length,angle;
x=100;y=200;dx=300;dy=100;length=100;angle=90;
initGraph();
getch();
blendingPoint(x,y,length,angle);
/*getch();*/
blendingLineMove(x,y,dx,dy,length,angle);
getch();
closegraph();
}
void blendingpoly(float poly[],float x,float y,float dx,float dy,int angle)
{
float cosA,sinA;
angle = 360 - (angle%360);
angle /=STEP;
cosA = cos(angle*(M_PI/180.0));
sinA = sin(angle*(M_PI/180.0));
x = x*cosA - y*sinA;
y = x*sinA + y*cosA;
}
{
float cosA,sinA;
angle = 360 - (angle%360);
angle /=STEP;
cosA = cos(angle*(M_PI/180.0));
sinA = sin(angle*(M_PI/180.0));
x = x*cosA - y*sinA;
y = x*sinA + y*cosA;
}