Flamethrower decente ateh
[Projeto-PCG.git] / geometry.h
blobcb8b5ad6233d3199293ba65caf071e3a55335e02
1 #ifndef GEOMETRIA_H
2 #define GEOMETRIA_H
3 #include "SDL/SDL.h"
4 #include "SDL/SDL_opengl.h"
5 #include <vector>
7 const double PI = 3.14159265358979323846;
9 struct Ponto {
10 double x,y;
11 Ponto () { }
12 Ponto (double x1, double y1) {x = x1; y = y1;}
15 double distance(const Ponto &a,const Ponto &b);
17 double operator*(const Ponto &a, const Ponto &b);
18 Ponto operator-(const Ponto &a, const Ponto &b);
19 Ponto operator+(const Ponto &a, const Ponto &b);
21 struct Vetor {
22 double x,y;
25 class Linha {
26 public:
27 Ponto vertices[2];
29 void desenha();
30 Linha(double x1,double y1,double x2, double y2);
31 Linha(Ponto a, Ponto b) {vertices[0] = a; vertices[1] = b;}
34 class Rect {
35 private:
36 void normaliza();
37 public:
38 Ponto vertices[2];
39 Rect(double x1,double y1,double x2, double y2);
40 Rect(Ponto a, Ponto b) {vertices[0] = a; vertices[1] = b; normaliza();}
43 class Polygon {
44 private:
45 std::vector<Linha> linhas;
46 public:
47 void addLinha(Linha linha) {linhas.push_back(linha);}
48 void desenha();
51 void drawCircle(double radius, int lines);
53 #endif