コード例 #1
0
 public static FloatVariable operator *(double k, FloatVariable a)
 {
     return(a.CSP.Memoize(
                "*",
                () =>
     {
         var product = new FloatVariable("product", a.CSP, k * a.Value);
         // ReSharper disable ObjectCreationAsStatement
         new ProductConstantConstraint(product, a, k);
         // ReSharper restore ObjectCreationAsStatement
         return product;
     },
                k,
                a));
 }
コード例 #2
0
 public static FloatVariable operator /(FloatVariable a, FloatVariable b)
 {
     return(a.CSP.Memoize(
                "/",
                () =>
     {
         var quotient = new FloatVariable("quotient", a.CSP, a.Value / b.Value);
         // ReSharper disable ObjectCreationAsStatement
         new QuotientConstraint(quotient, a, b);
         // ReSharper restore ObjectCreationAsStatement
         return quotient;
     },
                a,
                b));
 }
コード例 #3
0
 public static FloatVariable operator -(FloatVariable a, FloatVariable b)
 {
     return(a.CSP.Memoize(
                "-",
                () =>
     {
         var difference = new FloatVariable("difference", a.CSP, a.Value - b.Value);
         // ReSharper disable ObjectCreationAsStatement
         new DifferenceConstraint(difference, a, b);
         // ReSharper restore ObjectCreationAsStatement
         return difference;
     },
                a,
                b));
 }
コード例 #4
0
 public static FloatVariable operator +(FloatVariable a, FloatVariable b)
 {
     return(a.CSP.Memoize(
                "+",
                () =>
     {
         var sum = new FloatVariable("sum", a.CSP, a.Value + b.Value);
         // ReSharper disable ObjectCreationAsStatement
         new SumConstraint(sum, a, b);
         // ReSharper restore ObjectCreationAsStatement
         return sum;
     },
                a,
                b));
 }
コード例 #5
0
 public static FloatVariable Dot(Vector3Variable a, Vector3Variable b)
 {
     return(a.X.CSP.Memoize(
                "dot",
                () =>
     {
         var product = new FloatVariable(
             string.Format("{0} dot {1}", a.Name, b.Name),
             a.X.CSP,
             a.X.Value * b.X.Value + a.Y.Value * b.Y.Value + a.Z.Value * b.Z.Value);
         // ReSharper disable ObjectCreationAsStatement
         new DotProductConstraint(product, a, b);
         // ReSharper restore ObjectCreationAsStatement
         return product;
     },
                a,
                b));
 }
コード例 #6
0
        public void MustBeParallel(Vector3Variable v)
        {
            var coefficient = new FloatVariable("parallelCoefficient", CSP, Interval.AllValues);

            this.MustEqual(coefficient * v);
        }
コード例 #7
0
 public override void CanonicalizeVariables()
 {
     difference = RegisterCanonical <FloatVariable, Interval>(difference);
     a          = RegisterCanonical <FloatVariable, Interval>(a);
     b          = RegisterCanonical <FloatVariable, Interval>(b);
 }
コード例 #8
0
 public override void CanonicalizeVariables()
 {
     sum = RegisterCanonical <FloatVariable, Interval>(sum);
     a   = RegisterCanonical <FloatVariable, Interval>(a);
     b   = RegisterCanonical <FloatVariable, Interval>(b);
 }
コード例 #9
0
 public override void CanonicalizeVariables()
 {
     power = RegisterCanonical <FloatVariable, Interval>(power);
     a     = RegisterCanonical <FloatVariable, Interval>(a);
 }
コード例 #10
0
 public override void CanonicalizeVariables()
 {
     quotient = RegisterCanonical <FloatVariable, Interval>(quotient);
     a        = RegisterCanonical <FloatVariable, Interval>(a);
     b        = RegisterCanonical <FloatVariable, Interval>(b);
 }
コード例 #11
0
 public override void CanonicalizeVariables()
 {
     this.magnitude = RegisterCanonical <FloatVariable, Interval>(this.magnitude);
     this.vector.CanonicalizeAndRegisterConstraint(this);
 }
コード例 #12
0
 // This is needed to prevent the compiler from trying to do an implicit conversion
 // of v to a double and then taking the MustEqual(double) overload.
 public void MustEqual(FloatVariable v)
 {
     MustEqual((Variable <Interval>)v);
 }
コード例 #13
0
 public override void CanonicalizeVariables()
 {
     product = RegisterCanonical <FloatVariable, Interval>(product);
     a.CanonicalizeAndRegisterConstraint(this);
     b.CanonicalizeAndRegisterConstraint(this);
 }
コード例 #14
0
 /// <summary>
 /// Update component variables to point at their canonical variables
 /// </summary>
 public void CanonicalizeAndRegisterConstraint(Constraint c)
 {
     X = c.RegisterCanonical <FloatVariable, Interval>(X);
     Y = c.RegisterCanonical <FloatVariable, Interval>(Y);
     Z = c.RegisterCanonical <FloatVariable, Interval>(Z);
 }
コード例 #15
0
 public override void CanonicalizeVariables()
 {
     product = RegisterCanonical <FloatVariable, Interval>(product);
     a       = RegisterCanonical <FloatVariable, Interval>(a);
 }
コード例 #16
0
 public Vector3Variable(FloatVariable x, FloatVariable y, FloatVariable z)
 {
     X = x;
     Y = y;
     Z = z;
 }
コード例 #17
0
 public MagnitudeConstraint(FloatVariable magnitude, Vector3Variable vector)
     : base(magnitude.CSP)
 {
     this.magnitude = magnitude;
     this.vector    = vector;
 }