有关这段程式码的部分:
=====================================================
import numpy as np
from stl import mesh
# Define the 8 vertices of the cube
vertices = np.array([\
[-1, -1, -1], [+1, -1, -1], [+1, +1, -1],
[-1, +1, -1], [-1, -1, +1], [+1, -1, +1],
[+1, +1, +1], [-1, +1, +1]])
# Define the 12 triangles composing the cube
faces = np.array([\
[0,3,1], [1,3,2], [0,4,7], [0,7,3],
[4,5,6], [4,6,7], [5,1,2], [5,2,6],
[2,3,6], [3,7,6], [0,1,5], [0,5,4]])
# Create the mesh
cube = mesh.Mesh(np.zeros(faces.shape[0], dtype=mesh.Mesh.dtype))
for i, f in enumerate(faces):
for j in range(3):
cube.vectors[i][j] = vertices[f[j],:]
# Write the mesh to file "cube.stl"
cube.save('cube.stl')
===========================================
程式码是来自这里的其中一段
https://pypi.org/project/numpy-stl/
目的是把一群资料转成stl档
我想询问的是
第三段的Create the mesh这整段是在做了些什么
看的不是很了解
谢谢