everyone!
I have a problem with drawing a circle in C#. I need to illustrate the circle with the mouse in WindowsForm, that starts from certain points X and Y. Here is the code that I have, but the method Intersect() doesn't fit the needs of a circle to return the right illustration after that.
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;
namespace KursovaRabotaLibrary
{
[Serializable]
public class Circle : Shape
{
public override int Width { get; set; }
public override int Height { get; set; }
public override bool PointInShape(Point point)
{
return
Location.X <= point.X && point.X <= Location.X + Width &&
Location.Y <= point.Y && point.Y <= Location.Y + Height;
}
public override bool Intersect(Rectangle rectangle, Circle circle)
{
return
Location.X < circle.Location.X + circle.Width && circle.Location.X < Location.X + Width &&
Location.Y < circle.Location.Y + circle.Height && circle.Location.Y < Location.Y + Height;
}
}
}
Can you help me with defining better the method Intersect() to fit the needs of a circle? Thank you in advance!