public void DrawCurve(ComboBox comboBox, double scale) { var region = new Curves.Region(new Point(0, 0), new Point(ClientSize.Width, ClientSize.Height)); var curve = (Curve)comboBox.SelectedItem; curve.Build(region, scale); PositivePoints = curve.PositivePoints.ToArray(); NegativePoints = curve.NegativePoints.ToArray(); Graphic = Graphics.FromImage(bmp); Graphic.SmoothingMode = SmoothingMode.HighQuality; Graphic.TranslateTransform(ClientSize.Width / 2, ClientSize.Height / 2); if ((PositivePoints.Count() != 0) && (NegativePoints.Count() != 0)) { if (curve.Name == "Эллипс") { Graphic.DrawClosedCurve(penDraw, PositivePoints.Concat(NegativePoints).ToArray()); } else { Graphic.DrawCurve(penDraw, PositivePoints); Graphic.DrawCurve(penDraw, NegativePoints); } } Graphic.TranslateTransform(-ClientSize.Width / 2, -ClientSize.Height / 2); pictureBox.Image = bmp; }
public Cluster GetCentralizedCluster() { if (_centralizedCluster != null) { return(_centralizedCluster); } var centralizedPoints = PositivePoints.Select(p => new Point(p.Coordinates.Subtract(Means)) { Label = p.Label }).ToList(); return(_centralizedCluster = new Cluster(centralizedPoints)); }