How to save a form in ILCube

I want to build some 3d surfaces using ILNumerics. I noticed that the ILCube does not preserve the shape of the surface if I rotate it, and that is because it is trying to put the cube in the ILPanel. However, if I use ILCamera, it will save the form, 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 result

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 result

enter image description here

Is there a way to get the ILCube to maintain its shape? Or add a cube around the surface in ILCamera? Thanks.

+7
c # plot numeric 3d ilnumerics
source share
1 answer

Plot cubes do not currently support equal proportions. But quite simple to add it yourself.

For your example, the contents of the graph cube (torus) are stretched along the Z axis, because the torus along the Z axis is shorter than in the X or Y direction. Therefore, the plot cube allows you to stretch the contents to get more detailed information.

To show the torus without distortion, make sure that the axis range of the graph cube is equal in all directions:

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

See an interactive example here: http://ilnumerics.net/ilcc.php?ilc=i63fb4c

ILNumerics plot cube without distortion

Disadvantage: you will have to adjust the "Limits" parameter every time the contents of the plot cube change (i.e. the data is added / deleted / changed).

+3
source share

All Articles