Esempio n. 1
0
        public static LineByEquation CreateLineByEquation(Drawing drawing, string m, string b)
        {
            var result = new LineByEquation()
            {
                Drawing = drawing
            };
            var equation = new SlopeInterseptLineEquation(result, m, b);

            result.Equation = equation;
            equation.Recalculate();
            return(result);
        }
        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);
            }
        }
Esempio n. 3
0
        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);
            }
        }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
 public static LineByEquation CreateLineByEquation(Drawing drawing, string m, string b)
 {
     var result = new LineByEquation() { Drawing = drawing };
     var equation = new SlopeInterseptLineEquation(result, m, b);
     result.Equation = equation;
     equation.Recalculate();
     return result;
 }
Esempio n. 6
0
        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;
        }