void drawSpirograph(void){
float Rad=80; //fixed radius
float MRad=32; //Mov rad
float o= 30; // offset
float Amp=10;
float Amp2=80;
int A;
float Frequency=4;
float Phase=8;
Vec2d P;
Vec2d center(500,400);
glBegin(GL_LINE_STRIP);
for(A = 0; A< numPoints; A++){
P.x = (Rad +MRad)*cos_deg(A)-(MRad +o)* cos_deg(((Rad+MRad)/MRad)*A);
P.y = (Rad +MRad)*sin_deg(A)-(MRad +o)* sin_deg(((Rad+MRad)/MRad)*A);
P.x+= Amp2* sin_deg(A*Frequency+Phase);
P.y+= Amp* sin_deg(A*Frequency);
P = P+ center;
glVertex2f(P.x, P.y);
VectList1 [A]=P;
}
glEnd();
}
void drawSpirograph2(void){
float Rad=80; //fixed radius
float MRad=-10; //Mov rad
float o= 30; // offset
float Amp=10;
float Amp2=80;
int A;
float Frequency=4;
float Phase=8;
Vec2d Q;
Vec2d center(180,100);
glBegin(GL_LINE_STRIP);
for(A = 0; A< numPoints; A++){
Q.x = (Rad +MRad)*cos_deg(A)-(MRad +o)* cos_deg(((Rad+MRad)/MRad)*A);
Q.y = (Rad +MRad)*sin_deg(A)-(MRad +o)* sin_deg(((Rad+MRad)/MRad)*A);
Q.x+= Amp2* sin_deg(A*Frequency+Phase);
Q.y+= Amp* sin_deg(A*Frequency);
Q = Q+ center;
glColor3f(0, 0,0);
glVertex2f(Q.x, Q.y);
VectList2 [A]=Q;
}
glEnd();
}
void drawSteps(int steps){
float dp= 1.0/steps;
//glPointSize(3);
for( float p=0; p<=1.001; p+=dp){
for(int j=0; j<numPoints; j++){
//FILE* F = fopen ( "my_test.ps", "w" );
glBegin(GL_LINE_STRIP);
Vec2d C = LERP(VectList1[j],VectList2[j],p);
glColor3f(0.5, p,j);
//printf( "text goes here" );
glVertex2f(C.x, C.y);
//fclose( F );
}
glEnd();
}
}
