salaaaaaaaaaaaaaaaaaam
ejra gereftam
ye soal dige daram chetori mishe ye mokhtasate dorost be in noghat dad
man mikham harfe masalan harfe noon(ن) be hafe lam(ل)tabdil beshe
mokhtasate A[] male harfe noon va araye B[] male harfe lam hast
age kasi mitone mokhtasatesho dorost kone tanxxxxxxxxxxxxxxxxx
//
// ****************************************
#include <Windows.h>
// ****************************************
#include <GL/glut.h>
#include<iostream>
using namespace std;
//class Point2
//{
//public:
// Point2() {x = y = 0.0f;}
// Point2(float xx, float yy,float zz) {x=xx; y=yy;z=zz;}
// void set(float xx, float yy,float zz) {x=xx; y=yy;z=zz;}
// float getX() {return x;}
// float getY() {return y;}
// float getZ() {return z;}
// void draw(void)
// {
// glBegin(GL_POINTS);
// glVertex3f((GLfloat)x, (GLfloat)y,(GLfloat)z);
// glEnd();
// }
//private:
// float x, y,z;
//};
struct Point2{float x;float y;}P;
Point2 CP;
void moveTo(float x, float y)
{
CP.x=x;
CP.y=y;
}
void clearScreen(void)
{
glClear(GL_COLOR_BUFFER_BIT);
}
void lineTo(float x, float y)
{
glBegin(GL_LINES);
glVertex2f(CP.x, CP.y);
glVertex2f(x,y);
glEnd();
CP.x=x;
CP.y=y;
glFlush();
}
Point2 Tween(Point2 A, Point2 B, float t)
{
Point2 P;
P.x=(A.x+(B.x-A.x)*t);
P.y=(A.y+(B.y+A.y)*t);
return P;
}
void drawTween(Point2 A[], Point2 B[], int N, float t)
{
for(int i = 0; i < N; i++)
{
Point2 P;
P = Tween(A[i], B[i], t);
if (i == 0) moveTo(P.x, P.y);
else lineTo(P.x, P.y);
}
// ****************************************
clearScreen();
Sleep(200);
// ****************************************
}
void SetArg(float x, float y,Point2 z){
z.x=x;
z.y=y;
}
void myDisplay(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0, 1.0, 0.0);
clearScreen();
Point2 A[20];
Point2 B[20];
/* SetArg(0.4,0.4,A[0]);
SetArg(0.5,0.3,A[1]);
SetArg(0.6,0.3,A[2]);
SetArg(0.7,0.4,A[3]);
SetArg(0.8,0.5,A[4]);
SetArg(0.8,0.6,A[5]);
SetArg(0.8,0.9,A[6]);
SetArg(0.7,0.9,A[7]);
SetArg(0.7,0.5,A[8]);
SetArg(0.6,0.4,A[9]);
SetArg(0.5,0.4,A[10]);
SetArg(0.4,0.5,A[11]);
SetArg(0.4,0.4,A[12]);
*/
A[0].x=0.4;
A[0].y=0.4;
A[1].x=0.5;
A[1].y=0.3;
A[2].x=0.6;
A[2].y=0.3;
A[3].x=0.7;
A[3].y=0.4;
A[4].x=0.8;
A[4].y=0.5;
A[5].x=0.8;
A[5].y=0.6;
A[6].x=0.8;
A[6].y=0.9;
A[7].x=0.7;
A[7].y=0.9;
A[8].x=0.7;
A[8].y=0.5;
A[9].x=0.6;
A[9].y=0.4;
A[10].x=0.5;
A[10].y=0.4;
A[11].x=0.4;
A[11].y=0.5;
A[12].x=0.4;
A[12].y=0.4;
/*
SetArg(0.1,0.6,B[0]);
SetArg(0.1,0.3,B[1]);
SetArg(0.2,0.2,B[2]);
SetArg(0.3,0.2,B[3]);
SetArg(0.4,0.2,B[4]);
SetArg(0.5,0.3,B[5]);
SetArg(0.5,0.6,B[6]);
SetArg(0.4,0.6,B[7]);
SetArg(0.4,0.4,B[8]);
SetArg(0.3,0.3,B[9]);
SetArg(0.2,0.4,B[10]);
SetArg(0.2,0.6,B[11]);
SetArg(0.1,0.6,B[12]);
*/
B[0].x=0.1;
B[0].y=0.6;
B[1].x=0.1;
B[1].y=0.3;
B[2].x=0.2;
B[2].y=0.2;
B[3].x=0.3;
B[3].y=0.2;
B[4].x=0.4;
B[4].y=0.2;
B[5].x=0.5;
B[5].y=0.4;
B[6].x=0.5;
B[6].y=0.6;
B[7].x=0.4;
B[7].y=0.6;
B[8].x=0.4;
B[8].y=0.4;
B[9].x=0.3;
B[9].y=0.3;
B[10].x=0.2;
B[10].y=0.4;
B[11].x=0.2;
B[11].y=0.6;
B[12].x=0.1;
B[12].y=0.6;
float t = 0.0;
int N = 10;
float tinc = 1.0/N;
for (int i = 0; i <= N; i++)
{
drawTween(A, B, 5, t);
t = t + tinc;
}
}
int main(int argc, char **argv)
{
glutInit(&argc, argv);
glClearColor(1.0, 1.0, 1.0, 0.0);
glColor3f(0.0, 0.0, 0.0);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowPosition(0, 0);
glutInitWindowSize(800, 800);
glutCreateWindow("nike");
glShadeModel(GL_FLAT);
glutDisplayFunc(myDisplay);
glutMainLoop();
return 0;
}