7

I want to plot some 3d surfaces with ILNumerics. I noticed that ILCube does not keep the shape of surface if I rotate it and it is because it tries to fit the cube in the ILPanel. If I use ILCamera, however, it will keep the shape but there is no cube around it. Here is an example,

private void ilPanel1_Load(object sender, EventArgs e)
{
    var scene = new ILScene();
    ILArray<float> A = ILSpecialData.torus(0.75f, 0.25f);
    var sf = new ILSurface(A);
    var pc = new ILPlotCube();
    pc.TwoDMode = false;
    scene.Add(pc);
    pc.Add(sf);
    sf.Colormap = Colormaps.Jet;
    var cb = new ILColorbar();
    cb.Location = new PointF(1, .1f);
    sf.Children.Add(cb);
    ilPanel1.Scene = scene;
}

and the result is

enter image description here

and for ILCamera

private void ilPanel1_Load(object sender, EventArgs e)
{
    var scene = new ILScene();
    ILArray<float> A = ILSpecialData.torus(0.75f, 0.25f);
    var sf = new ILSurface(A);
    var cam = scene.Camera;
    cam.Add(sf);
    sf.Colormap = Colormaps.Jet;
    var cb = new ILColorbar();
    cb.Location = new PointF(1, .1f);
    sf.Children.Add(cb);
    ilPanel1.Scene = scene;
}

and the result is

enter image description here

Is there any way to make the ILCube to keep the shape of the surface? Or add a cube around the surface to the ILCamera? Thanks.

4

1 回答 1

3

绘图立方体目前不支持等轴纵横比。但是自己添加它相当简单。

对于您的示例,绘图立方体(圆环)的内容沿 Z 轴拉伸,因为圆环沿 Z 的延伸小于 X 或 Y 方向的延伸。因此,绘图立方体选择拉伸内容以提供更好的细节。

为了不失真地显示环面,请确保绘图立方体的轴范围在所有方向上都相等:

pc.Limits.Set(new Vector3(-1,-1,-1), new Vector3(1,1,1));

在此处查看交互式示例:http: //ilnumerics.net/ilcc.php?ilc= i63fb4c

ILNumerics 绘制立方体而不失真

缺点:每次修改绘图立方体的内容(即添加/删除/更改数据)时,您都必须调整限制设置。

于 2013-08-30T09:24:14.480 回答