UNPKG

@wayrisignals/kicad-webview

Version:

Interactive KiCad schematic, PCB and 3D viewer for the web, with Gerber, Excellon, linked views and offline HTML exports

3 lines (2 loc) • 798 B
/*! KiCad WebView 1.2.1 | Copyright (c) 2026 wayri | SPDX-License-Identifier: MPL-2.0 | Source: https://github.com/wayri/kicad-webview/tree/v1.2.1 | Keep LICENSE and THIRD-PARTY-NOTICES.md; bundled dependencies retain their licenses. */ function y(p){let o=a=>{let r=p?.[a];if(!Array.isArray(r)||r.length!==3||!r.every(n=>typeof n=="number"&&Number.isFinite(n)&&Math.abs(n)<=1e7))throw new TypeError("Choose finite bounded 3D camera vectors.");return[...r]},i=o("position"),s=o("target"),e=o("up"),t=i.map((a,r)=>a-s[r]),c=Math.hypot(...t),h=Math.hypot(...e),u=[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]];if(c<1e-4||h<1e-8||Math.hypot(...u)<c*h*1e-6)throw new TypeError("Choose a nondegenerate 3D camera direction and up vector.");return{position:i,target:s,up:e}}export{y as a};