问题描述
我在VTK文件中存储了三维数据。我可以在任何3D查看器应用程序(例如Paraview)中打开此文件,都没有问题。我想使用ThreeJS包显示我的文件。
我注意到ThreeJS VTK支持仅限于以ASCII格式编码的polyData。因此,我以这种格式导出了数据(在Paraview和其他3D查看器中仍然可读)。我使用ThreeJS示例here打开VTK文件。它会正确打开Bunny.vtk文件,但不会显示我的数据:
var loader = new VTKLoader();
loader.load( "./data.vtk",function ( geometry ) {
geometry.center();
geometry.computeVertexnormals();
var material = new THREE.MeshLAmbertMaterial( { color: 0xffffff } );
var mesh = new THREE.Mesh( geometry,material );
mymesh = mesh;
// mesh.position.set( - 0.075,0.005,0 );
// I tried with and without the following scaler
mesh.scale.multiplyScalar( 0.00001 );
console.log(mesh);
scene.add( mesh );
} );
# vtk DataFile Version 3.0
vtk output
ASCII
DATASET polyDATA
POINTS 35947 float
-0.0378297 0.12794 0.00447467 -0.0447794 0.128887 0.00190497 -0.0680095 0.151244 0.0371953
-0.00228741 0.13015 0.0232201 -0.0226054 0.126675 0.00715587 -0.0251078 0.125921 0.00624226
-0.0371209 0.127449 0.0017956 0.033213 0.112692 0.0276861 0.0380425 0.109755 0.0161689
我的Data.vtk文件的标头不起作用:
# vtk DataFile Version 4.2
vtk output
ASCII
DATASET polyDATA
POINTS 80851 double
-2570 -1280 -1075.24966 -2570 -1280 -435.24966 -2570 -1280 204.75034
-1930 -1280 -1075.24966 -2570 -640 -1075.24966 -1930 -1280 -435.24966
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)