import os, sys, struct sys.path.insert(0, r'C:\VWE\TeslaRel410\dpl3-revive\patha') os.environ.setdefault('SDL_VIDEODRIVER', 'dummy') import numpy as np from vrboard import VirtualBoard, Msg, A from vrview import Renderer data = open(sys.argv[1], 'rb').read() board = VirtualBoard() off = 0 while off + 8 <= len(data): if data[off:off + 4] != b'VPXM': off += 1; continue ln = struct.unpack_from('= 4: a = struct.unpack_from('= 96: f = struct.unpack_from('<24f', vb, 0) print('VIEW hither(near)=%.1f yon(far)=%.1f zeye=%.2f imageplane x[%.2f,%.2f] y[%.2f,%.2f]' % (f[12], f[13], f[9], f[5], f[7], f[6], f[8])) allpos = [] for inst in c.instances: M = r.chain_matrix(board, inst['chain']) for g in inst['geoms']: mesh = c._mesh(board, g) if not mesh or 'pos' not in mesh or len(mesh['pos']) == 0: continue pw = mesh['pos'] @ M[:3, :3] + M[3, :3] allpos.append(pw) allpos = np.concatenate(allpos) print('ALL verts: %d Y[min=%.1f max=%.1f median=%.1f]' % (len(allpos), allpos[:, 1].min(), allpos[:, 1].max(), np.median(allpos[:, 1]))) # geometry near the mech in the XZ plane (would be the ground under/around it) d = np.sqrt((allpos[:, 0] - mech[0])**2 + (allpos[:, 2] - mech[2])**2) for rad in (100, 300, 800, 2000): near = allpos[d < rad] if len(near): print(' within %4d of mech: %6d verts Y[%.1f..%.1f] med %.1f' % (rad, len(near), near[:, 1].min(), near[:, 1].max(), np.median(near[:, 1]))) else: print(' within %4d of mech: 0 verts (NO geometry here)' % rad)