如何保持形状ILCube [英] How to keep shape in ILCube
问题描述
我想绘制一些3D曲面与ILNumerics。我注意到,ILCube不保持表面的形状,如果我旋转它,那是因为它试图以适应ILPanel多维数据集。如果我使用ILCamera,但是,它将保持形状,但在它周围有没有立方体。下面是一个例子,
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;
}
和的结果是
和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;
}
和的结果是
有没有什么办法让ILCube保持表面的形状?或添加一个立方体周围表面到ILCamera?谢谢你。
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.
推荐答案
剧情立方体目前不支持等于轴的纵横比。但它是相当简单的添加这个自己。
Plot cubes currently do not support equal axis aspect ratios. But it is fairly simple to add this yourself.
有关你的榜样,情节立方体(圆环)的含量沿Z轴拉长,圆环体,因为延伸的Z比X或Y方向更小。因此,积魔方选择拉伸内容,以提供更好的细节。
For your example, the content of the plot cube (torus) is stretched along the Z axis, because the extend of the torus along Z is smaller than in X or Y direction. Hence, the plot cube chooses to stretch the content to give better details.
为了显示不变形的圆环,确保情节立方体的轴范围等于在所有方向上:
In order to show the torus without distortion, make sure the axis range of the plot cube equals in all directions:
pc.Limits.Set(new Vector3(-1,-1,-1), new Vector3(1,1,1));
见一个互动的例子在这里: http://ilnumerics.net/ilcc.php?ilc= i63fb4c
缺点:你将不得不调整限值(添加/删除/修改,即数据)。每次设定的情节多维数据集的内容被修改。
Drawback: you will have to adjust the Limits setting everytime the content of the plot cube is modified (ie. data is added / removed / altered).
这篇关于如何保持形状ILCube的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!