/// <summary>
 /// Initializes a new instance of the <see cref="TrigFunctionVMContainer"/> class.
 /// </summary>
 /// <param name="trigFunction"> The <see cref="TrigFunctionVM"/>. </param>
 public TrigFunctionVMContainer(TrigFunctionVM trigFunction)
 {
     this.TrigFunction    = trigFunction.TrigFunctionM;
     this.StrokeThickness = trigFunction.StrokeThickness;
     this.Opacity         = trigFunction.Opacity;
     this.FunctionColor   = trigFunction.FunctionColor;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="TrigFunctionVM"/> class.
 /// </summary>
 /// <param name="trigFunctionVMContainer"> The container for the <see cref="TrigFunction"/>. </param>
 /// <param name="removec"> The remove command. </param>
 public TrigFunctionVM(TrigFunctionVMContainer trigFunctionVMContainer, ICommand removec)
 {
     this.points          = new PointCollection();
     this.Brush           = new SolidColorBrush();
     this.TrigFunctionM   = trigFunctionVMContainer.TrigFunction;
     this.Name            = trigFunctionVMContainer.TrigFunction.Name;
     this.Values          = trigFunctionVMContainer.TrigFunction.ParameterList;
     this.Angle           = trigFunctionVMContainer.TrigFunction.Angle;
     this.removeCommand   = removec;
     this.opacity         = trigFunctionVMContainer.Opacity;
     this.strokeThickness = trigFunctionVMContainer.StrokeThickness;
     this.functionColor   = trigFunctionVMContainer.FunctionColor;
     this.Brush.Color     = this.functionColor;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="TrigFunctionVM"/> class.
 /// </summary>
 /// <param name="trigFunction"> The model of the <see cref="TrigFunction"/>. </param>
 /// <param name="removeCommand"> The remove command. </param>
 public TrigFunctionVM(TrigFunction trigFunction, ICommand removeCommand)
 {
     this.points          = new PointCollection();
     this.Brush           = new SolidColorBrush();
     this.TrigFunctionM   = trigFunction;
     this.Name            = trigFunction.Name;
     this.Values          = trigFunction.ParameterList;
     this.Angle           = trigFunction.Angle;
     this.removeCommand   = removeCommand;
     this.opacity         = 1;
     this.strokeThickness = 1;
     this.functionColor   = Colors.Red;
     this.Brush.Color     = this.functionColor;
 }
        private static ExComp SingularPowTrig(TrigFunction tf0, TrigFunction tf1)
        {
            ExComp a = tf0.GetInnerEx();
            ExComp b = tf1.GetInnerEx();
            AlgebraTerm half = AlgebraTerm.FromFraction(ExNumber.GetOne(), new ExNumber(2.0));
            if (tf0 is SinFunction && tf1 is SinFunction)
                return MulOp.StaticCombine(half,
                    SubOp.StaticCombine(
                    new CosFunction(SubOp.StaticCombine(a, b)),
                    new CosFunction(AddOp.StaticCombine(a, b))));
            else if (tf0 is CosFunction && tf1 is CosFunction)
                return MulOp.StaticCombine(half,
                    AddOp.StaticCombine(
                    new CosFunction(SubOp.StaticCombine(a, b)),
                    new CosFunction(AddOp.StaticCombine(a, b))));

            if (tf0 is CosFunction && tf1 is SinFunction)
            {
                ExComp tmp = a;
                a = b;
                b = tmp;
            }

            if (tf0 is SinFunction && tf1 is CosFunction)
                return MulOp.StaticCombine(half,
                    AddOp.StaticCombine(
                    new SinFunction(SubOp.StaticCombine(a, b)),
                    new SinFunction(AddOp.StaticCombine(a, b))));

            return null;
        }
示例#5
0
文件: Term.cs 项目: fwright12/Crunch
 private Operand Simplify(TrigFunction tf) => tfs?.Simplify(tf) ?? new Term(tf);