-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgeometry.cpp
More file actions
36 lines (34 loc) · 778 Bytes
/
Copy pathgeometry.cpp
File metadata and controls
36 lines (34 loc) · 778 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include "geometry.h"
Point::Point(GLfloat xCor, GLfloat yCor){
x = xCor;
y = yCor;
}
int isInSquare(Point p, Point bLeft, float s){
if(p.x > (bLeft.x + s) && p.y > (bLeft.y + s)){
return 1;
}
else if(p.x > (bLeft.x + s) && p.y > bLeft.y && p.y < (bLeft.y + s)){
return 2;
}
else if(p.x > (bLeft.x + s) && p.y < (bLeft.y)){
return 3;
}
else if(p.x > bLeft.x && p.x < (bLeft.x + s) && p.y < bLeft.y){
return 4;
}
else if(p.x < bLeft.x && p.y < bLeft.y){
return 5;
}
else if(p.x < bLeft.x && p.y > bLeft.y && p.y < (bLeft.y + s)){
return 6;
}
else if(p.x < bLeft.x && p.y > (bLeft.y + s)){
return 7;
}
else if(p.x > bLeft.x && p.x < (bLeft.x + s) && p.y > (bLeft.y+s)){
return 8;
}
else{
return 0;
}
}