简体   繁体   中英

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

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

I've tried both on a 3.3.3 version, and neither displays a 3d plot. 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

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. I'm getting a 2d plot. No z axis. I've verified the points (the is a ToString)

A sample run provides this: 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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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