- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCircle.java
More file actions
Latest commit
29 lines (24 loc) · 653 Bytes
/
Copy pathCircle.java
File metadata and controls
29 lines (24 loc) · 653 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
publicclassCircle {
privateintradius;
privatePointcenter;
publicCircle(intradius, Pointcenter) {
this.radius = radius;
this.center = center;
}
publicintgetRadius() {
returnradius;
}
publicvoidsetRadius(intradius) {
this.radius = radius;
}
publicPointgetCenter() {
returncenter;
}
publicvoidsetCenter(Pointcenter) {
this.center = center;
}
publicbooleanintersect(Circlec) {
// if (dist. between cent1 and cent2) <= (rad1 + rad2)
return (center.distanceto(c.getCenter()) <= (radius + c.getRadius()));
}
}