当前位置: 首页>>代码示例>>C#>>正文


C# Mesh.Save方法代码示例

本文整理汇总了C#中Mesh.Save方法的典型用法代码示例。如果您正苦于以下问题:C# Mesh.Save方法的具体用法?C# Mesh.Save怎么用?C# Mesh.Save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mesh的用法示例。


在下文中一共展示了Mesh.Save方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MyTestMethod

      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();
      }
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:31,代码来源:Rune.cs

示例2: AdjustMesh

    public void AdjustMesh()
    {
      Mesh target = new Mesh(@"D:\T2VOC\FineGridRadial\mesh"); // TODO: Initialize to an appropriate value

      foreach (var v in target.Elements)
      {
        if (v.Z >= -3)
          v.Material = 3;
        else if (v.Z >= -3.2)
          v.Material = 5;
        else if (v.Z >= -4)
          v.Material = 3;
        else if (v.Z >= -4.6)
          v.Material = 1;
        else if (v.Z >= -5)
          v.Material = 3;
        else if (v.Z >= -6.6)
          v.Material = 1;
        else if (v.Z >= -6.8)
          v.Material = 4;
        else
          v.Material = 1;
      }

      target.Save();
    }
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:26,代码来源:Rune.cs

示例3: AdjustMesh2

    public void AdjustMesh2()
    {
      Mesh target = new Mesh(@"D:\T2VOC\inclined\mesh"); // TODO: Initialize to an appropriate value

      foreach (var v in target.Elements)
      {
        if (v.Z <= -2)
          v.Material = 2;
        else
          v.Material = 1;
      }
      target.Save();
    }
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:13,代码来源:Rune.cs

示例4: GenerateResponse

 public GenerateResponse(Mesh start, Mesh end)
     : base(MessageType.GenerateResponse)
 {
     StringWriter writer = new StringWriter();
     start.Save(writer);
     string startText = writer.ToString();
     writer.GetStringBuilder().Length = 0;
     end.Save(writer);
     string endText = writer.ToString();
     StartLines = startText.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
     EndLines = endText.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
 }
开发者ID:Tilps,项目名称:LoopDeLoop,代码行数:12,代码来源:Connection.cs

示例5: BoardDetailsBroadcast

 public BoardDetailsBroadcast(Mesh start)
     : base(MessageType.BoardDetailsBroadcast)
 {
     StringWriter writer = new StringWriter();
     start.Save(writer);
     string startText = writer.ToString();
     StartLines = startText.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
 }
开发者ID:Tilps,项目名称:LoopDeLoop,代码行数:8,代码来源:Connection.cs

示例6: SelfTest

        private void SelfTest(int height, int width, MeshType meshType, bool extensive)
        {
            Output(string.Format("SelfTesting {0}, {1}, {2}, {3}", height, width, meshType, extensive));
            List<string> codes = new List<string>{"S", "SC", "SCO", "SCOM", "SC+OM", "SC+EOM", "SC+EOMP", "SC+EOMP+", "FC+EOMP+"};
            List<string> extraCodes = new List<string>{"SI", "SIC", "SIO", "SM", "SIM", "SOM", "SP", "SP+", "SC+EP", "SE", "SEP", "SC+E", "SCE", "SCP"};
            try
            {
                int solvedCount=0;
                for (int i = 0; i < (extensive ? 100 : 5); i++)
                {
                    Mesh m = new Mesh(width, height, meshType);
                    m.SetRatingCodeOptions("F");
                    m.GenerateBoringFraction = 0.5/height;
                    m.GenerateLengthFraction = 0.7;
                    m.Generate();
                    bool solved = false;
                    int lastDepth = int.MaxValue;
                    foreach (string code_in in codes)
                    {
                        bool solvedByCode = false;
                        for (int j = 0; j < (extensive ? height * height : 1); j++ )
                        {
                            string code = code_in;
                            if (extensive)
                                code += (j-1).ToString();
                            m.Clear();
                            m.SetRatingCodeOptions(code);
                            SolveState result = m.TrySolve();
                            if (result == SolveState.Solved)
                            {
                                solvedByCode = true;
                                if (!solved)
                                    solved = true;
                                if (extensive)
                                {
                                    if (j < lastDepth)
                                        lastDepth = j;
                                }
                            }
                            else
                            {
                                if (solved)
                                {
                                    if (!extensive || j > lastDepth || j == height*height-1)
                                    {
                                        Output(string.Format("Code {0} failed to solve puzzle solved with less powerful solvers.", code));
                                        using (TextWriter writer = File.CreateText("SelfTestOuput" + failCount + "-" + code + ".loop"))
                                        {
                                            m.Save(writer);
                                        }
                                    }
                                    failCount++;
                                }
                            }
                        }
                        if (solvedByCode)
                            solvedCount++;
                    }

                    m.FullClear();
                    m.SetRatingCodeOptions("S");
                    m.Generate();
                    foreach (string code in codes.Concat(extraCodes))
                    {
                        m.Clear();
                        m.SetRatingCodeOptions(code);
                        SolveState result = m.TrySolve();
                        if (result != SolveState.Solved)
                        {
                            Output(string.Format("Code {0} failed to solve puzzle generated with less powerful generator.", code));
                            using (TextWriter writer = File.CreateText("SelfTestOuput" + failCount + "-" + code + ".loop"))
                            {
                                m.Save(writer);
                            }
                            failCount++;
                        }
                    }
                }
                Output(string.Format("{0} codes solved {1} full generator puzzles {2} times.", codes.Count, extensive ? 100 : 5, solvedCount));
            }
            catch (Exception ex)
            {
                if (!(ex is ThreadAbortException))
                {
                    Output(string.Format("Failure {0}", ex));
                }
            }
        }
开发者ID:Tilps,项目名称:LoopDeLoop,代码行数:88,代码来源:HelpForm.cs


注:本文中的Mesh.Save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。