iLNumerics没有显示我的3D情节 - 情节仍然是2d

时间:2014-05-16 20:38:06

标签: c# ilnumerics

代码是这样的:

        //we need to render locations.
        ILArray<float> ourPositions = ourSimulator.getStars();

        var scene = new ILScene();
        var plotCube = scene.Add(new ILPlotCube(twoDMode: false));

        var ourPosBuffer = new ILPoints();
        ourPosBuffer.Positions = ourPositions;

        plotCube.Add(ourPosBuffer);
        plotCube.FieldOfView = 120;
        plotCube.LookAt = new Vector3(0, 0, 0);

        iLStarChart.Scene.Configure();

现在,此代码的早期版本(在不同的解决方案中)仍然使用3.3.2和

        var plotCube = scene.Add(new ILPlotCube(null, false) )

我在3.3.3版本上都试过了,并且都没有显示3d图。相反,它是一个2d网格。我在这做错了什么?

(要点是:

        <Single> [3,4]
        -32.00000 37.00000 36.00000 38.00000 
        54.00000 107.00000 106.00000 130.00000 
       -81.00000 -16.00000 -124.00000 -226.00000  

编辑:遗失)3.3.2示例

EDITED:减少了一些非关键代码。

预期的结果是我有一个带有x,y和z轴的3d图。我得到了一个2d的情节。没有z轴。我已经验证了这些点(这是一个ToString)

示例运行提供:https://www.dropbox.com/s/imiw8tbe0lh8q9x/2DPlot.png

1 个答案:

答案 0 :(得分:1)

这是我使用的一个粗略的例子,你需要添加一个&#34; ILSurface&#34;到情节立方体

        //Replace and make sure they are all added in order
        Single[] zs = [All Zs]
        Single[] xs = [All Xs]
        Single[] ys = [All Ys]           

        //create array of points               //something like below
        ILArray<float> points = ILMath.zeros<float>(xs.Length/s, s, 3);
        points[":;:;0"] = zs;
        points[":;:;1"] = xs;
        points[":;:;2"] = ys;            

        // construct a new plotcube and plot the points
        scene = new ILScene();
        cube = new ILPlotCube(twoDMode: false);
        surface = new ILSurface(points, colormap: Colormaps.Jet);


        //set scene properties
        scene.Add(cube);

        //display cube in scene
        ilPanel1.Scene = scene; 
相关问题