2013-08-30 24 views
7

我想用ILNumerics繪製一些3d表面。我注意到,如果我旋轉它,ILCube不會保持表面的形狀,這是因爲它試圖適合ILPanel中的立方體。但是,如果我使用ILCamera,它會保持形狀,但周圍沒有立方體。下面是一個例子,如何在ILCube中保持形狀

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

,其結果是

enter image description here

和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; 
} 

,其結果是

enter image description here

有沒有辦法讓ILCube保持表面的形狀?或者在ILCamera表面添加一個立方體?謝謝。

回答

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 plot cube without distortion

缺點:每次修改圖塊的內容(即添加/刪除/更改數據)時,都必須調整限制設置。

+2

我剛剛嘗試了您鏈接到的網站上的EXE輸出...很酷的東西! :) – user492238

+0

感謝您的答案。 :) – Ehsan

相關問題