Lógica de movimentação (e continua o erro no construtor do Controle...)
[Projeto-PCG.git] / geometry.cpp
blobecf1c82e56a4e72436c61f170aecbeb6e74908b2
1 #include "geometry.h"
2 #include "math.h"
4 const double PI = 3.14159265358979323846;
6 Linha::Linha(double x1,double y1,double x2, double y2) {
7 vertices[0].x = x1;
8 vertices[0].y = y1;
9 vertices[1].x = x2;
10 vertices[1].y = y2;
13 void Linha::desenha() {
14 glColor3f(0,0,0);
15 glBegin(GL_LINES);
16 glVertex3f(vertices[0].x, vertices[0].y, 0.0f); // origin of the line
17 glVertex3f(vertices[1].x, vertices[1].y, 0.0f); // origin of the line
18 glEnd( );
21 void drawCircle(double radius, int lines)
23 double i2rad = PI/(lines/2.0);
24 glBegin(GL_LINE_LOOP);
25 for (int i=0; i < lines; i++) {
26 double degInRad = i*i2rad;
27 glVertex2f(cos(degInRad)*radius,sin(degInRad)*radius);
30 glEnd();