Пример #1
0
 public IColorExpression Subtract(
     IScalarValue term1,
     params IScalarValue[] terms)
 => new ColorExpression(
     ListUtil.ReadonlyConcat(this.Terms,
                             this.ToColorValues(
                                 this.NegateTerms(term1, terms))));
Пример #2
0
 private void PrintValue_(
     StringWriter os,
     IScalarValue value,
     bool wrapExpressions = false)
 {
     if (value is IScalarExpression expression)
     {
         if (wrapExpressions)
         {
             os.Write("(");
         }
         this.PrintExpression_(os, expression);
         if (wrapExpressions)
         {
             os.Write(")");
         }
     }
     else if (value is IScalarTerm term)
     {
         this.PrintTerm_(os, term);
     }
     else if (value is IScalarFactor factor)
     {
         this.PrintFactor_(os, factor);
     }
     else
     {
         Asserts.Fail("Unsupported value type!");
     }
 }
Пример #3
0
 public IScalarExpression Subtract(
     IScalarValue term1,
     params IScalarValue[] terms)
 => new ScalarExpression(
     ListUtil.ReadonlyFrom(
         this,
         this.NegateTerms(term1, terms)));
Пример #4
0
 public IScalarTerm Divide(
     IScalarValue factor1,
     params IScalarValue[] factors)
 => new ScalarTerm(this.NumeratorFactors,
                   ListUtil.ReadonlyConcat(
                       this.DenominatorFactors,
                       ListUtil.ReadonlyFrom(factor1, factors)));
Пример #5
0
 public ColorWrapper(IScalarValue intensity)
 {
     this.Intensity = intensity;
     this.R         = intensity;
     this.G         = intensity;
     this.B         = intensity;
 }
Пример #6
0
 public ColorWrapper(IScalarValue intensity, IScalarValue?a = null)
 {
     this.Intensity = intensity;
     this.R         = intensity;
     this.G         = intensity;
     this.B         = intensity;
     this.AOrNull   = a;
 }
        public string Print(IScalarValue scalarValue)
        {
            var sb = new StringBuilder();

            using var os = new StringWriter(sb);
            this.PrintScalarValue_(os, scalarValue);

            return(sb.ToString());
        }
Пример #8
0
 public ColorWrapper(
     IScalarValue r,
     IScalarValue g,
     IScalarValue b)
 {
     this.R = r;
     this.G = g;
     this.B = b;
 }
Пример #9
0
 public ColorWrapper(
     IScalarValue r,
     IScalarValue g,
     IScalarValue b,
     IScalarValue?a = null)
 {
     this.R       = r;
     this.G       = g;
     this.B       = b;
     this.AOrNull = a;
 }
Пример #10
0
        public ColorFixedFunctionOps(
            IFixedFunctionEquations <FixedFunctionSource> equations)
        {
            this.equations_ = equations;

            this.Zero = equations.CreateColorConstant(0);
            this.One  = equations.CreateColorConstant(1);

            this.scZero_     = equations.CreateScalarConstant(0);
            this.scOne_      = equations.CreateScalarConstant(1);
            this.scMinusOne_ = equations.CreateScalarConstant(-1);
        }
Пример #11
0
 public IColorExpression Add(
     IScalarValue term1,
     params IScalarValue[] terms)
 => new ColorExpression(
     ListUtil.ReadonlyFrom(this, this.ToColorValues(term1, terms)));
Пример #12
0
 public ScalarOutput(TIdentifier identifier, IScalarValue value)
 {
     this.Identifier  = identifier;
     this.ScalarValue = value;
 }
Пример #13
0
 public IScalarExpression Add(
     IScalarValue term1,
     params IScalarValue[] terms)
 => new ScalarExpression(ListUtil.ReadonlyConcat(this.Terms, terms));
Пример #14
0
 public IScalarTerm Multiply(
     IScalarValue factor1,
     params IScalarValue[] factors)
 => new ScalarTerm(ListUtil.ReadonlyConcat(
                       this.NumeratorFactors,
                       ListUtil.ReadonlyFrom(factor1, factors)));
Пример #15
0
 public IScalarTerm Divide(
     IScalarValue factor1,
     params IScalarValue[] factors)
 => new ScalarTerm(ListUtil.ReadonlyFrom(this),
                   ListUtil.ReadonlyFrom(factor1, factors));
Пример #16
0
 protected IScalarValue[] NegateTerms(
     IScalarValue term1,
     params IScalarValue[] terms)
 => this.NegateTerms(ListUtil.From(term1, terms).ToArray());
Пример #17
0
 public IScalarTerm Multiply(
     IScalarValue factor1,
     params IScalarValue[] factors)
 => new ScalarTerm(ListUtil.ReadonlyFrom(this, factor1, factors));
Пример #18
0
 public IColorTerm Multiply(
     IScalarValue factor1,
     params IScalarValue[] factors)
 => new ColorTerm(
     ListUtil.ReadonlyFrom(this, this.ToColorValues(factor1, factors)));
Пример #19
0
 public IColorTerm Divide(
     IScalarValue factor1,
     params IScalarValue[] factors)
 => new ColorTerm(ListUtil.ReadonlyFrom(this),
                  new ReadOnlyCollection <IColorValue>(
                      this.ToColorValues(factor1, factors)));
Пример #20
0
 protected IColorValue[] ToColorValues(
     IScalarValue first,
     params IScalarValue[] scalars)
 => this.ToColorValues(ListUtil.From(first, scalars).ToArray());
Пример #21
0
 public IColorTerm Multiply(
     IScalarValue factor1,
     params IScalarValue[] factors)
 => new ColorTerm(ListUtil.ReadonlyConcat(
                      this.NumeratorFactors,
                      this.ToColorValues(factor1, factors)));