Search code examples
c#graphics3dilnumerics

ILnumerics c# draw line


How can I add line, like I drew in Paint with ILNumerics? My scene is building with that code:

 ilPanel1.Scene = new ILScene()
 {
     new ILPlotCube(twoDMode: false)
    {
        new ILSurface(func,
                     xmin: (float)xmin,
                     xmax: (float)xmax,
                     ymin: (float)ymin,
                     ymax: (float)ymax,
                     xlen: 200,
                     ylen: 200,
                     colormap: Colormaps.ILNumerics),
    }
};

http://i.imgur.com/7BTMmDd.png

edited:

var line = ilPanel1.Scene.Camera.Add(Shapes.Line);
ILArray<float> angles = ILMath.linspace<float>(0, 6, 6);
ILArray<float> pos = ILMath.zeros<float>(1,1,1);
pos["0;:"] = (float)xt; pos["1;:"] = (float)yt;
pos["2;:"] = 0f;
line.Positions = pos;
line.Color = Color.Black;

Solution

  • It is as simple as this:

    ilPanel1.Scene.First<ILPlotCube>().Add(
        new ILLines(/* do your line setup here */)
    ); 
    

    See the documentation of shapes here: http://ilnumerics.net/drawable-nodes-shapes.html