示例#1
0
      public void MyTestMethod()
      {
        Mesh target = new Mesh(@"D:\T2VOC\Small2DGrid\mesh"); // TODO: Initialize to an appropriate value

        double[] x = new double[] { 0, 1, 1.2, 1.4, 2 };
        double[] y = new double[] { -0.3, -0.3, -0.15, -0.3, -0.3 };
        MathNet.Numerics.Interpolation.Algorithms.CubicSplineInterpolation cl = new MathNet.Numerics.Interpolation.Algorithms.CubicSplineInterpolation(x.ToList(), y.ToList());


        foreach (var e in target.Elements)
        {

          if (e.X <= 1 || e.X >= 1.4)
          {
            if (e.Z < -0.3)
              e.Material = 1;
            else
              e.Material = 2;
          }
          else
          {
            var v = cl.Interpolate(e.X.Value);
            if (e.Z.Value < v)
              e.Material = 1;
            else
              e.Material = 2;

          }
        }
        target.Save();
      }
示例#2
0
        public void MyTestMethod()
        {
            Mesh target = new Mesh(@"D:\T2VOC\Small2DGrid\mesh"); // TODO: Initialize to an appropriate value

            double[] x = new double[] { 0, 1, 1.2, 1.4, 2 };
            double[] y = new double[] { -0.3, -0.3, -0.15, -0.3, -0.3 };
            MathNet.Numerics.Interpolation.Algorithms.CubicSplineInterpolation cl = new MathNet.Numerics.Interpolation.Algorithms.CubicSplineInterpolation(x.ToList(), y.ToList());


            foreach (var e in target.Elements)
            {
                if (e.X <= 1 || e.X >= 1.4)
                {
                    if (e.Z < -0.3)
                    {
                        e.Material = 1;
                    }
                    else
                    {
                        e.Material = 2;
                    }
                }
                else
                {
                    var v = cl.Interpolate(e.X.Value);
                    if (e.Z.Value < v)
                    {
                        e.Material = 1;
                    }
                    else
                    {
                        e.Material = 2;
                    }
                }
            }
            target.Save();
        }