public virtual void AddLine(string m, string b) { var mresult = Drawing.CompileExpression(m); var bresult = Drawing.CompileExpression(b); if (mresult.IsSuccess && bresult.IsSuccess) { var line = Factory.CreateLineByEquation(Drawing, mresult.Dependencies.Union(bresult.Dependencies).ToList()); var equation = new SlopeInterseptLineEquation(line, m, b); line.Equation = equation; equation.Recalculate(); Actions.Actions.Add(Drawing, line); } }
public static ILineEquation Read(LineByEquation parent, XElement element) { var m = element.ReadString("m"); var b = element.ReadString("b"); var A = element.ReadString("A"); var B = element.ReadString("B"); var C = element.ReadString("C"); ILineEquation result = null; if (!m.IsEmpty() && !b.IsEmpty()) { result = new SlopeInterseptLineEquation(parent, m, b); } else if (!A.IsEmpty() && !B.IsEmpty() && !C.IsEmpty()) { result = new GeneralFormLineEquation(parent, A, B, C); } return(result); }