Beispiel #1
0
 void WeightTest(double x, double y, double w1, double w2, double w3, double t1x, double t1y, double t2x, double t2y,
                 double t3x, double t3y)
 {
     InterpTriangle.Weights interp = InterpTriangle.InterpolationWeights(x, y, t1x, t1y, t2x, t2y, t3x, t3y);
     Assert.AreEqual(1.0, interp.w1 + interp.w2 + interp.w3, 1e-12);
     if (w1 != d)
     {
         Assert.AreEqual(w1, interp.w1, 1e-12);
     }
     if (w2 != d)
     {
         Assert.AreEqual(w2, interp.w2, 1e-12);
     }
     if (w3 != d)
     {
         Assert.AreEqual(w3, interp.w3, 1e-12);
     }
 }
Beispiel #2
0
        void DeleteValueTest(bool valOk, double x, double y, double z1, double z2, double z3, double t1x, double t1y,
                             double t2x, double t2y, double t3x, double t3y)
        {
            InterpTriangle interpolator = new InterpTriangle()
            {
                DelVal = d
            };

            InterpTriangle.Weights weights = InterpTriangle.InterpolationWeights(x, y, t1x, t1y, t2x, t2y, t3x, t3y);
            double val = interpolator.GetValue(weights, z1, z2, z3);

            if (valOk)
            {
                Assert.AreNotEqual(d, val);
            }
            else
            {
                Assert.AreEqual(d, val);
            }
        }