Files
animation/characters/female/lena_nude/hires_work/verify_03.py
T

47 lines
1.6 KiB
Python
Raw Normal View History

import bpy
import sys
import os
import numpy as np
import bmesh
sys.path.append(os.getcwd())
bpy.ops.wm.open_mainfile(filepath='characters/female/lena_nude/hires_work/03_sculpted.blend')
obj = bpy.context.active_object
mesh = obj.data
verts = np.empty(len(mesh.vertices) * 3, dtype=np.float32)
mesh.vertices.foreach_get('co', verts)
verts = verts.reshape(-1, 3)
z = verts[:, 2]
y = verts[:, 1]
x = verts[:, 0]
print('--- Verification ---')
apex_z_target = 0.688
apex_mask = (z > apex_z_target - 0.01) & (z < apex_z_target + 0.01)
if np.any(apex_mask):
apex_y = y[apex_mask]
apex_x = x[apex_mask]
min_y = np.min(apex_y)
print(f'Apex Z range: {np.min(z[apex_mask]):.3f} - {np.max(z[apex_mask]):.3f}')
print(f'Apex Y (front-most): {min_y:.4f}')
print(f'Apex X range: {np.min(apex_x):.3f} to {np.max(apex_x):.3f}')
chest_wall_y = -0.1565
proj = abs(min_y - chest_wall_y)
print(f'Projection: {proj:.4f} (Target 0.036-0.044)')
else:
print('No vertices found at apex Z.')
print('--- Cleavage Check ---')
sternum_mask = (np.abs(x) < 0.005) & (z > 0.65) & (z < 0.72)
if np.any(sternum_mask):
sternum_y = y[sternum_mask]
sternum_z = z[sternum_mask]
min_idx = np.argmin(sternum_y)
print(f'Sternum at apex Z ({apex_z_target}): Y={sternum_y[min_idx]:.4f}')
print(f'Gap to Apex: {min_y - sternum_y[min_idx]:.4f} (Target > 0.015)')
else:
print('No sternum vertices found.')
print('--- Boundary Check ---')
bm = bmesh.new()
bm.from_mesh(mesh)
bm.edges.ensure_lookup_table()
boundary_edges = [e for e in bm.edges if e.is_boundary]
print(f'Open boundary edges: {len(boundary_edges)}')