简体   繁体   English

iLNumerics未显示我的3d图-该图仍为2d

[英]iLNumerics isn't displaying my 3d plot - the plot remains 2d

The code is this: 代码是这样的:

        //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();

Now, an earlier version of this code (in a different solution) still uses 3.3.2, and 现在,此代码的早期版本(在另一个解决方案中)仍使用3.3.2,并且

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

I've tried both on a 3.3.3 version, and neither displays a 3d plot. 我在3.3.3版本上都尝试过,但都没有显示3D图。 Instead, it's a 2d grid. 相反,它是一个二维网格。 What am I doing wrong here? 我在这里做错了什么?

(the points are: (要点是:

        <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  

)

EDITED: Missing ) on the 3.3.2 example 编辑:在3.3.2示例中缺少)

EDITED: Reduced some of the non critical code out of the example. 编辑:减少了示例中的一些非关键代码。

The expected result is that I have a 3d plot with x,y and z axis. 预期的结果是我有一个x,y和z轴的3d图。 I'm getting a 2d plot. 我正在获取二维图。 No z axis. 无z轴。 I've verified the points (the is a ToString) 我已经验证了要点(这是一个ToString)

A sample run provides this: https://www.dropbox.com/s/imiw8tbe0lh8q9x/2DPlot.png 运行的示例提供了以下内容: https : //www.dropbox.com/s/imiw8tbe0lh8q9x/2DPlot.png

This is a rough example of what i used, you need to add an "ILSurface" to the plotcube 这是我使用的粗略示例,您需要向plotcube添加“ ILSurface”

        //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; 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM