private Line GetLineForProject() { PointF p1 = UtilsModel.ConvertToGraph(selectedAxe.Line.P1, rectLimit.Width, rectLimit.Location.X); PointF p2 = UtilsModel.ConvertToGraph(selectedAxe.Line.P2, rectLimit.Width, rectLimit.Location.X); return(Line.GetLine(p1, p2)); }
private LineProject GetLineProject(MouseEventArgs e) { PointF mousePos = UtilsModel.InvertFromGraph(new PointF(e.X, e.Y), 0, rectLimit.Location.X); PointF graphMouse = UtilsModel.ConvertToGraph(mousePos, rectLimit.Width, rectLimit.Location.X); float length = UtilsModel.LineLength(selectedAxe.Line.P1, selectedAxe.Line.P2); PointF xtm = UtilsModel.CalculateCurrPoint(length, selectedAxe.Angle, rectLimit.Width, rectLimit.Location.X); PointF graphXtm = UtilsModel.ConvertToGraph(xtm, rectLimit.Width, rectLimit.Location.X); float a = graphXtm.X, b = graphXtm.Y, c = -1 * ((graphXtm.X * graphMouse.X) + (graphXtm.Y * graphMouse.Y)); return(new LineProject(a, b, c)); }