static void canvas_EvRedraw(object sender, RedrawEventArgs e) { var p = e.Painter; p.Clear(0); Ellipse2d el1 = new Ellipse2d(new Point2d(mousex, mousey), 200, 5, 1.0); Ellipse2d el2 = new Ellipse2d(new Point2d(400, 500), 300, 5, -1); p.Color = RGB.Red; p.DrawEllipse(el1.Center.X, el1.Center.Y, el1.MajorRadius, el1.MinorRadius, el1.Rotation); p.Color = RGB.Green; p.DrawEllipse(el2.Center.X, el2.Center.Y, el2.MajorRadius, el2.MinorRadius, el2.Rotation); var intpts = Intersect2d.EllipseEllipse(el1, el2); if (intpts != null) { p.Color = RGB.Yellow; foreach (Point2d pt in intpts) { p.DrawMark(pt.X, pt.Y, MarkType.DiagonalCross, 10); } } }
public static void Run() { Ellipse2d elp1 = new Ellipse2d(new Point2d(0, 0), 10.0, 10.0); Ellipse2d elp2 = new Ellipse2d(new Point2d(0, 0), 20.0, 10.0); GeneralConic2d con1 = elp1.ToGeneralConic(); GeneralConic2d con2 = elp2.ToGeneralConic(); Intersect2d.ConicConic(con1, con2); }