0
파이썬을위한 Mayavi 모듈을 처음 접했고 어떤 것이 저에게 불분명합니다. 나는 현재 triangle_mesh 함수를 사용하여 모델을 표시 할 수있었습니다. 문제는 모델을 5 배 더 크게 표시 할 수 있도록 모델을 확대하고 어떻게 할 수 있는지 이해할 수 없다는 것입니다. 버텍스 배열 V를 업데이트하려고 시도했지만 모든 것이 동일 해 보입니다. 코드는 다음과 같습니다. 어떻게 든 꼭지점이 포함 된 V 배열을 변형해야한다고 생각하지만 모델을 변형하여 모델을 5 배 더 크게 표시 할 수는 없습니다.Mayavi에서 3D 모델을 어떻게 스케일 업할 수 있습니까?
import math
import numpy as np
import mayavi.mlab as mlab
import pickle
# The following three lines will load the "pickled" arrays V and F from the
# pickle file dino.pkl. V represents the vertices of the model as Nx3 matrix,
# while N is the number of vertices the model consists of. F represent the
# faces (here triangles of the model). F is also a Nx3 matrix, while here N
# represents the number of the faces the model.
fid = open('dino.pkl', 'rb')
(V, F) = pickle.load(fid)
fid.close()
# a small wrapper function around mlab's triangular_mesh
# input are the face-vertex indices inside an (M x 3) array F
# and the vertices in a (N x 3) array V
def trimesh(F, V, new_figure=True):
if new_figure:
mlab.figure()
mlab.triangular_mesh(V[:,0], V[:,1] , V[:,2] , F)
mlab.show()
# small helper function that is used to visualize the coordinate axes
def draw_axes():
mlab.points3d(1, 0, 0, 1, scale_factor=0.1, color=(1, 0, 0))
mlab.points3d(0, 1, 0, 1, scale_factor=0.1, color=(0, 1, 0))
mlab.points3d(0, 0, 1, 1, scale_factor=0.1, color=(0, 0, 1))
mlab.plot3d([0, 1], [0, 0], [0, 0])
mlab.plot3d([0, 0], [0, 1], [0, 0])
mlab.plot3d([0, 0], [0, 0], [0, 1])
# show dino triangle mesh
draw_axes()
trimesh(F, V)