You are on page 1of 1

// cobacardioid.cpp : Defines the entry point for the console application.

#include
#include
#include
#include

"stdafx.h"
<windows.h>
<GL/glut.h>
<math.h>

const double PI = 3.141592653589793;


void Draw(void);
int i,radius,jumlah_titik,x_tengah,y_tengah;
void Initialize() {
glClearColor(1.0, 1.0, 1.0, 1.0);
glLoadIdentity();
//glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
//glOrtho2D(0.0, 0.0, 0.0, 0.0);
}
int main(int iArgc, char** cppArgv){
glutInit(&iArgc, cppArgv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowPosition(200, 200);
glutInitWindowSize(700, 500);
gluOrtho2D(-150.0, 150.0, -150.0, 150.0);
glutCreateWindow("Circle");
Initialize();
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}
void Draw(){
glBegin(GL_LINE_STRIP);
static const float pi = 3.1415926535897932384626433832795029f;
for(float angle = 0.0f; angle < (pi * 2.0f); angle += 0.05f)
{
float x = 2.0f * cos(angle) * (2.0f * cos(3*angle));//tree leaf
float y = 2.0f * sin(angle) * (2.0f * cos(3*angle));
glVertex3f(x/10, y/10, 0.0f);
//float x = 2.0f * cos(angle) * (0.5f - cos(angle));//l
imazon
//
//

float y = 2.0f * sin(angle) * (0.5f - cos(angle));


glVertex3f(x/10, y/10, 0.0f);
//float x = 2.0f * cos(angle) * (1.0f - cos(angle));//c

ardioid
//
//

float y = 2.0f * sin(angle) * (1.0f - cos(angle));


glVertex3f(x/10, y/10, 0.0f);

}
glEnd();
glFlush();
}

You might also like