-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCircleComparer.java
58 lines (55 loc) · 1.1 KB
/
CircleComparer.java
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package Projects;
public class CircleComparer {
int axAxis;
int ayAxis;
int aSize;
int axCenter;
int ayCenter;
int bxAxis;
int byAxis;
int bSize;
int bxCenter;
int byCenter;
int centerxDistance;
int centeryDistance;
int rDistance;
public CircleComparer() {
}
public boolean compare(int a, int b, int c, int x, int y, int z) {
axAxis = a;
ayAxis = b;
aSize = c;
bxAxis = x;
byAxis = y;
bSize = z;
calcCenter();
Distance();
if(compareDistances()) {
return true;
}
return false;
}
public void calcCenter() {
axCenter = axAxis + (aSize/2);
ayCenter = ayAxis + (aSize/2);
bxCenter = bxAxis + (bSize/2);
byCenter = byAxis + (bSize/2);
}
public void Distance() {
centerxDistance = Math.abs(axCenter - bxCenter);
centeryDistance = Math.abs(ayCenter - byCenter);
rDistance = (aSize/2) + (bSize/2);
}
public boolean compareDistances() {
if (centerxDistance < rDistance && centeryDistance < rDistance){
return true;
}
return false;
}
public int centerxDistance() {
return centerxDistance;
}
public int centeryDistance() {
return centeryDistance;
}
}