WRL 和 VRML 到 Matplotlib/Numpy
计算科学
Python
可视化
麻木的
scipy
绘图
2021-12-26 21:59:28
1个回答
{假设您仍然需要代码} 让 A1.wrl 是您的 wrl 文件。
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import re
holder = []
with open("A1.wrl", "rb") as vrml:
for lines in vrml:
a = re.findall("[-0-9]{1,3}.[0-9]{6}", lines)
if len(a) == 3:
holder.append(map(float, a))
holder_array = np.array(holder) #if you want numpy array
#3D Plotting
x,y,z = zip(*holder)
fig = plt.figure()
ax = Axes3D(fig)
ax.plot(x,y,z)
plt.show()
我的 A.wrl:http ://pastebin.com/PeVXbR5C
文件生成:

其它你可能感兴趣的问题
