MCPcopy
hub / github.com/OpenMotionLab/MotionGPT / update

Function update

mGPT/render/matplot/plot_3d_global.py:52–129  ·  view source on GitHub ↗
(index)

Source from the content-addressed store, hash-verified

50 data[..., 2] -= data[:, 0:1, 2]
51
52 def update(index):
53 def init():
54 ax.set_xlim3d([-radius / 2, radius / 2])
55 ax.set_ylim3d([0, radius])
56 ax.set_zlim3d([0, radius])
57 ax.grid(b=False)
58
59 def plot_xzPlane(minx, maxx, miny, minz, maxz):
60 ## Plot a plane XZ
61 verts = [[minx, miny, minz], [minx, miny, maxz],
62 [maxx, miny, maxz], [maxx, miny, minz]]
63 xz_plane = Poly3DCollection([verts])
64 xz_plane.set_facecolor((0.5, 0.5, 0.5, 0.5))
65 ax.add_collection3d(xz_plane)
66
67 fig = plt.figure(figsize=(480 / 96., 320 / 96.),
68 dpi=96) if nb_joints == 21 else plt.figure(
69 figsize=(10, 10), dpi=96)
70 # fig.tight_layout()
71 if title is not None:
72 wraped_title = '\n'.join(wrap(title, 40))
73 fig.suptitle(wraped_title, fontsize=16)
74 ax = p3.Axes3D(fig, auto_add_to_figure=False)
75 fig.add_axes(ax)
76
77 init()
78
79 # ax.lines = []
80 # ax.collections = []
81 ax.view_init(elev=110, azim=-90)
82 ax.dist = 7.5
83 # ax =
84 plot_xzPlane(MINS[0] - trajec[index, 0], MAXS[0] - trajec[index, 0], 0,
85 MINS[2] - trajec[index, 1], MAXS[2] - trajec[index, 1])
86 # ax.scatter(data[index, :22, 0], data[index, :22, 1], data[index, :22, 2], color='black', s=3)
87
88 if index > 1:
89 ax.plot3D(trajec[:index, 0] - trajec[index, 0],
90 np.zeros_like(trajec[:index, 0]),
91 trajec[:index, 1] - trajec[index, 1],
92 linewidth=1.0,
93 color='blue')
94 # ax = plot_xzPlane(ax, MINS[0], MAXS[0], 0, MINS[2], MAXS[2])
95
96 for i, (chain, color) in enumerate(zip(smpl_kinetic_chain, colors)):
97 # print(color)
98 if i < 5:
99 linewidth = 4.0
100 else:
101 linewidth = 2.0
102 ax.plot3D(data[index, chain, 0],
103 data[index, chain, 1],
104 data[index, chain, 2],
105 linewidth=linewidth,
106 color=color)
107 # print(trajec[:index, 0].shape)
108
109 plt.axis('off')

Callers 1

plot_3d_motionFunction · 0.70

Calls 2

initFunction · 0.85
plot_xzPlaneFunction · 0.85

Tested by

no test coverage detected