C# 当我'时遇到一些麻烦;我正在尝试用数字画3d函数

C# 当我'时遇到一些麻烦;我正在尝试用数字画3d函数,c#,ilnumerics,C#,Ilnumerics,嗨,伙计们,当我试图用c绘制3D函数时,我遇到了一些问题# 我的代码: string expr = "Abs(x)+Abs(y)"; int pointX = 43; int pointNumber = pointX * pointX; double[] XX = new double[pointX]; double[] YY = new double[pointX]; double[,] ZZ = new double[pointX, pointX]; for (int i = 0; i &l

嗨,伙计们,当我试图用c绘制3D函数时,我遇到了一些问题#

我的代码:

string expr = "Abs(x)+Abs(y)";
int pointX = 43;
int pointNumber = pointX * pointX;
double[] XX = new double[pointX];
double[] YY = new double[pointX];
double[,] ZZ = new double[pointX, pointX];
for (int i = 0; i < pointX; i++)
{
    double d = (double)i;
    XX[i] = YY[i] = -10 + 20 * (d / (pointX - 1));
    if (XX[i] == 0) { XX[i] = 0.01; YY[i] = 0.01; }
}
Parser p = new Parser();
for (int j = 0; j < pointX; j++)
{
    for (int k = 0; k < pointX; k++)
    {
        Hashtable h = new Hashtable();
        h.Add("x", XX[j]);
        h.Add("y", YY[k]);
        ZZ[j, k] = p.Parse(expr, h);

    }
}
但是当我试图运行代码时,CIL会给我一些错误,因为meshgrid现在是一种不同的方法,
IlSurfaceGraph
m_panel2.Graphs.AddSurfGraph
不再存在

我怎样才能解决这个问题

编辑1

我再次阅读了文档,并尝试使用以下代码创建3D图表:

ILArray<float> Z = ZZ;
ilPanel1.Scene = new ILScene() {
    new ILPlotCube(twoDMode: false) {
        new ILSurface(ZZ) {
            UseLighting = true
        }
    }
};
ilPanel1.Scene.First<ILPlotCube>().Rotation = Matrix4.Rotation(
    new Vector3(1f, 0.23f, 1), 0.7f);
ILArray Z=ZZ;
ilPanel1.Scene=新ILScene(){
新ILPlotCube(twoDMode:false){
新表面(ZZ){
UseLighting=true
}
}
};
ilPanel1.Scene.First().Rotation=Matrix4.Rotation(
新矢量3(1f,0.23f,1),0.7f);
iArray不是空的,结果是: 我不明白为什么图表是空的


矩阵1849中的浮点数。您可以看到所有的输出(太长了,所以我已经在pastebin上发布了)。该示例非常有效,它们没有问题。

“CIL给我一些错误”。。。到底是什么错误?它说我想用的方法已经不存在了。我浏览了IlNumerics API,但什么也没找到:您是否尝试浏览文档:?您的另一个问题()的答案可能也有帮助?@HaymoKutschbach是的,我已经阅读了文档,并按照您的建议进行了操作,但我不知道如何将我的代码转换为最新版本的ILNumerics哪一部分您不懂?与ILNumerics相关的部分已过时。你应该用新版本替换它。文档中给出了大量示例。由于您的评估结果似乎以矩阵Z的形式存在,因此使用其中一个示例为Z创建曲面应该很简单?如果不是:帮助我们更清楚地理解问题!
ILArray<float> Z = ZZ;
ilPanel1.Scene = new ILScene() {
    new ILPlotCube(twoDMode: false) {
        new ILSurface(ZZ) {
            UseLighting = true
        }
    }
};
ilPanel1.Scene.First<ILPlotCube>().Rotation = Matrix4.Rotation(
    new Vector3(1f, 0.23f, 1), 0.7f);