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/material-pad-partition.mjs
import {copperModel,SpatialCopper} from './copper-model.mjs'
import {gap} from './copper-geometry.mjs'
// Actual conductive material contacts only; metadata never creates an edge.
export function materialPadPartition(cache,source,net) {
const shapes=copperModel(cache,source).filter(s=>s.net===net),index=new SpatialCopper(shapes)
const ids=new Map(shapes.map((s,i)=>[s,i])),parent=shapes.map((_,i)=>i)
const root=i=>parent[i]===i?i:(parent[i]=root(parent[i]))
for(const [i,s] of shapes.entries())for(const o of index.near(s,1e-6)) {
const j=ids.get(o)
if(j<=i||!s.layers.some(l=>o.layers.includes(l))||gap(s,o)>1e-6)continue
parent[root(i)]=root(j)
}
const groups=new Map()
for(const [i,s]of shapes.entries())if(s.pad) {
const r=root(i);if(!groups.has(r))groups.set(r,new Set());groups.get(r).add(s.port)
}
return JSON.stringify([...groups.values()].map(p=>[...p].sort()).sort((a,b)=>a[0].localeCompare(b[0])))
}