public void TestK(double expected) { Asymptote = new Asymptote(Function); var got = Asymptote.K; Assert.AreEqual(expected, got); }
private static void RenderAsymptote(Graphics g, int xStart, int yStart, int ySize, double xScale, double yScale, Size imageSize, Graph graph, Asymptote asymptote) { Point start = new Point(); Point end = new Point(); if (asymptote.Axis == Axis.X) { start = new Point(graph.Style.LeftMargin + (int)((asymptote.Coordinate - xStart) * xScale), graph.Style.TopMargin); end = new Point(graph.Style.LeftMargin + (int)((asymptote.Coordinate - xStart) * xScale), imageSize.Height - graph.Style.BottomMargin); } else { start = new Point(graph.Style.LeftMargin, (int)((ySize - asymptote.Coordinate + yStart) * yScale) + graph.Style.TopMargin); end = new Point(imageSize.Width - graph.Style.RightMargin, (int)((ySize - asymptote.Coordinate + yStart) * yScale) + graph.Style.TopMargin); } if (asymptote.RenderCoordinate) { string s = asymptote.Axis.ToString() + " = " + asymptote.Coordinate; if (asymptote.CustomName != null) { s = asymptote.CustomName; } StringFormat sf = new StringFormat(); if (asymptote.Axis == Axis.X) { sf.FormatFlags = StringFormatFlags.DirectionVertical; } g.DrawString(s, graph.Style.AsymptoteFont, new SolidBrush(asymptote.Color), new PointF(start.X + 10, start.Y + 10), sf); } g.DrawLine(new Pen(new SolidBrush(asymptote.Color)), start, end); }