UNPKG

@typecad/typecad

Version:

🤖programmatically 💥create 🛰️hardware

1 lines 3.18 kB
function a15_0x57ac(_0x245cdb,_0x57ac34){const _0x208dac=a15_0x245c();return a15_0x57ac=function(_0x519d20,_0x5f5b68){_0x519d20=_0x519d20-0x0;let _0x33bff3=_0x208dac[_0x519d20];return _0x33bff3;},a15_0x57ac(_0x245cdb,_0x57ac34);}export function calculateViaCurrentCapacity(_0x45da9a,_0x2d4dbf,_0x3fe41e,_0x351cc2,_0x1ba81c=0xa){const _0x4b5f71=_0x3fe41e??0x23,_0xa9799a=0.048,_0x5d307e=0.44;function _0x5c8287(_0x62b385,_0x5ac22e){return a15_0x57ac(_0x62b385- -0xac,_0x5ac22e);}const _0x6ea7ba=0.75,_0x36288d=_0x2d4dbf/0.0254,_0x4c3a12=_0x4b5f71/25.4,_0x342905=Math['PI']*(_0x36288d+_0x4c3a12)*_0x4c3a12,_0x4e7231=_0xa9799a*Math[_0x5c8287(-0xac,-0xaf)](_0x1ba81c,_0x5d307e)*Math['pow'](_0x342905,_0x6ea7ba);return _0x4e7231;}export function calculateMinTraceWidth(_0x123cd8,_0x27165d,_0x5babb9,_0x363bec){const _0x887271=_0x27165d===_0x11fbeb(-0x19a,-0x199)||_0x27165d==='B.Cu'?0.048:0.024,_0x318f6e=0.44,_0x2184c2=0.725,_0x25ddab=1.378,_0x4bd7bb=_0x363bec/0x23,_0x21cdfc=Math[_0x11fbeb(-0x199,-0x19a)](_0x123cd8/(_0x887271*Math['pow'](_0x5babb9,_0x318f6e)),0x1/_0x2184c2),_0x1159c4=_0x21cdfc/(_0x4bd7bb*_0x25ddab);function _0x11fbeb(_0x849164,_0x2e3b4a){return a15_0x57ac(_0x2e3b4a- -0x19a,_0x849164);}const _0xd159c4=_0x1159c4*0.0254;return _0xd159c4;}function a15_0x245c(){const _0x2c84df=['pow','F.Cu','max','min','push','number','pcb'];a15_0x245c=function(){return _0x2c84df;};return a15_0x245c();}export function calculateBoardBounds(_0x50dfec,_0x357958,_0x16b48e){let _0x26daa9=Infinity,_0x41cc6a=-Infinity,_0x577046=Infinity,_0x3ed5f4=-Infinity,_0x237a22=0x0;if(_0x357958&&_0x357958['length']>0x0){for(const _0x41d0da of _0x357958){_0x26daa9=Math['min'](_0x26daa9,_0x41d0da['x']),_0x41cc6a=Math[_0x4d7dc6(-0x329,-0x32c)](_0x41cc6a,_0x41d0da['x']+_0x41d0da['width']),_0x577046=Math[_0x4d7dc6(-0x328,-0x32c)](_0x577046,_0x41d0da['y']),_0x3ed5f4=Math['max'](_0x3ed5f4,_0x41d0da['y']+_0x41d0da['height']);}if(isFinite(_0x26daa9))return{'minX':_0x26daa9,'maxX':_0x41cc6a,'minY':_0x577046,'maxY':_0x3ed5f4};}const _0x562814=[];_0x50dfec&&_0x562814[_0x4d7dc6(-0x327,-0x32a)](..._0x50dfec);function _0x4d7dc6(_0x57e9cb,_0x47d099){return a15_0x57ac(_0x57e9cb- -0x32b,_0x47d099);}_0x16b48e&&_0x562814['push'](..._0x16b48e);for(const _0x4210d6 of _0x562814){if(_0x4210d6['dnp']||_0x4210d6['via'])continue;typeof _0x4210d6['pcb']['x']==='number'&&typeof _0x4210d6['pcb']['y']===_0x4d7dc6(-0x326,-0x32a)&&(_0x26daa9=Math['min'](_0x26daa9,_0x4210d6['pcb']['x']),_0x41cc6a=Math['max'](_0x41cc6a,_0x4210d6[_0x4d7dc6(-0x325,-0x328)]['x']),_0x577046=Math['min'](_0x577046,_0x4210d6['pcb']['y']),_0x3ed5f4=Math['max'](_0x3ed5f4,_0x4210d6['pcb']['y']),_0x237a22++);}if(_0x237a22>0x0&&isFinite(_0x26daa9)){const _0x350c1d=(_0x26daa9+_0x41cc6a)/0x2,_0x28cc5d=(_0x577046+_0x3ed5f4)/0x2,_0x5b0ba=_0x41cc6a-_0x26daa9,_0x884bdd=_0x3ed5f4-_0x577046,_0xafaf6a=Math[_0x4d7dc6(-0x329,-0x32c)](_0x5b0ba*0.5,0x14),_0x362be3=Math['max'](_0x884bdd*0.5,0x14),_0xef22ec={'minX':_0x350c1d-_0x5b0ba/0x2-_0xafaf6a,'maxX':_0x350c1d+_0x5b0ba/0x2+_0xafaf6a,'minY':_0x28cc5d-_0x884bdd/0x2-_0x362be3,'maxY':_0x28cc5d+_0x884bdd/0x2+_0x362be3};return _0xef22ec;}return{'minX':-0x32,'maxX':0x32,'minY':-0x32,'maxY':0x32};}