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.Add(Drawing, line);
            }
        }
示例#2
0
        void ProcessMatch(Match match)
        {
            var result = match.Value;

            if (result.Length < 3)
            {
                CompileResult error = new CompileResult();
                error.AddError("Empty expression");
                embeddedExpressions.Add(error);
                return;
            }

            var expression = result.Substring(1, result.Length - 2);

            var compileResult = Drawing.CompileExpression(expression);

            embeddedExpressions.Add(compileResult);
            if (compileResult.IsSuccess)
            {
                Dependencies.AddRange(compileResult.Dependencies);
            }
        }