判断两圆是否重合

public class Point {
	double x;
	double y;
	public Point() {
		x=1.0;
		y=2.0;
	}
	public Point(double x,double y) {
		this.x=x;
		this.y=y;
	}

}

public class Circle {
     Point center;
     double radius;
    public Circle(){
	   center=new Point();
	   radius=1.0;
}
    public Circle(Point p,double radius){
    	this.center=p;
    	this.radius=radius;
}
public void overLap(Circle c) {
	
	
	if(center.x==c.center.x&¢er.y==c.center.y&&this.radius==c.radius)
	{	
		System.out.println("圆c1与c2重叠");
	}
	else
	{
		System.out.println("圆c1与c2不重叠");
	}
	
}
}
public class CircleTest {

	public static void main(String[] args) {
		Circle c1=new Circle();
		Point p1=new Point(2.0,3.0);
		Circle c2=new Circle(p1,2.0);
		c1.overLap(c2);
	}

}


你可能感兴趣的:(判断两圆是否重合)