abse/smartwatch-flex-top-only
Three-panel flex smartwatch with two parallel R3.9 bends, all components flat-top, low-profile JST connector harnesses, split heartbeat optical windows and screw-retained PCB mounting. Modeled 39 × 50.5 × 14.5mm prototype; 100% routing, zero native DRC and shorts. Hardware qualification pending.
- Version
- 0.2.20
- License
- unset
- Stars
- 0
scripts/mount_mesh_utils.py
"""Remove float32-collapsed boolean seams without changing usable geometry."""
import numpy as np
from scipy.spatial import cKDTree
def printable_mesh(mesh):
mesh = mesh.copy()
original = mesh.vertices.copy()
volume = mesh.volume
mesh.vertices = mesh.vertices.astype(np.float32).astype(float)
mesh.merge_vertices(digits_vertex=5, merge_tex=True, merge_norm=True)
mesh.update_faces(mesh.nondegenerate_faces())
mesh.update_faces(mesh.unique_faces())
mesh.remove_unreferenced_vertices()
error = max(cKDTree(original).query(mesh.vertices)[0].max(),
cKDTree(mesh.vertices).query(original)[0].max())
assert error < 0.000005, error
assert abs(mesh.volume-volume) < 0.0001, (mesh.volume, volume)
assert mesh.is_volume, 'Float32 manufacturing solid is not watertight'
return mesh
def numerical_face_contact(a,b):
"""Prove FCL's seated-face alarm is only a float32 Boolean sliver.
Volume alone is insufficient: every overlap vertex must also lie within
5um of BOTH original mating surfaces. Never use to waive a real collision.
"""
import trimesh,numpy as np
meshes=[]
for original in [a,b]:
m=original.copy();m.merge_vertices(merge_tex=True,merge_norm=True)
m.fix_normals(multibody=True)
if not m.is_volume:return False
meshes.append(m)
intersection=trimesh.boolean.intersection(meshes,engine='manifold')
if intersection is None or not len(intersection.vertices):return True
if abs(intersection.volume)>0.000001:return False
return all(np.max(trimesh.proximity.closest_point(m,intersection.vertices)[1])<=.000005 for m in meshes)