public List <Point> Intersection(Cirlce cirlse2) { double distance = VectorOperations.CalcLenghtVector(this.Center, cirlse2.Center); if (this.Radius + cirlse2.Radius < distance || this.Abs(this.Radius + cirlse2.Radius) > distance) { return(null); } else { double catetFirstCircle = ((this.Radius * this.Radius) - (cirlse2.Radius * cirlse2.Radius) + (distance * distance)) / (2 * distance); double hight = Math.Sqrt((this.Radius * this.Radius) - (catetFirstCircle * catetFirstCircle)); double intersectionpointX = this.Center.X + (catetFirstCircle * (cirlse2.Center.X - this.Center.X) / distance); double intersectionpointY = this.Center.Y + (catetFirstCircle * (cirlse2.Center.Y - this.Center.Y) / distance); Point pointForIntersection = new Point(intersectionpointX, intersectionpointY); intersectionpointX = pointForIntersection.X + (hight * (cirlse2.Center.Y - this.Center.Y) / distance); intersectionpointY = pointForIntersection.Y - (hight * (cirlse2.Center.X - this.Center.X) / distance); Point firstResaultPoint = new Point(intersectionpointX, intersectionpointY); intersectionpointX = pointForIntersection.X - (hight * (cirlse2.Center.Y - this.Center.Y) / distance); intersectionpointY = pointForIntersection.Y + (hight * (cirlse2.Center.X - this.Center.X) / distance); Point secondResaultPoint = new Point(intersectionpointX, intersectionpointY); return(new List <Point> { firstResaultPoint, secondResaultPoint }); } }
public void ChangeSize(Point point, Point point2) { this.Center = point; this.PointOnBoard = point2; this.Radius = VectorOperations.CalcLenghtVector(point, point2); }
public Cirlce(Point center, Point pointOnBoard) { this.Center = center; this.PointOnBoard = pointOnBoard; this.Radius = VectorOperations.CalcLenghtVector(center, pointOnBoard); }