public static bool Overlap(LineF line, CircleF p) { var apX = p.Point.X - line.Start.X; var apY = p.Point.Y - line.Start.Y; var abX = line.End.X - line.Start.X; var abY = line.End.Y - line.Start.Y; var abLength = (abX * abX + abY * abY); var dot = apX * abX + apY * abY; var t = dot / abLength; if (t <= 0) return ((apX * apX) + (apY * apY) < p.Radius * p.Radius); else if (t >= 1) return ((line.End.X - p.Point.X) * (line.End.X - p.Point.X) + (line.End.Y - p.Point.Y) * (line.End.Y - p.Point.Y) < p.Radius * p.Radius); else return ((apX - abX * t) * (apX - abX * t) + (apY - abY * t) * (apY - abY * t) < p.Radius * p.Radius); }
public bool Overlap(CircleF circle) { return Overlap(this, circle); }
public bool Overlap(CircleF circle) { return(Overlap(this, circle.Point, circle.Radius)); }
public bool Overlap(CircleF circle) { return Overlap(this, circle.Point, circle.Radius); }
public static bool Overlap(CircleF circle, Vector2 p, float raduis) { return Vector2.DistanceSquared(circle.Point, p) < (circle.Radius + raduis) * (circle.Radius + raduis); }
public bool Overlap(CircleF circle) { return(Overlap(this, circle)); }
public static bool Overlap(CircleF circle, Vector2 p, float raduis) { return(Vector2.DistanceSquared(circle.Point, p) < (circle.Radius + raduis) * (circle.Radius + raduis)); }