1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| struct circle { Vector pt; double r; circle() {} circle(double x, double y, double z) { pt = Vector(x, y); r = z; } circle(int i) { scanf("%lf%lf%lf", &pt.x, &pt.y, &r); } inline double Area() { return PI * r*r; } inline bool Intersect(circle C) { double len = (C.pt - pt).Length(); return Compare(len, (C.r + r)) < 0 && Compare(len, fabs(C.r - r)) > 0; } inline bool Inscribe(circle C) { return Compare((C.pt - pt).Length(), fabs(C.r - r)) == 0; } inline bool External_Cutting(circle C) { return Compare((C.pt - pt).Length(), fabs(C.r + r)) == 0; } inline double Perimeter() { return PI * 2 * r; } };
|