|
| 1 | +/* ============================================================ |
| 2 | + ginexys-schema-engine — public API entry point |
| 3 | +
|
| 4 | + Two tiers of engine access: |
| 5 | +
|
| 6 | + 1. Spatial primitives (browser + worker, zero DOM): |
| 7 | + KDTree2D — O(log n) nearest-neighbour queries |
| 8 | + QuadTree2D — O(log n) bounding-box range queries |
| 9 | + CameraMatrix — affine 2D pan/zoom/rotate with SVG matrix sync |
| 10 | +
|
| 11 | + 2. Topology engine (worker-safe, zero DOM): |
| 12 | + PDFGeometryEngine — 4-phase SVG topology analysis pipeline |
| 13 | + Phase 1: transform baking (DOMMatrix/DOMPoint, worker-native) |
| 14 | + Phase 2: geometric classification (linearity + circularity) |
| 15 | + Phase 3: vertex snapping + port discovery (KDTree2D) |
| 16 | + Phase 4: adjacency graph (nodes, edges, junctions) |
| 17 | +
|
| 18 | + Browser CDN — full editor context: |
| 19 | + <script src="src/js/core/cameraMatrix.js"></script> |
| 20 | + <script src="src/js/core/kdTree.js"></script> |
| 21 | + <script src="src/js/core/quadTree.js"></script> |
| 22 | + <script src="src/js/core/geometry-engine.standalone.js"></script> |
| 23 | + <script src="src/js/core/engine.js"></script> |
| 24 | +
|
| 25 | + Web Worker usage: |
| 26 | + importScripts('kdTree.js', 'geometry-engine.standalone.js'); |
| 27 | + const descriptors = PDFGeometryEngine.serialize(svgElement); // main thread |
| 28 | + // postMessage(descriptors) → worker: |
| 29 | + const result = new PDFGeometryEngine({ eps: 0.5 }).analyze(descriptors); |
| 30 | + // result: { wires, components, connectors, graph, ports } |
| 31 | +
|
| 32 | + npm / ES module support planned for a future release. |
| 33 | + ============================================================ */ |
| 34 | +(function (global) { |
| 35 | + global.GinexysEngine = { |
| 36 | + /** 2D k-d tree — O(log n) nearest-neighbour spatial queries */ |
| 37 | + KDTree2D, |
| 38 | + /** 2D quad-tree — O(log n) bounding-box range queries */ |
| 39 | + QuadTree2D, |
| 40 | + /** Affine 2D camera transform — pan, zoom, rotate with SVG matrix sync */ |
| 41 | + CameraMatrix, |
| 42 | + /** Worker-safe 4-phase SVG topology analysis — accepts plain JS descriptors */ |
| 43 | + PDFGeometryEngine, |
| 44 | + version: '1.1.0', |
| 45 | + }; |
| 46 | +})(window); |
0 commit comments