import struct
b=open("content/VIDEO/GEO/BLX_COP.BGF",'rb').read()
def verts(off,ln):
    n=ln//20; out=[]
    for i in range(n):
        p=off+i*20
        x,y,z,u,v=struct.unpack_from('<5f',b,p)
        out.append((x,y,z,u,v))
    return out
# main utorso pmesh
main=verts(0x00ba,3920)
nz=[(i,v) for i,v in enumerate(main) if abs(v[3])>1e-6 or abs(v[4])>1e-6]
print("utorso main: %d verts, %d nonzero-UV"%(len(main),len(nz)))
xs=[v[0] for v in main]; ys=[v[1] for v in main]; zs=[v[2] for v in main]
print(" bbox x[%.2f,%.2f] y[%.2f,%.2f] z[%.2f,%.2f]"%(min(xs),max(xs),min(ys),max(ys),min(zs),max(zs)))
print(" nonzero-UV verts (idx: x y z | u v):")
for i,v in nz:
    print("   %3d: %7.2f %7.2f %7.2f | %6.3f %6.3f"%(i,v[0],v[1],v[2],v[3],v[4]))
# uv range for nonzero
if nz:
    us=[v[3] for _,v in nz]; vs=[v[4] for _,v in nz]
    print(" nonzero UV range u[%.3f,%.3f] v[%.3f,%.3f]"%(min(us),max(us),min(vs),max(vs)))
