【问题标题】:Updating z-values for ILNumerics ILSurface更新 ILNumerics ILSurface 的 z 值
【发布时间】:2018-08-14 20:24:47
【问题描述】:

我是 ILNumerics 可视化引擎的新用户,我仍在快速了解如何很好地使用它。我已经广泛搜索了如何更新 ILSurface 的 z 值并阅读了帖子,但我仍然不清楚如何执行此操作。

我能够生成一个曲面并设置一个摄像头来查看它(Hamyo Kutschbach 告诉我这是确保在旋转曲面时不改变曲面纵横比的最佳方法,这在我的应用程序)。下面是显示 sin(x)/x 函数的代码:

        // Generate the data
        ILArray<double> z = SincFunc(rows, cols, 10, 50);
        ILArray<double> x = new double[cols];
        ILArray<double> y = new double[rows];
        for (int i = 0; i < cols; i++)
            x[i] = (double)i;
        for (int i = 0; i < rows; i++)
            y[i] = (double)i;

        // create the scene
        scene = new ILScene();
        pointCloudSurface = new ILSurface(z, x, y)
        {

            Colormap = Colormaps.Jet,
            UseLighting = true,
            Wireframe = { Visible = false },
            Children = { new ILColorbar()
            {
                Height = 0.5f,
                Location = new PointF(0.95f, 0.05f),
                Children = { new ILLabel("microns") { Position = new Vector3(0.5,1,0), Anchor = new PointF(0.5f,0) } } }
            },
            Alpha = 1.0f
        };
        // Configure the surface and display it
        scene.Camera.Add(pointCloudSurface);
        scene.Camera.Position = new Vector3(50, 50, 700);
        scene.Camera.LookAt = new Vector3(50, 50, 0);
        scene.Camera.Top = new Vector3(0, 0, 700);
        scene.Camera.Projection = Projection.Perspective;
        scene.Camera.ZNear = 1.0f;
        scene.Camera.ZFar = 0.0f;
        scene.Camera.Top = new Vector3(1, 0, 0);
        // Turn off the Powered by ILNumerics label
        scene.Screen.First<ILLabel>().Visible = false;
        ilPanel1.Scene = scene;
        ilPanel1.Configure();
        ilPanel1.Refresh();

而且效果很好。所以现在我想在不关闭 ilPanel1 的情况下更改 z 值并更新绘图,因为该绘图嵌入在 Windows 窗体中。建议将不胜感激!希望其他新手也会发现这篇文章也很有用。

【问题讨论】:

    标签: ilnumerics


    【解决方案1】:

    在进一步翻找之后,我发现了一个方法,UpdateColormapped(),它可以解决问题。它位于上面代码的末尾附近,如下所示:

            scene.Camera.First<ILSurface>().UpdateColormapped(z);
            ilPanel1.Scene = scene;
            ilPanel1.Configure();
            ilPanel1.Refresh();
    

    可以在此处的 API 文档中找到:UpdateColormapped()

    它还可以更改 x 和 y 数据并执行其他 mod,但它要求 z 数据是浮点数组,因此如果您使用双精度,则必须采取适当的步骤来获取它放入一个浮点数组中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-09-20
      • 1970-01-01
      • 2021-01-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-09-01
      相关资源
      最近更新 更多