public bool RaaktLijnCirkel(Point begin, Point einde, Point cirkel, int radius) { double bovenkant = Math.Abs((begin.X - einde.X) * (einde.Y - cirkel.Y) - (einde.X - cirkel.X) * (begin.Y - einde.Y)); double onderkant = Math.Sqrt(Math.Pow((begin.X - einde.X), 2) + Math.Pow(begin.Y - einde.Y, 2)); double afstand = bovenkant / onderkant; return(afstand <= radius && VolRechthoekObject.RaaktCirkel(cirkel, radius, begin, einde)); }
public bool RaaktCirkel(Point locatiegum, int radius) { // Maak een oppervlakte die ongeveer de grootte van de tekst voorsteld Size oppervlakte = TextRenderer.MeasureText(tekst, new Font("Tahoma", 10 * grootte)); // Check of er binnen die oppervlakte 'gegumd' wordt. return(VolRechthoekObject.RaaktCirkel(locatiegum, radius, locatie , new Point(locatie.X + oppervlakte.Width, locatie.Y + oppervlakte.Height))); }