5 const double PI
= 3.14159265358979323846;
7 Linha::Linha(double x1
,double y1
,double x2
, double y2
) {
14 Rect::Rect(double x1
,double y1
,double x2
, double y2
) {
22 void Rect::normaliza() {
23 double xmin
,xmax
,ymin
,ymax
;
24 xmin
= std::min(vertices
[0].x
,vertices
[1].x
);
25 xmax
= std::max(vertices
[0].x
,vertices
[1].x
);
26 ymin
= std::min(vertices
[0].y
,vertices
[1].y
);
27 ymax
= std::max(vertices
[0].y
,vertices
[1].y
);
34 void Linha::desenha() {
37 glVertex3f(vertices
[0].x
, vertices
[0].y
, 0.0f
); // origin of the line
38 glVertex3f(vertices
[1].x
, vertices
[1].y
, 0.0f
); // origin of the line
42 void drawCircle(double radius
, int lines
)
44 double i2rad
= PI
/(lines
/2.0);
45 glBegin(GL_LINE_LOOP
);
46 for (int i
=0; i
< lines
; i
++) {
47 double degInRad
= i
*i2rad
;
48 glVertex2f(cos(degInRad
)*radius
,sin(degInRad
)*radius
);