├── .editorconfig ├── .eslintrc.cjs ├── .gitignore ├── .vscode ├── extensions.json ├── launch.json └── tasks.json ├── README.md ├── angular.json ├── jest.config.js ├── package-lock.json ├── package.json ├── projects └── clipper2-js │ ├── LICENSE.txt │ ├── README.md │ ├── ng-package.json │ ├── package.json │ ├── screenshot.png │ ├── src │ ├── lib │ │ ├── clipper.ts │ │ ├── core.ts │ │ ├── engine.ts │ │ ├── minkowski.ts │ │ ├── offset.ts │ │ └── rectclip.ts │ └── public-api.ts │ ├── tests │ ├── clipperparse.ts │ ├── lines.test.ts │ ├── offset.test.ts │ └── polygons.test.ts │ ├── tsconfig.lib.json │ ├── tsconfig.lib.prod.json │ └── tsconfig.spec.json ├── setup-jest.ts ├── src ├── app │ ├── app.component.html │ ├── app.component.ts │ ├── app.module.ts │ ├── clipper-example.ts │ ├── threejs-app.ts │ └── ui-routes.ts ├── assets │ ├── .gitkeep │ └── helvetiker_regular.typeface.json ├── favicon.ico ├── index.html ├── main.ts └── styles.css ├── tsconfig.app.json ├── tsconfig.json └── tsconfig.spec.json /.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.ts] 12 | quote_type = single 13 | 14 | [*.md] 15 | max_line_length = off 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /.eslintrc.cjs: -------------------------------------------------------------------------------- 1 | /* eslint-env node */ 2 | module.exports = { 3 | extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'], 4 | parser: '@typescript-eslint/parser', 5 | plugins: ['@typescript-eslint'], 6 | root: true, 7 | }; 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # Compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | /bazel-out 8 | 9 | # Node 10 | /node_modules 11 | npm-debug.log 12 | yarn-error.log 13 | 14 | # IDEs and editors 15 | .idea/ 16 | .project 17 | .classpath 18 | .c9/ 19 | *.launch 20 | .settings/ 21 | *.sublime-workspace 22 | 23 | # Visual Studio Code 24 | .vscode/* 25 | !.vscode/settings.json 26 | !.vscode/tasks.json 27 | !.vscode/launch.json 28 | !.vscode/extensions.json 29 | .history/* 30 | 31 | # Miscellaneous 32 | /.angular/cache 33 | .sass-cache/ 34 | /connect.lock 35 | /coverage 36 | /libpeerconnection.log 37 | testem.log 38 | /typings 39 | 40 | # System files 41 | .DS_Store 42 | Thumbs.db 43 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=827846 3 | "recommendations": ["angular.ng-template"] 4 | } 5 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 3 | "version": "0.2.0", 4 | "configurations": [ 5 | { 6 | "name": "ng serve", 7 | "type": "pwa-chrome", 8 | "request": "launch", 9 | "preLaunchTask": "npm: start", 10 | "url": "http://localhost:4200/" 11 | }, 12 | { 13 | "name": "ng test", 14 | "type": "chrome", 15 | "request": "launch", 16 | "preLaunchTask": "npm: test", 17 | "url": "http://localhost:9876/debug.html" 18 | } 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | // For more information, visit: https://go.microsoft.com/fwlink/?LinkId=733558 3 | "version": "2.0.0", 4 | "tasks": [ 5 | { 6 | "type": "npm", 7 | "script": "start", 8 | "isBackground": true, 9 | "problemMatcher": { 10 | "owner": "typescript", 11 | "pattern": "$tsc", 12 | "background": { 13 | "activeOnStart": true, 14 | "beginsPattern": { 15 | "regexp": "(.*?)" 16 | }, 17 | "endsPattern": { 18 | "regexp": "bundle generation complete" 19 | } 20 | } 21 | } 22 | }, 23 | { 24 | "type": "npm", 25 | "script": "test", 26 | "isBackground": true, 27 | "problemMatcher": { 28 | "owner": "typescript", 29 | "pattern": "$tsc", 30 | "background": { 31 | "activeOnStart": true, 32 | "beginsPattern": { 33 | "regexp": "(.*?)" 34 | }, 35 | "endsPattern": { 36 | "regexp": "bundle generation complete" 37 | } 38 | } 39 | } 40 | } 41 | ] 42 | } 43 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # clipper2-ts 2 | Example of using [clipper2-js](https://github.com/IRobot1/clipper2-ts/tree/master/projects/clipper2-js) Union, Intersection and Difference clipping operations. 3 | Shapes are rendered and animated using threejs 4 | 5 | [![NPM Package][npm]][npm-url] 6 | 7 | 8 | [Codesandbox demo](https://codesandbox.io/s/three-clipper-example-fg4lp9) 9 | 10 | ![image](./projects/clipper2-js/screenshot.png) 11 | 12 | ### Documentation 13 | 14 | [Clipper2 HTML documentation](http://www.angusj.com/clipper2/Docs/Overview.htm) 15 | 16 | ### Example 17 | 18 | ```ts 19 | const subj = new Paths64(); 20 | const clip = new Paths64(); 21 | subj.push(Clipper.makePath([ 100, 50, 10, 79, 65, 2, 65, 98, 10, 21 ])); 22 | clip.push(Clipper.makePath([98, 63, 4, 68, 77, 8, 52, 100, 19, 12])); 23 | const solution = Clipper.Intersect(subj, clip, FillRule.NonZero); 24 | ``` 25 | 26 | [npm]: https://img.shields.io/npm/v/clipper2-js 27 | [npm-url]: https://www.npmjs.com/package/clipper2-js 28 | -------------------------------------------------------------------------------- /angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "clipper2-ts": { 7 | "projectType": "application", 8 | "schematics": {}, 9 | "root": "", 10 | "sourceRoot": "src", 11 | "prefix": "app", 12 | "architect": { 13 | "build": { 14 | "builder": "@angular-devkit/build-angular:browser", 15 | "options": { 16 | "outputPath": "dist/clipper2-ts", 17 | "index": "src/index.html", 18 | "main": "src/main.ts", 19 | "polyfills": [ 20 | "zone.js" 21 | ], 22 | "tsConfig": "tsconfig.app.json", 23 | "assets": [ 24 | "src/favicon.ico", 25 | "src/assets" 26 | ], 27 | "styles": [ 28 | "src/styles.css" 29 | ], 30 | "scripts": [] 31 | }, 32 | "configurations": { 33 | "production": { 34 | "budgets": [ 35 | { 36 | "type": "initial", 37 | "maximumWarning": "500kb", 38 | "maximumError": "1mb" 39 | }, 40 | { 41 | "type": "anyComponentStyle", 42 | "maximumWarning": "2kb", 43 | "maximumError": "4kb" 44 | } 45 | ], 46 | "outputHashing": "all" 47 | }, 48 | "development": { 49 | "buildOptimizer": false, 50 | "optimization": false, 51 | "vendorChunk": true, 52 | "extractLicenses": false, 53 | "sourceMap": true, 54 | "namedChunks": true 55 | } 56 | }, 57 | "defaultConfiguration": "production" 58 | }, 59 | "serve": { 60 | "builder": "@angular-devkit/build-angular:dev-server", 61 | "configurations": { 62 | "production": { 63 | "browserTarget": "clipper2-ts:build:production" 64 | }, 65 | "development": { 66 | "browserTarget": "clipper2-ts:build:development" 67 | } 68 | }, 69 | "defaultConfiguration": "development" 70 | }, 71 | "extract-i18n": { 72 | "builder": "@angular-devkit/build-angular:extract-i18n", 73 | "options": { 74 | "browserTarget": "clipper2-ts:build" 75 | } 76 | }, 77 | "test": { 78 | "builder": "@angular-devkit/build-angular:karma", 79 | "options": { 80 | "polyfills": [ 81 | "zone.js", 82 | "zone.js/testing" 83 | ], 84 | "tsConfig": "tsconfig.spec.json", 85 | "assets": [ 86 | "src/favicon.ico", 87 | "src/assets" 88 | ], 89 | "styles": [ 90 | "src/styles.css" 91 | ], 92 | "scripts": [] 93 | } 94 | } 95 | } 96 | }, 97 | "clipper2-js": { 98 | "projectType": "library", 99 | "root": "projects/clipper2-js", 100 | "sourceRoot": "projects/clipper2-js/src", 101 | "prefix": "lib", 102 | "architect": { 103 | "build": { 104 | "builder": "@angular-devkit/build-angular:ng-packagr", 105 | "options": { 106 | "project": "projects/clipper2-js/ng-package.json" 107 | }, 108 | "configurations": { 109 | "production": { 110 | "tsConfig": "projects/clipper2-js/tsconfig.lib.prod.json" 111 | }, 112 | "development": { 113 | "tsConfig": "projects/clipper2-js/tsconfig.lib.json" 114 | } 115 | }, 116 | "defaultConfiguration": "production" 117 | }, 118 | "test": { 119 | "builder": "@angular-devkit/build-angular:karma", 120 | "options": { 121 | "tsConfig": "projects/clipper2-js/tsconfig.spec.json", 122 | "polyfills": [ 123 | "zone.js", 124 | "zone.js/testing" 125 | ] 126 | } 127 | } 128 | } 129 | } 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | preset: 'jest-preset-angular', 3 | setupFilesAfterEnv: ['/setup-jest.ts'], 4 | globalSetup: 'jest-preset-angular/global-setup', 5 | }; 6 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "clipper2-ts", 3 | "version": "1.0.0", 4 | "scripts": { 5 | "ng": "ng", 6 | "start": "ng serve", 7 | "build": "ng build", 8 | "watch": "ng build --watch --configuration development", 9 | "test": "jest", 10 | "test:watch": "jest --watch", 11 | "test:ci": "jest --runInBand", 12 | "publish": "ng build clipper2-js --configuration production && cd dist/clipper2-js && npm publish --access=public" 13 | }, 14 | "private": true, 15 | "dependencies": { 16 | "@angular/animations": "^15.1.0", 17 | "@angular/common": "^15.1.0", 18 | "@angular/compiler": "^15.1.0", 19 | "@angular/core": "^15.1.0", 20 | "@angular/forms": "^15.1.0", 21 | "@angular/platform-browser": "^15.1.0", 22 | "@angular/platform-browser-dynamic": "^15.1.0", 23 | "@angular/router": "^15.1.0", 24 | "rxjs": "~7.8.0", 25 | "three": "^0.156.0", 26 | "tslib": "^2.3.0", 27 | "zone.js": "~0.12.0" 28 | }, 29 | "devDependencies": { 30 | "@angular-devkit/build-angular": "^15.1.5", 31 | "@angular/cli": "~15.1.5", 32 | "@angular/compiler-cli": "^15.1.0", 33 | "@types/jest": "^29.5.4", 34 | "@types/node": "^20.5.7", 35 | "@types/three": "^0.155.1", 36 | "@typescript-eslint/eslint-plugin": "^6.5.0", 37 | "@typescript-eslint/parser": "^6.5.0", 38 | "eslint": "^8.48.0", 39 | "jest": "^29.6.4", 40 | "jest-preset-angular": "^13.1.1", 41 | "ng-packagr": "^15.1.0", 42 | "typescript": "~4.9.4" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /projects/clipper2-js/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Boost Software License - Version 1.0 - August 17th, 2003 2 | 3 | Permission is hereby granted, free of charge, to any person or organization 4 | obtaining a copy of the software and accompanying documentation covered by 5 | this license (the "Software") to use, reproduce, display, distribute, 6 | execute, and transmit the Software, and to prepare derivative works of the 7 | Software, and to permit third-parties to whom the Software is furnished to 8 | do so, all subject to the following: 9 | 10 | The copyright notices in the Software and this entire statement, including 11 | the above license grant, this restriction and the following disclaimer, 12 | must be included in all copies of the Software, in whole or in part, and 13 | all derivative works of the Software, unless such copies or derivative 14 | works are solely in the form of machine-executable object code generated by 15 | a source language processor. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 20 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 21 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 22 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | DEALINGS IN THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /projects/clipper2-js/README.md: -------------------------------------------------------------------------------- 1 | # clipper2-js 2 | 3 | ![npm](https://img.shields.io/npm/v/clipper2-js) 4 | 5 | A native Typescript/Javascript port of Clipper2 6 | 7 | ![image](https://github.com/IRobot1/clipper2-ts/blob/master/projects/clipper2-js/screenshot.png) 8 | 9 | ### Overview 10 | 11 | clipper2-js was ported from the original [Clipper2 C# implementation](https://github.com/AngusJohnson/Clipper2). However, the Java implementation was used as guidance for some conversion solutions 12 | 13 | Clipper2 performs all clipping operations using integer coordinates internally. Since Javascript doesn't have a native integer data type, all values are rounded. To avoid precision loss, its recommended to scale up any values before adding paths and scale down, by the same factor, the clipped results. 14 | 15 | The `Clipper` class provides static methods for clipping, path-offsetting, minkowski-sums and path simplification. 16 | For more complex clipping operations (e.g. when clipping open paths or when outputs are expected to include polygons nested within holes of others), use the `Clipper64` class directly. 17 | 18 | ### Documentation 19 | 20 | [Clipper2 HTML documentation](http://www.angusj.com/clipper2/Docs/Overview.htm) 21 | 22 | ### Example 23 | 24 | ```ts 25 | const subj = new Paths64(); 26 | const clip = new Paths64(); 27 | subj.push(Clipper.makePath([ 100, 50, 10, 79, 65, 2, 65, 98, 10, 21 ])); 28 | clip.push(Clipper.makePath([98, 63, 4, 68, 77, 8, 52, 100, 19, 12])); 29 | const solution = Clipper.Intersect(subj, clip, FillRule.NonZero); 30 | ``` 31 | 32 | ### Developer Notes 33 | * An Angular project is used to host clipper2-js, but the library does not depend on Angular. 34 | * Jest is used for unit tests 35 | * All line units tests are passing. Some polygon tests are still failing and needs further investigation. However, the example demonstrates its basically working. 36 | 37 | ### Support 38 | Bug fixes will be integrated when original clipper2 has new releases. 39 | 40 | ## Conversion to Typescript 41 | * ChatGPT did most of the code conversion. It took a few more days to get resulting code to compile. A few more days to add unit tests and remove bugs I'd introduced. 42 | * Context or return objects are used to replicate C# `ref` (pass-by-reference) behaviour. 43 | * Uses lower-case (x, y) for point coordinates. 44 | * Variables and methods have been renamed to camelCase 45 | * Jest units test included 46 | 47 | -------------------------------------------------------------------------------- /projects/clipper2-js/ng-package.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "../../node_modules/ng-packagr/ng-package.schema.json", 3 | "dest": "../../dist/clipper2-js", 4 | "lib": { 5 | "entryFile": "src/public-api.ts" 6 | } 7 | } -------------------------------------------------------------------------------- /projects/clipper2-js/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "clipper2-js", 3 | "version": "1.2.4", 4 | "homepage": "https://github.com/IRobot1/clipper2-ts/tree/master/projects/clipper2-js", 5 | "repository": "https://github.com/IRobot1/clipper2-ts/tree/master/projects/clipper2-js", 6 | "license": "Boost Software License", 7 | "peerDependencies": { 8 | "@angular/common": "^15.1.0", 9 | "@angular/core": "^15.1.0" 10 | }, 11 | "dependencies": { 12 | "tslib": "^2.3.0" 13 | }, 14 | "sideEffects": false 15 | } 16 | -------------------------------------------------------------------------------- /projects/clipper2-js/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IRobot1/clipper2-ts/eefbad501c878c3c28ecd39f7af210ba9b53c937/projects/clipper2-js/screenshot.png -------------------------------------------------------------------------------- /projects/clipper2-js/src/lib/clipper.ts: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Author : Angus Johnson * 3 | * Date : 16 July 2023 * 4 | * Website : http://www.angusj.com * 5 | * Copyright : Angus Johnson 2010-2023 * 6 | * Purpose : This module contains simple functions that will likely cover * 7 | * most polygon boolean and offsetting needs, while also avoiding * 8 | * the inherent complexities of the other modules. * 9 | * Thanks : Special thanks to Thong Nguyen, Guus Kuiper, Phil Stopford, * 10 | * : and Daniel Gosnell for their invaluable assistance with C#. * 11 | * License : http://www.boost.org/LICENSE_1_0.txt * 12 | *******************************************************************************/ 13 | 14 | // 15 | // Converted from C# implemention https://github.com/AngusJohnson/Clipper2/blob/main/CSharp/Clipper2Lib/Clipper.cs 16 | // Removed support for USINGZ 17 | // 18 | // Converted by ChatGPT 4 August 3 version https://help.openai.com/en/articles/6825453-chatgpt-release-notes 19 | // 20 | 21 | import { ClipType, FillRule, IPoint64, InternalClipper, MidpointRounding, Path64, PathType, Paths64, Point64, Rect64, midPointRound } from "./core"; 22 | import { Clipper64, PointInPolygonResult, PolyPath64, PolyPathBase, PolyTree64 } from "./engine"; 23 | import { Minkowski } from "./minkowski"; 24 | import { ClipperOffset, EndType, JoinType } from "./offset"; 25 | import { RectClip64, RectClipLines64 } from "./rectclip"; 26 | 27 | export class Clipper { 28 | 29 | private static invalidRect64: Rect64 30 | public static get InvalidRect64(): Rect64 { 31 | if (!Clipper.invalidRect64) Clipper.invalidRect64 = new Rect64(false); 32 | return this.invalidRect64; 33 | } 34 | 35 | public static Intersect(subject: Paths64, clip: Paths64, fillRule: FillRule): Paths64 { 36 | return this.BooleanOp(ClipType.Intersection, subject, clip, fillRule); 37 | } 38 | 39 | public static Union(subject: Paths64, clip?: Paths64, fillRule = FillRule.EvenOdd): Paths64 { 40 | return this.BooleanOp(ClipType.Union, subject, clip, fillRule); 41 | } 42 | 43 | public static Difference(subject: Paths64, clip: Paths64, fillRule: FillRule): Paths64 { 44 | return this.BooleanOp(ClipType.Difference, subject, clip, fillRule); 45 | } 46 | 47 | public static Xor(subject: Paths64, clip: Paths64, fillRule: FillRule): Paths64 { 48 | return this.BooleanOp(ClipType.Xor, subject, clip, fillRule); 49 | } 50 | 51 | public static BooleanOp(clipType: ClipType, subject?: Paths64, clip?: Paths64, fillRule = FillRule.EvenOdd): Paths64 { 52 | const solution: Paths64 = new Paths64(); 53 | if (!subject) return solution; 54 | const c: Clipper64 = new Clipper64(); 55 | c.addPaths(subject, PathType.Subject); 56 | if (clip) 57 | c.addPaths(clip, PathType.Clip); 58 | c.execute(clipType, fillRule, solution); 59 | return solution; 60 | } 61 | 62 | //public static BooleanOp(clipType: ClipType, subject: Paths64, clip: Paths64, polytree: PolyTree64, fillRule: FillRule): void { 63 | // if (!subject) return; 64 | // const c: Clipper64 = new Clipper64(); 65 | // c.addPaths(subject, PathType.Subject); 66 | // if (clip) 67 | // c.addPaths(clip, PathType.Clip); 68 | // c.execute(clipType, fillRule, polytree); 69 | //} 70 | 71 | public static InflatePaths(paths: Paths64, delta: number, joinType: JoinType, endType: EndType, miterLimit: number = 2.0): Paths64 { 72 | const co: ClipperOffset = new ClipperOffset(miterLimit); 73 | co.addPaths(paths, joinType, endType); 74 | const solution: Paths64 = new Paths64(); 75 | co.execute(delta, solution); 76 | return solution; 77 | } 78 | 79 | public static RectClipPaths(rect: Rect64, paths: Paths64): Paths64 { 80 | if (rect.isEmpty() || paths.length === 0) return new Paths64(); 81 | const rc = new RectClip64(rect); 82 | return rc.execute(paths); 83 | } 84 | 85 | public static RectClip(rect: Rect64, path: Path64): Paths64 { 86 | if (rect.isEmpty() || path.length === 0) return new Paths64(); 87 | const tmp: Paths64 = new Paths64(); 88 | tmp.push(path); 89 | return this.RectClipPaths(rect, tmp); 90 | } 91 | 92 | public static RectClipLinesPaths(rect: Rect64, paths: Paths64): Paths64 { 93 | if (rect.isEmpty() || paths.length === 0) return new Paths64(); 94 | const rc = new RectClipLines64(rect); 95 | return rc.execute(paths); 96 | } 97 | 98 | public static RectClipLines(rect: Rect64, path: Path64): Paths64 { 99 | if (rect.isEmpty() || path.length === 0) return new Paths64(); 100 | const tmp: Paths64 = new Paths64(); 101 | tmp.push(path); 102 | return this.RectClipLinesPaths(rect, tmp); 103 | } 104 | 105 | public static MinkowskiSum(pattern: Path64, path: Path64, isClosed: boolean): Paths64 { 106 | return Minkowski.sum(pattern, path, isClosed); 107 | } 108 | 109 | public static MinkowskiDiff(pattern: Path64, path: Path64, isClosed: boolean): Paths64 { 110 | return Minkowski.diff(pattern, path, isClosed); 111 | } 112 | 113 | public static area(path: Path64): number { 114 | // https://en.wikipedia.org/wiki/Shoelace_formula 115 | let a = 0.0; 116 | const cnt = path.length; 117 | if (cnt < 3) return 0.0; 118 | let prevPt = path[cnt - 1]; 119 | for (const pt of path) { 120 | a += (prevPt.y + pt.y) * (prevPt.x - pt.x); 121 | prevPt = pt; 122 | } 123 | return a * 0.5; 124 | } 125 | 126 | public static areaPaths(paths: Paths64): number { 127 | let a = 0.0; 128 | for (const path of paths) 129 | a += this.area(path); 130 | return a; 131 | } 132 | 133 | public static isPositive(poly: Path64): boolean { 134 | return this.area(poly) >= 0; 135 | } 136 | 137 | public static path64ToString(path: Path64): string { 138 | let result = ""; 139 | for (const pt of path) 140 | result += pt.toString(); 141 | return result + '\n'; 142 | } 143 | 144 | public static paths64ToString(paths: Paths64): string { 145 | let result = ""; 146 | for (const path of paths) 147 | result += this.path64ToString(path); 148 | return result; 149 | } 150 | 151 | public static offsetPath(path: Path64, dx: number, dy: number): Path64 { 152 | const result = new Path64(); 153 | for (const pt of path) 154 | result.push(new Point64(pt.x + dx, pt.y + dy)); 155 | return result; 156 | } 157 | 158 | public static scalePoint64(pt: Point64, scale: number): Point64 { 159 | const result = new Point64( 160 | midPointRound(pt.x * scale, MidpointRounding.AwayFromZero), 161 | midPointRound(pt.y * scale, MidpointRounding.AwayFromZero) 162 | ) 163 | return result; 164 | } 165 | 166 | public static scalePath(path: Path64, scale: number): Path64 { 167 | if (InternalClipper.isAlmostZero(scale - 1)) return path; 168 | const result: Path64 = []; 169 | for (const pt of path) 170 | result.push({ x: pt.x * scale, y: pt.y * scale }); 171 | return result; 172 | } 173 | 174 | public static scalePaths(paths: Paths64, scale: number): Paths64 { 175 | if (InternalClipper.isAlmostZero(scale - 1)) return paths; 176 | const result: Paths64 = []; 177 | for (const path of paths) 178 | result.push(this.scalePath(path, scale)); 179 | return result; 180 | } 181 | 182 | public static translatePath(path: Path64, dx: number, dy: number): Path64 { 183 | const result: Path64 = []; 184 | for (const pt of path) { 185 | result.push({ x: pt.x + dx, y: pt.y + dy }); 186 | } 187 | return result; 188 | } 189 | 190 | public static translatePaths(paths: Paths64, dx: number, dy: number): Paths64 { 191 | const result: Paths64 = []; 192 | for (const path of paths) { 193 | result.push(this.translatePath(path, dx, dy)); 194 | } 195 | return result; 196 | } 197 | 198 | public static reversePath(path: Path64): Path64 { 199 | return [...path].reverse(); 200 | } 201 | 202 | public static reversePaths(paths: Paths64): Paths64 { 203 | const result: Paths64 = []; 204 | for (const t of paths) { 205 | result.push(this.reversePath(t)); 206 | } 207 | return result; 208 | } 209 | 210 | public static getBounds(path: Path64): Rect64 { 211 | const result: Rect64 = Clipper.InvalidRect64; 212 | for (const pt of path) { 213 | if (pt.x < result.left) result.left = pt.x; 214 | if (pt.x > result.right) result.right = pt.x; 215 | if (pt.y < result.top) result.top = pt.y; 216 | if (pt.y > result.bottom) result.bottom = pt.y; 217 | } 218 | return result.left === Number.MAX_SAFE_INTEGER ? new Rect64(0, 0, 0, 0) : result; 219 | } 220 | 221 | public static getBoundsPaths(paths: Paths64): Rect64 { 222 | const result: Rect64 = Clipper.InvalidRect64; 223 | for (const path of paths) { 224 | for (const pt of path) { 225 | if (pt.x < result.left) result.left = pt.x; 226 | if (pt.x > result.right) result.right = pt.x; 227 | if (pt.y < result.top) result.top = pt.y; 228 | if (pt.y > result.bottom) result.bottom = pt.y; 229 | } 230 | } 231 | return result.left === Number.MAX_SAFE_INTEGER ? new Rect64(0, 0, 0, 0) : result; 232 | } 233 | 234 | static makePath(arr: number[]): Path64 { 235 | const len = arr.length / 2; 236 | const p = new Path64(); 237 | for (let i = 0; i < len; i++) 238 | p.push(new Point64(arr[i * 2], arr[i * 2 + 1])); 239 | return p; 240 | } 241 | 242 | static stripDuplicates(path: Path64, isClosedPath: boolean): Path64 { 243 | const cnt = path.length; 244 | const result = new Path64(); 245 | if (cnt === 0) return result; 246 | let lastPt = path[0]; 247 | result.push(lastPt); 248 | for (let i = 1; i < cnt; i++) 249 | if (lastPt !== path[i]) { 250 | lastPt = path[i]; 251 | result.push(lastPt); 252 | } 253 | if (isClosedPath && lastPt === result[0]) 254 | result.pop(); 255 | return result; 256 | } 257 | 258 | private static addPolyNodeToPaths(polyPath: PolyPathBase, paths: Paths64): void { 259 | if (polyPath.polygon && polyPath.polygon.length > 0) 260 | paths.push(polyPath.polygon); 261 | for (let i = 0; i < polyPath.count; i++) 262 | this.addPolyNodeToPaths(polyPath.children[i], paths); 263 | } 264 | 265 | public static polyTreeToPaths64(polyTree: PolyTree64): Paths64 { 266 | const result: Paths64 = new Paths64(); 267 | for (let i = 0; i < polyTree.count; i++) { 268 | Clipper.addPolyNodeToPaths(polyTree.children[i] as PolyPath64, result); 269 | } 270 | return result; 271 | } 272 | 273 | public static perpendicDistFromLineSqrd(pt: IPoint64, line1: IPoint64, line2: IPoint64): number { 274 | const a = pt.x - line1.x; 275 | const b = pt.y - line1.y; 276 | const c = line2.x - line1.x; 277 | const d = line2.y - line1.y; 278 | if (c === 0 && d === 0) return 0; 279 | return Clipper.sqr(a * d - c * b) / (c * c + d * d); 280 | } 281 | 282 | static rdp(path: Path64, begin: number, end: number, epsSqrd: number, flags: boolean[]): void { 283 | let idx = 0; 284 | let max_d = 0; 285 | 286 | while (end > begin && path[begin] === path[end]) { 287 | flags[end--] = false; 288 | } 289 | for (let i = begin + 1; i < end; i++) { 290 | const d = Clipper.perpendicDistFromLineSqrd(path[i], path[begin], path[end]); 291 | if (d <= max_d) continue; 292 | max_d = d; 293 | idx = i; 294 | } 295 | 296 | if (max_d <= epsSqrd) return; 297 | 298 | flags[idx] = true; 299 | if (idx > begin + 1) Clipper.rdp(path, begin, idx, epsSqrd, flags); 300 | if (idx < end - 1) Clipper.rdp(path, idx, end, epsSqrd, flags); 301 | } 302 | 303 | public static ramerDouglasPeucker(path: Path64, epsilon: number): Path64 { 304 | const len = path.length; 305 | if (len < 5) return path; 306 | 307 | const flags = new Array(len).fill(false); 308 | flags[0] = true; 309 | flags[len - 1] = true; 310 | Clipper.rdp(path, 0, len - 1, Clipper.sqr(epsilon), flags); 311 | 312 | const result: Path64 = []; 313 | for (let i = 0; i < len; i++) { 314 | if (flags[i]) result.push(path[i]); 315 | } 316 | return result; 317 | } 318 | 319 | public static ramerDouglasPeuckerPaths(paths: Paths64, epsilon: number): Paths64 { 320 | const result: Paths64 = []; 321 | for (const path of paths) { 322 | result.push(Clipper.ramerDouglasPeucker(path, epsilon)); 323 | } 324 | return result; 325 | } 326 | 327 | private static getNext(current: number, high: number, flags: boolean[]): number { 328 | current++; 329 | while (current <= high && flags[current]) current++; 330 | if (current <= high) return current; 331 | current = 0; 332 | while (flags[current]) current++; 333 | return current; 334 | } 335 | 336 | private static getPrior(current: number, high: number, flags: boolean[]): number { 337 | if (current === 0) current = high; 338 | else current--; 339 | while (current > 0 && flags[current]) current--; 340 | if (!flags[current]) return current; 341 | current = high; 342 | while (flags[current]) current--; 343 | return current; 344 | } 345 | 346 | private static sqr(value: number): number { 347 | return value * value; 348 | } 349 | 350 | public static simplifyPath(path: Path64, epsilon: number, isClosedPath: boolean = false): Path64 { 351 | const len = path.length; 352 | const high = len - 1; 353 | const epsSqr = this.sqr(epsilon); 354 | if (len < 4) return path; 355 | 356 | const flags: boolean[] = new Array(len).fill(false); 357 | const dsq: number[] = new Array(len).fill(0); 358 | let prev = high; 359 | let curr = 0; 360 | let start: number, next: number, prior2: number, next2: number; 361 | 362 | if (isClosedPath) { 363 | dsq[0] = this.perpendicDistFromLineSqrd(path[0], path[high], path[1]); 364 | dsq[high] = this.perpendicDistFromLineSqrd(path[high], path[0], path[high - 1]); 365 | } else { 366 | dsq[0] = Number.MAX_VALUE; 367 | dsq[high] = Number.MAX_VALUE; 368 | } 369 | 370 | for (let i = 1; i < high; i++) { 371 | dsq[i] = this.perpendicDistFromLineSqrd(path[i], path[i - 1], path[i + 1]); 372 | } 373 | 374 | for (; ;) { 375 | if (dsq[curr] > epsSqr) { 376 | start = curr; 377 | do { 378 | curr = this.getNext(curr, high, flags); 379 | } while (curr !== start && dsq[curr] > epsSqr); 380 | if (curr === start) break; 381 | } 382 | 383 | prev = this.getPrior(curr, high, flags); 384 | next = this.getNext(curr, high, flags); 385 | if (next === prev) break; 386 | 387 | if (dsq[next] < dsq[curr]) { 388 | flags[next] = true; 389 | next = this.getNext(next, high, flags); 390 | next2 = this.getNext(next, high, flags); 391 | dsq[curr] = this.perpendicDistFromLineSqrd(path[curr], path[prev], path[next]); 392 | if (next !== high || isClosedPath) { 393 | dsq[next] = this.perpendicDistFromLineSqrd(path[next], path[curr], path[next2]); 394 | } 395 | curr = next; 396 | } else { 397 | flags[curr] = true; 398 | curr = next; 399 | next = this.getNext(next, high, flags); 400 | prior2 = this.getPrior(prev, high, flags); 401 | dsq[curr] = this.perpendicDistFromLineSqrd(path[curr], path[prev], path[next]); 402 | if (prev !== 0 || isClosedPath) { 403 | dsq[prev] = this.perpendicDistFromLineSqrd(path[prev], path[prior2], path[curr]); 404 | } 405 | } 406 | } 407 | 408 | const result: Path64 = []; 409 | for (let i = 0; i < len; i++) { 410 | if (!flags[i]) result.push(path[i]); 411 | } 412 | return result; 413 | } 414 | 415 | public static simplifyPaths(paths: Paths64, epsilon: number, isClosedPaths: boolean = false): Paths64 { 416 | const result: Paths64 = []; 417 | for (const path of paths) { 418 | result.push(this.simplifyPath(path, epsilon, isClosedPaths)); 419 | } 420 | return result; 421 | } 422 | 423 | //private static getNext(current: number, high: number, flags: boolean[]): number { 424 | // current++; 425 | // while (current <= high && flags[current]) current++; 426 | // return current; 427 | //} 428 | 429 | //private static getPrior(current: number, high: number, flags: boolean[]): number { 430 | // if (current === 0) return high; 431 | // current--; 432 | // while (current > 0 && flags[current]) current--; 433 | // return current; 434 | //} 435 | 436 | 437 | public static trimCollinear(path: Path64, isOpen: boolean = false): Path64 { 438 | let len = path.length; 439 | let i = 0; 440 | 441 | if (!isOpen) { 442 | while (i < len - 1 && InternalClipper.crossProduct(path[len - 1], path[i], path[i + 1]) === 0) i++; 443 | while (i < len - 1 && InternalClipper.crossProduct(path[len - 2], path[len - 1], path[i]) === 0) len--; 444 | } 445 | 446 | if (len - i < 3) { 447 | if (!isOpen || len < 2 || path[0] === path[1]) { 448 | return []; 449 | } 450 | return path; 451 | } 452 | 453 | const result: Path64 = []; 454 | let last = path[i]; 455 | result.push(last); 456 | 457 | for (i++; i < len - 1; i++) { 458 | if (InternalClipper.crossProduct(last, path[i], path[i + 1]) === 0) continue; 459 | last = path[i]; 460 | result.push(last); 461 | } 462 | 463 | if (isOpen) { 464 | result.push(path[len - 1]); 465 | } else if (InternalClipper.crossProduct(last, path[len - 1], result[0]) !== 0) { 466 | result.push(path[len - 1]); 467 | } else { 468 | while (result.length > 2 && InternalClipper.crossProduct(result[result.length - 1], result[result.length - 2], result[0]) === 0) { 469 | result.pop(); 470 | } 471 | if (result.length < 3) result.splice(0, result.length); 472 | } 473 | 474 | return result; 475 | } 476 | 477 | public static pointInPolygon(pt: Point64, polygon: Path64): PointInPolygonResult { 478 | return InternalClipper.pointInPolygon(pt, polygon); 479 | } 480 | 481 | public static ellipse(center: IPoint64, radiusX: number, radiusY: number = 0, steps: number = 0): Path64 { 482 | if (radiusX <= 0) return []; 483 | if (radiusY <= 0) radiusY = radiusX; 484 | if (steps <= 2) steps = Math.ceil(Math.PI * Math.sqrt((radiusX + radiusY) / 2)); 485 | 486 | const si = Math.sin(2 * Math.PI / steps); 487 | const co = Math.cos(2 * Math.PI / steps); 488 | let dx = co, dy = si; 489 | const result: Path64 = [{ x: center.x + radiusX, y: center.y }]; 490 | for (let i = 1; i < steps; ++i) { 491 | result.push({ x: center.x + radiusX * dx, y: center.y + radiusY * dy }); 492 | const x = dx * co - dy * si; 493 | dy = dy * co + dx * si; 494 | dx = x; 495 | } 496 | return result; 497 | } 498 | 499 | private static showPolyPathStructure(pp: PolyPathBase, level: number): void { 500 | const spaces = ' '.repeat(level * 2); 501 | const caption = pp.isHole ? "Hole " : "Outer "; 502 | if (pp.count === 0) { 503 | console.log(spaces + caption); 504 | } else { 505 | console.log(spaces + caption + `(${pp.count})`); 506 | pp.forEach(child => this.showPolyPathStructure(child, level + 1)); 507 | } 508 | } 509 | 510 | public static showPolyTreeStructure(polytree: PolyTree64): void { 511 | console.log("Polytree Root"); 512 | polytree.forEach(child => this.showPolyPathStructure(child, 1)); 513 | } 514 | 515 | } 516 | -------------------------------------------------------------------------------- /projects/clipper2-js/src/lib/core.ts: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Author : Angus Johnson * 3 | * Date : 19 September 2023 * 4 | * Website : http://www.angusj.com * 5 | * Copyright : Angus Johnson 2010-2023 * 6 | * Purpose : Core structures and functions for the Clipper Library * 7 | * License : http://www.boost.org/LICENSE_1_0.txt * 8 | *******************************************************************************/ 9 | 10 | import { PointInPolygonResult } from "./engine"; 11 | 12 | // 13 | // Converted from C# implemention https://github.com/AngusJohnson/Clipper2/blob/main/CSharp/Clipper2Lib/Clipper.Core.cs 14 | // Removed support for USINGZ 15 | // 16 | // Converted by ChatGPT 4 August 3 version https://help.openai.com/en/articles/6825453-chatgpt-release-notes 17 | // 18 | 19 | // Note: all clipping operations except for Difference are commutative. 20 | export enum ClipType { 21 | None, 22 | Intersection, 23 | Union, 24 | Difference, 25 | Xor 26 | } 27 | 28 | export enum PathType { 29 | Subject, 30 | Clip 31 | } 32 | 33 | // By far the most widely used filling rules for polygons are EvenOdd 34 | // and NonZero, sometimes called Alternate and Winding respectively. 35 | // https://en.wikipedia.org/wiki/Nonzero-rule 36 | export enum FillRule { 37 | EvenOdd, 38 | NonZero, 39 | Positive, 40 | Negative 41 | } 42 | 43 | // PointInPolygon 44 | export enum PipResult { 45 | Inside, 46 | Outside, 47 | OnEdge 48 | } 49 | 50 | export interface IPoint64 { 51 | x: number; 52 | y: number; 53 | } 54 | 55 | export class Path64 extends Array { } 56 | 57 | export class Paths64 extends Array { } 58 | 59 | 60 | 61 | export class Rect64 { 62 | public left: number; 63 | public top: number; 64 | public right: number; 65 | public bottom: number; 66 | 67 | constructor(lOrIsValidOrRec?: number | boolean | Rect64, t?: number, r?: number, b?: number) { 68 | if (typeof lOrIsValidOrRec === 'boolean') { 69 | if (lOrIsValidOrRec) { 70 | this.left = 0; 71 | this.top = 0; 72 | this.right = 0; 73 | this.bottom = 0; 74 | } else { 75 | this.left = Number.MAX_SAFE_INTEGER; 76 | this.top = Number.MAX_SAFE_INTEGER; 77 | this.right = Number.MIN_SAFE_INTEGER; 78 | this.bottom = Number.MIN_SAFE_INTEGER; 79 | } 80 | } else if (typeof lOrIsValidOrRec === 'number') { 81 | this.left = lOrIsValidOrRec; 82 | this.top = t as number; 83 | this.right = r as number; 84 | this.bottom = b as number; 85 | } else { 86 | this.left = lOrIsValidOrRec!.left; 87 | this.top = lOrIsValidOrRec!.top; 88 | this.right = lOrIsValidOrRec!.right; 89 | this.bottom = lOrIsValidOrRec!.bottom; 90 | } 91 | } 92 | 93 | public get width(): number { 94 | return this.right - this.left; 95 | } 96 | 97 | public set width(value: number) { 98 | this.right = this.left + value; 99 | } 100 | 101 | public get height(): number { 102 | return this.bottom - this.top; 103 | } 104 | 105 | public set height(value: number) { 106 | this.bottom = this.top + value; 107 | } 108 | 109 | public isEmpty(): boolean { 110 | return this.bottom <= this.top || this.right <= this.left; 111 | } 112 | 113 | public midPoint(): Point64 { 114 | return new Point64((this.left + this.right) / 2, (this.top + this.bottom) / 2); 115 | } 116 | 117 | public contains(pt: IPoint64): boolean { 118 | return pt.x > this.left && pt.x < this.right && pt.y > this.top && pt.y < this.bottom; 119 | } 120 | 121 | public containsRect(rec: Rect64): boolean { 122 | return rec.left >= this.left && rec.right <= this.right && rec.top >= this.top && rec.bottom <= this.bottom; 123 | } 124 | 125 | public intersects(rec: Rect64): boolean { 126 | return (Math.max(this.left, rec.left) <= Math.min(this.right, rec.right)) && 127 | (Math.max(this.top, rec.top) <= Math.min(this.bottom, rec.bottom)); 128 | } 129 | 130 | public asPath(): Path64 { 131 | const result = new Path64(); 132 | result.push(new Point64(this.left, this.top)); 133 | result.push(new Point64(this.right, this.top)); 134 | result.push(new Point64(this.right, this.bottom)); 135 | result.push(new Point64(this.left, this.bottom)); 136 | return result; 137 | } 138 | } 139 | 140 | export enum MidpointRounding { 141 | ToEven, 142 | AwayFromZero 143 | } 144 | 145 | export function midPointRound(value: number, mode: MidpointRounding = MidpointRounding.ToEven): number { 146 | const factor = Math.pow(10, 0); 147 | value *= factor; 148 | 149 | let rounded: number; 150 | if (mode === MidpointRounding.AwayFromZero) { 151 | rounded = (value > 0) ? Math.floor(value + 0.5) : Math.ceil(value - 0.5); 152 | } else { 153 | // For MidpointRounding.ToEven, use the default JavaScript rounding 154 | rounded = Math.round(value); 155 | } 156 | 157 | return rounded / factor; 158 | } 159 | 160 | 161 | export class Point64 implements IPoint64 { 162 | public x: number; 163 | public y: number; 164 | 165 | constructor(xOrPt?: number | Point64, yOrScale?: number) { 166 | if (typeof xOrPt === 'number' && typeof yOrScale === 'number') { 167 | this.x = midPointRound(xOrPt,MidpointRounding.AwayFromZero); 168 | this.y = midPointRound(yOrScale, MidpointRounding.AwayFromZero); 169 | } else { 170 | const pt = xOrPt as Point64 171 | if (yOrScale !== undefined) { 172 | this.x = midPointRound(pt.x * yOrScale, MidpointRounding.AwayFromZero); 173 | this.y = midPointRound(pt.y * yOrScale, MidpointRounding.AwayFromZero); 174 | } else { 175 | this.x = pt.x; 176 | this.y = pt.y; 177 | } 178 | } 179 | } 180 | 181 | public static equals(lhs: Point64, rhs: Point64): boolean { 182 | return lhs.x === rhs.x && lhs.y === rhs.y; 183 | } 184 | 185 | public static notEquals(lhs: Point64, rhs: Point64): boolean { 186 | return lhs.x !== rhs.x || lhs.y !== rhs.y; 187 | } 188 | 189 | public static add(lhs: Point64, rhs: Point64): Point64 { 190 | return new Point64(lhs.x + rhs.x, lhs.y + rhs.y); 191 | } 192 | 193 | public static subtract(lhs: Point64, rhs: Point64): Point64 { 194 | return new Point64(lhs.x - rhs.x, lhs.y - rhs.y); 195 | } 196 | 197 | public toString(): string { 198 | return `${this.x},${this.y} `; 199 | } 200 | 201 | public equals(obj: Point64): boolean { 202 | if (obj instanceof Point64) { 203 | return Point64.equals(this, obj); 204 | } 205 | return false; 206 | } 207 | 208 | // public getHashCode(): number { 209 | // return this.X ^ this.Y; // Simple XOR-based hash combination. Adjust if needed. 210 | // } 211 | } 212 | 213 | export class InternalClipper { 214 | static readonly MaxInt64: number = 9223372036854775807; 215 | static readonly MaxCoord: number = InternalClipper.MaxInt64 / 4; 216 | static readonly max_coord: number = InternalClipper.MaxCoord; 217 | static readonly min_coord: number = -InternalClipper.MaxCoord; 218 | static readonly Invalid64: number = InternalClipper.MaxInt64; 219 | 220 | static readonly defaultArcTolerance: number = 0.25; 221 | static readonly floatingPointTolerance: number = 1E-12; 222 | static readonly defaultMinimumEdgeLength: number = 0.1; 223 | 224 | private static readonly precision_range_error: string = "Error: Precision is out of range."; 225 | 226 | static checkPrecision(precision: number): void { 227 | if (precision < -8 || precision > 8) 228 | throw new Error(this.precision_range_error); 229 | } 230 | 231 | static isAlmostZero(value: number): boolean { 232 | return (Math.abs(value) <= this.floatingPointTolerance); 233 | } 234 | 235 | static crossProduct(pt1: IPoint64, pt2: IPoint64, pt3: IPoint64): number { 236 | return ((pt2.x - pt1.x) * (pt3.y - pt2.y) - (pt2.y - pt1.y) * (pt3.x - pt2.x)); 237 | } 238 | 239 | static dotProduct(pt1: IPoint64, pt2: IPoint64, pt3: IPoint64): number { 240 | return ((pt2.x - pt1.x) * (pt3.x - pt2.x) + (pt2.y - pt1.y) * (pt3.y - pt2.y)); 241 | } 242 | 243 | static checkCastInt64(val: number): number { 244 | if ((val >= this.max_coord) || (val <= this.min_coord)) return this.Invalid64; 245 | return midPointRound(val, MidpointRounding.AwayFromZero); 246 | } 247 | 248 | 249 | public static getIntersectPoint(ln1a: IPoint64, ln1b: IPoint64, ln2a: IPoint64, ln2b: IPoint64): { ip: IPoint64, success: boolean } { 250 | const dy1 = ln1b.y - ln1a.y; 251 | const dx1 = ln1b.x - ln1a.x; 252 | const dy2 = ln2b.y - ln2a.y; 253 | const dx2 = ln2b.x - ln2a.x; 254 | const det = dy1 * dx2 - dy2 * dx1; 255 | 256 | let ip: IPoint64; 257 | 258 | if (det === 0.0) { 259 | ip = new Point64(0, 0); 260 | return { ip, success: false }; 261 | } 262 | 263 | const t = ((ln1a.x - ln2a.x) * dy2 - (ln1a.y - ln2a.y) * dx2) / det; 264 | if (t <= 0.0) ip = ln1a; 265 | else if (t >= 1.0) ip = ln1b; 266 | // NB: truncate the result instead of rounding it, to make the C# version work similarly to the C++ and Delphi versions 267 | else ip = new Point64(Math.trunc(ln1a.x + t * dx1), Math.trunc(ln1a.y + t * dy1)); 268 | return { ip, success: true }; 269 | } 270 | 271 | 272 | public static segsIntersect(seg1a: IPoint64, seg1b: IPoint64, seg2a: IPoint64, seg2b: IPoint64, inclusive: boolean = false): boolean { 273 | if (inclusive) { 274 | const res1 = InternalClipper.crossProduct(seg1a, seg2a, seg2b); 275 | const res2 = InternalClipper.crossProduct(seg1b, seg2a, seg2b); 276 | if (res1 * res2 > 0) return false; 277 | const res3 = InternalClipper.crossProduct(seg2a, seg1a, seg1b); 278 | const res4 = InternalClipper.crossProduct(seg2b, seg1a, seg1b); 279 | if (res3 * res4 > 0) return false; 280 | return (res1 !== 0 || res2 !== 0 || res3 !== 0 || res4 !== 0); 281 | } else { 282 | return (InternalClipper.crossProduct(seg1a, seg2a, seg2b) * InternalClipper.crossProduct(seg1b, seg2a, seg2b) < 0) && 283 | (InternalClipper.crossProduct(seg2a, seg1a, seg1b) * InternalClipper.crossProduct(seg2b, seg1a, seg1b) < 0); 284 | } 285 | } 286 | 287 | public static getClosestPtOnSegment(offPt: IPoint64, seg1: IPoint64, seg2: IPoint64): IPoint64 { 288 | if (seg1.x === seg2.x && seg1.y === seg2.y) return seg1; 289 | const dx = seg2.x - seg1.x; 290 | const dy = seg2.y - seg1.y; 291 | let q = ((offPt.x - seg1.x) * dx + (offPt.y - seg1.y) * dy) / ((dx * dx) + (dy * dy)); 292 | if (q < 0) q = 0; else if (q > 1) q = 1; 293 | // use MidpointRounding.ToEven in order to explicitly match the nearbyint behaviour on the C++ side 294 | return new Point64( 295 | seg1.x + midPointRound(q * dx, MidpointRounding.ToEven), 296 | seg1.y + midPointRound(q * dy, MidpointRounding.ToEven) 297 | ); 298 | } 299 | 300 | public static pointInPolygon(pt: IPoint64, polygon: Path64): PointInPolygonResult { 301 | const len = polygon.length; 302 | let start = 0; 303 | 304 | if (len < 3) return PointInPolygonResult.IsOutside; 305 | 306 | while (start < len && polygon[start].y === pt.y) start++; 307 | if (start === len) return PointInPolygonResult.IsOutside; 308 | 309 | let d: number = 0; 310 | let isAbove = polygon[start].y < pt.y; 311 | const startingAbove = isAbove; 312 | let val = 0; 313 | let i = start + 1; 314 | let end = len; 315 | 316 | for (; ;) { 317 | if (i === end) { 318 | if (end === 0 || start === 0) break; 319 | end = start; 320 | i = 0; 321 | } 322 | 323 | if (isAbove) { 324 | while (i < end && polygon[i].y < pt.y) i++; 325 | if (i === end) continue; 326 | } else { 327 | while (i < end && polygon[i].y > pt.y) i++; 328 | if (i === end) continue; 329 | } 330 | 331 | const curr = polygon[i]; 332 | const prev = i > 0 ? polygon[i - 1] : polygon[len - 1]; 333 | 334 | if (curr.y === pt.y) { 335 | if (curr.x === pt.x || (curr.y === prev.y && (pt.x < prev.x !== pt.x < curr.x))) return PointInPolygonResult.IsOn; 336 | i++; 337 | if (i === start) break; 338 | continue; 339 | } 340 | 341 | if (pt.x < curr.x && pt.x < prev.x) { 342 | // we're only interested in edges crossing on the left 343 | } else if (pt.x > prev.x && pt.x > curr.x) { 344 | val = 1 - val; // toggle val 345 | } else { 346 | d = InternalClipper.crossProduct(prev, curr, pt); 347 | if (d === 0) return PointInPolygonResult.IsOn; 348 | if ((d < 0) === isAbove) val = 1 - val; 349 | } 350 | isAbove = !isAbove; 351 | i++; 352 | } 353 | 354 | if (isAbove !== startingAbove) { 355 | if (i === len) i = 0; 356 | else d = InternalClipper.crossProduct(polygon[i - 1], polygon[i], pt); 357 | if (d === 0) return PointInPolygonResult.IsOn; 358 | if ((d < 0) === isAbove) val = 1 - val; 359 | } 360 | 361 | if (val === 0) return PointInPolygonResult.IsOutside; 362 | return PointInPolygonResult.IsInside; 363 | } 364 | } 365 | -------------------------------------------------------------------------------- /projects/clipper2-js/src/lib/minkowski.ts: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Author : Angus Johnson * 3 | * Date : 15 October 2022 * 4 | * Website : http://www.angusj.com * 5 | * Copyright : Angus Johnson 2010-2022 * 6 | * Purpose : Minkowski Sum and Difference * 7 | * License : http://www.boost.org/LICENSE_1_0.txt * 8 | *******************************************************************************/ 9 | 10 | // 11 | // Converted from C# implemention https://github.com/AngusJohnson/Clipper2/blob/main/CSharp/Clipper2Lib/Clipper.Core.cs 12 | // Removed support for USINGZ 13 | // 14 | // Converted by ChatGPT 4 August 3 version https://help.openai.com/en/articles/6825453-chatgpt-release-notes 15 | // 16 | 17 | import { Clipper } from "./clipper"; 18 | import { FillRule, IPoint64, Path64, Paths64 } from "./core"; 19 | 20 | 21 | export class Minkowski { 22 | private static minkowskiInternal(pattern: Path64, path: Path64, isSum: boolean, isClosed: boolean): Paths64 { 23 | const delta = isClosed ? 0 : 1; 24 | const patLen = pattern.length; 25 | const pathLen = path.length; 26 | const tmp: Array> = [] 27 | 28 | for (const pathPt of path) { 29 | const path2: Array = [] 30 | if (isSum) { 31 | for (const basePt of pattern) 32 | path2.push({ x: pathPt.x + basePt.x, y: pathPt.y + basePt.y }); 33 | } else { 34 | for (const basePt of pattern) 35 | path2.push({ x: pathPt.x - basePt.x, y: pathPt.y - basePt.y }); 36 | } 37 | tmp.push(path2); 38 | } 39 | 40 | const result: Array> = [] 41 | let g = isClosed ? pathLen - 1 : 0; 42 | 43 | let h = patLen - 1; 44 | for (let i = delta; i < pathLen; i++) { 45 | for (let j = 0; j < patLen; j++) { 46 | const quad: Path64 = [tmp[g][h], tmp[i][h], tmp[i][j], tmp[g][j]]; 47 | if (!Clipper.isPositive(quad)) 48 | result.push(Clipper.reversePath(quad)); 49 | else 50 | result.push(quad); 51 | h = j; 52 | } 53 | g = i; 54 | } 55 | return result; 56 | } 57 | 58 | public static sum(pattern: Path64, path: Path64, isClosed: boolean): Paths64 { 59 | return Clipper.Union(this.minkowskiInternal(pattern, path, true, isClosed), undefined, FillRule.NonZero); 60 | } 61 | 62 | public static diff(pattern: Path64, path: Path64, isClosed: boolean): Paths64 { 63 | return Clipper.Union(this.minkowskiInternal(pattern, path, false, isClosed), undefined, FillRule.NonZero); 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /projects/clipper2-js/src/lib/offset.ts: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Author : Angus Johnson * 3 | * Date : 24 September 2023 * 4 | * Website : http://www.angusj.com * 5 | * Copyright : Angus Johnson 2010-2023 * 6 | * Purpose : Path Offset (Inflate/Shrink) * 7 | * License : http://www.boost.org/LICENSE_1_0.txt * 8 | *******************************************************************************/ 9 | 10 | // 11 | // Converted from C# implemention https://github.com/AngusJohnson/Clipper2/blob/main/CSharp/Clipper2Lib/Clipper.Core.cs 12 | // Removed support for USINGZ 13 | // 14 | // Converted by ChatGPT 4 August 3 version https://help.openai.com/en/articles/6825453-chatgpt-release-notes 15 | // 16 | 17 | import { Clipper } from "./clipper"; 18 | import { ClipType, FillRule, IPoint64, InternalClipper, Path64, Paths64, Point64, Rect64 } from "./core"; 19 | import { Clipper64, PolyTree64 } from "./engine"; 20 | 21 | export enum JoinType { 22 | Miter, 23 | Square, 24 | Bevel, 25 | Round 26 | } 27 | 28 | export enum EndType { 29 | Polygon, 30 | Joined, 31 | Butt, 32 | Square, 33 | Round 34 | } 35 | 36 | class Group { 37 | inPaths: Paths64; 38 | outPath: Path64; 39 | outPaths: Paths64; 40 | joinType: JoinType; 41 | endType: EndType; 42 | pathsReversed: boolean; 43 | 44 | constructor(paths: Paths64, joinType: JoinType, endType: EndType = EndType.Polygon) { 45 | this.inPaths = [...paths]; // creates a shallow copy of paths 46 | this.joinType = joinType; 47 | this.endType = endType; 48 | this.outPath = []; 49 | this.outPaths = []; 50 | this.pathsReversed = false; 51 | } 52 | } 53 | 54 | export class PointD implements IPoint64 { 55 | public x: number; 56 | public y: number; 57 | 58 | constructor(xOrPt: number | PointD | Point64, yOrScale?: number) { 59 | if (typeof xOrPt === 'number' && typeof yOrScale === 'number') { 60 | this.x = xOrPt; 61 | this.y = yOrScale; 62 | } else if (xOrPt instanceof PointD) { 63 | if (yOrScale !== undefined) { 64 | this.x = xOrPt.x * yOrScale; 65 | this.y = xOrPt.y * yOrScale; 66 | } else { 67 | this.x = xOrPt.x; 68 | this.y = xOrPt.y; 69 | } 70 | } else { 71 | this.x = (xOrPt).x * (yOrScale || 1); 72 | this.y = (xOrPt).y * (yOrScale || 1); 73 | } 74 | } 75 | 76 | public toString(precision: number = 2): string { 77 | return `${this.x.toFixed(precision)},${this.y.toFixed(precision)}`; 78 | } 79 | 80 | public static equals(lhs: PointD, rhs: PointD): boolean { 81 | return InternalClipper.isAlmostZero(lhs.x - rhs.x) && 82 | InternalClipper.isAlmostZero(lhs.y - rhs.y); 83 | } 84 | 85 | public static notEquals(lhs: PointD, rhs: PointD): boolean { 86 | return !InternalClipper.isAlmostZero(lhs.x - rhs.x) || 87 | !InternalClipper.isAlmostZero(lhs.y - rhs.y); 88 | } 89 | 90 | public equals(obj: PointD): boolean { 91 | if (obj instanceof PointD) { 92 | return PointD.equals(this, obj); 93 | } 94 | return false; 95 | } 96 | 97 | public negate(): void { 98 | this.x = -this.x; 99 | this.y = -this.y; 100 | } 101 | 102 | // public getHashCode(): number { 103 | // return this.x ^ this.y; // XOR-based hash combination. Adjust if needed. 104 | // } 105 | } 106 | 107 | export class ClipperOffset { 108 | 109 | private static Tolerance: number = 1.0E-12; 110 | private _groupList: Array = []; 111 | private _normals: Array = []; 112 | private _solution: Paths64 = []; 113 | private _groupDelta!: number; //*0.5 for open paths; *-1.0 for negative areas 114 | private _delta!: number; 115 | private _mitLimSqr!: number; 116 | private _stepsPerRad!: number; 117 | private _stepSin!: number; 118 | private _stepCos!: number; 119 | private _joinType!: JoinType; 120 | private _endType!: EndType; 121 | public ArcTolerance: number; 122 | public MergeGroups: boolean; 123 | public MiterLimit: number; 124 | public PreserveCollinear: boolean; 125 | public ReverseSolution: boolean; 126 | 127 | public DeltaCallback?: (path: IPoint64[], path_norms: PointD[], currPt: number, prevPt: number) => number; 128 | 129 | constructor(miterLimit: number = 2.0, arcTolerance: number = 0.0, 130 | preserveCollinear: boolean = false, reverseSolution: boolean = false) { 131 | this.MiterLimit = miterLimit; 132 | this.ArcTolerance = arcTolerance; 133 | this.MergeGroups = true; 134 | this.PreserveCollinear = preserveCollinear; 135 | this.ReverseSolution = reverseSolution; 136 | } 137 | 138 | public clear(): void { 139 | this._groupList = []; 140 | } 141 | 142 | public addPath(path: Point64[], joinType: JoinType, endType: EndType): void { 143 | if (path.length === 0) return; 144 | const pp: Point64[][] = [path]; 145 | this.addPaths(pp, joinType, endType); 146 | } 147 | 148 | public addPaths(paths: Paths64, joinType: JoinType, endType: EndType): void { 149 | if (paths.length === 0) return; 150 | this._groupList.push(new Group(paths, joinType, endType)); 151 | } 152 | 153 | private executeInternal(delta: number): void { 154 | this._solution = []; 155 | if (this._groupList.length === 0) return; 156 | 157 | if (Math.abs(delta) < 0.5) { 158 | for (const group of this._groupList) { 159 | for (const path of group.inPaths) { 160 | this._solution.push(path); 161 | } 162 | } 163 | } else { 164 | this._delta = delta; 165 | this._mitLimSqr = (this.MiterLimit <= 1 ? 2.0 : 2.0 / this.sqr(this.MiterLimit)); 166 | for (const group of this._groupList) { 167 | this.doGroupOffset(group); 168 | } 169 | } 170 | } 171 | 172 | private sqr(value: number): number { 173 | return value * value; 174 | } 175 | 176 | 177 | public execute(delta: number, solution: Paths64): void { 178 | solution.length = 0; 179 | this.executeInternal(delta); 180 | if (this._groupList.length === 0) return; 181 | 182 | // clean up self-intersections ... 183 | const c = new Clipper64() 184 | c.preserveCollinear = this.PreserveCollinear 185 | // the solution should retain the orientation of the input 186 | c.reverseSolution = this.ReverseSolution !== this._groupList[0].pathsReversed 187 | 188 | c.addSubjectPaths(this._solution); 189 | if (this._groupList[0].pathsReversed) 190 | c.execute(ClipType.Union, FillRule.Negative, solution); 191 | else 192 | c.execute(ClipType.Union, FillRule.Positive, solution); 193 | } 194 | 195 | public executePolytree(delta: number, polytree: PolyTree64): void { 196 | polytree.clear(); 197 | this.executeInternal(delta); 198 | if (this._groupList.length === 0) return; 199 | 200 | // clean up self-intersections ... 201 | const c = new Clipper64() 202 | c.preserveCollinear = this.PreserveCollinear 203 | // the solution should retain the orientation of the input 204 | c.reverseSolution = this.ReverseSolution !== this._groupList[0].pathsReversed 205 | 206 | c.addSubjectPaths(this._solution); 207 | if (this._groupList[0].pathsReversed) 208 | c.executePolyTree(ClipType.Union, FillRule.Negative, polytree); 209 | else 210 | c.executePolyTree(ClipType.Union, FillRule.Positive, polytree); 211 | } 212 | 213 | protected static getUnitNormal(pt1: IPoint64, pt2: IPoint64): PointD { 214 | let dx = pt2.x - pt1.x; 215 | let dy = pt2.y - pt1.y; 216 | if (dx === 0 && dy === 0) return new PointD(0, 0); 217 | 218 | const f = 1.0 / Math.sqrt(dx * dx + dy * dy); 219 | dx *= f; 220 | dy *= f; 221 | 222 | return new PointD(dy, -dx); 223 | } 224 | 225 | public executeCallback(deltaCallback: (path: IPoint64[], path_norms: PointD[], currPt: number, prevPt: number) => number, solution: Point64[][]): void { 226 | this.DeltaCallback = deltaCallback; 227 | this.execute(1.0, solution); 228 | } 229 | 230 | private static getBoundsAndLowestPolyIdx(paths: Paths64): { index: number, rec: Rect64 } { 231 | const rec = new Rect64(false); // ie invalid rect 232 | let lpX: number = Number.MIN_SAFE_INTEGER; 233 | let index = -1; 234 | for (let i = 0; i < paths.length; i++) { 235 | for (const pt of paths[i]) { 236 | if (pt.y >= rec.bottom) { 237 | if (pt.y > rec.bottom || pt.x < lpX) { 238 | index = i; 239 | lpX = pt.x; 240 | rec.bottom = pt.y; 241 | } 242 | } else if (pt.y < rec.top) rec.top = pt.y; 243 | if (pt.x > rec.right) rec.right = pt.x; 244 | else if (pt.x < rec.left) rec.left = pt.x; 245 | } 246 | } 247 | return { index, rec } 248 | } 249 | 250 | private static translatePoint(pt: PointD, dx: number, dy: number): PointD { 251 | return new PointD(pt.x + dx, pt.y + dy); 252 | } 253 | 254 | private static reflectPoint(pt: PointD, pivot: PointD): PointD { 255 | return new PointD(pivot.x + (pivot.x - pt.x), pivot.y + (pivot.y - pt.y)); 256 | } 257 | 258 | private static almostZero(value: number, epsilon: number = 0.001): boolean { 259 | return Math.abs(value) < epsilon; 260 | } 261 | 262 | private static hypotenuse(x: number, y: number): number { 263 | return Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)); 264 | } 265 | 266 | private static normalizeVector(vec: PointD): PointD { 267 | const h = this.hypotenuse(vec.x, vec.y); 268 | if (this.almostZero(h)) return new PointD(0, 0); 269 | const inverseHypot = 1 / h; 270 | return new PointD(vec.x * inverseHypot, vec.y * inverseHypot); 271 | } 272 | 273 | private static getAvgUnitVector(vec1: PointD, vec2: PointD): PointD { 274 | return this.normalizeVector(new PointD(vec1.x + vec2.x, vec1.y + vec2.y)); 275 | } 276 | 277 | private static intersectPoint(pt1a: PointD, pt1b: PointD, pt2a: PointD, pt2b: PointD): PointD { 278 | if (InternalClipper.isAlmostZero(pt1a.x - pt1b.x)) { //vertical 279 | if (InternalClipper.isAlmostZero(pt2a.x - pt2b.x)) return new PointD(0, 0); 280 | const m2 = (pt2b.y - pt2a.y) / (pt2b.x - pt2a.x); 281 | const b2 = pt2a.y - m2 * pt2a.x; 282 | return new PointD(pt1a.x, m2 * pt1a.x + b2); 283 | } 284 | 285 | if (InternalClipper.isAlmostZero(pt2a.x - pt2b.x)) { //vertical 286 | const m1 = (pt1b.y - pt1a.y) / (pt1b.x - pt1a.x); 287 | const b1 = pt1a.y - m1 * pt1a.x; 288 | return new PointD(pt2a.x, m1 * pt2a.x + b1); 289 | } else { 290 | const m1 = (pt1b.y - pt1a.y) / (pt1b.x - pt1a.x); 291 | const b1 = pt1a.y - m1 * pt1a.x; 292 | const m2 = (pt2b.y - pt2a.y) / (pt2b.x - pt2a.x); 293 | const b2 = pt2a.y - m2 * pt2a.x; 294 | if (InternalClipper.isAlmostZero(m1 - m2)) return new PointD(0, 0); 295 | const x = (b2 - b1) / (m1 - m2); 296 | return new PointD(x, m1 * x + b1); 297 | } 298 | } 299 | 300 | private getPerpendic(pt: IPoint64, norm: PointD): Point64 { 301 | return new Point64(pt.x + norm.x * this._groupDelta, pt.y + norm.y * this._groupDelta); 302 | } 303 | 304 | private getPerpendicD(pt: IPoint64, norm: PointD): PointD { 305 | return new PointD(pt.x + norm.x * this._groupDelta, pt.y + norm.y * this._groupDelta); 306 | } 307 | 308 | private doBevel(group: Group, path: Path64, j: number, k: number) { 309 | let pt1: IPoint64, pt2: IPoint64 310 | if (j == k) { 311 | const absDelta = Math.abs(this._groupDelta); 312 | pt1 = new Point64(path[j].x - absDelta * this._normals[j].x, path[j].y - absDelta * this._normals[j].y); 313 | pt2 = new Point64(path[j].x + absDelta * this._normals[j].x, path[j].y + absDelta * this._normals[j].y); 314 | } 315 | else { 316 | pt1 = new Point64(path[j].x + this._groupDelta * this._normals[k].x, path[j].y + this._groupDelta * this._normals[k].y); 317 | pt2 = new Point64(path[j].x + this._groupDelta * this._normals[j].x, path[j].y + this._groupDelta * this._normals[j].y); 318 | } 319 | group.outPath.push(pt1); 320 | group.outPath.push(pt2); 321 | } 322 | 323 | private doSquare(group: Group, path: Path64, j: number, k: number): void { 324 | let vec: PointD; 325 | if (j === k) { 326 | vec = new PointD(this._normals[j].y, -this._normals[j].x); 327 | } else { 328 | vec = ClipperOffset.getAvgUnitVector( 329 | new PointD(-this._normals[k].y, this._normals[k].x), 330 | new PointD(this._normals[j].y, -this._normals[j].x) 331 | ); 332 | } 333 | 334 | const absDelta = Math.abs(this._groupDelta); 335 | // now offset the original vertex delta units along unit vector 336 | let ptQ = new PointD(path[j].x, path[j].y); 337 | ptQ = ClipperOffset.translatePoint(ptQ, absDelta * vec.x, absDelta * vec.y); 338 | 339 | // get perpendicular vertices 340 | const pt1 = ClipperOffset.translatePoint(ptQ, this._groupDelta * vec.y, this._groupDelta * -vec.x); 341 | const pt2 = ClipperOffset.translatePoint(ptQ, this._groupDelta * -vec.y, this._groupDelta * vec.x); 342 | // get 2 vertices along one edge offset 343 | const pt3 = this.getPerpendicD(path[k], this._normals[k]); 344 | 345 | if (j === k) { 346 | const pt4 = new PointD(pt3.x + vec.x * this._groupDelta, pt3.y + vec.y * this._groupDelta); 347 | const pt = ClipperOffset.intersectPoint(pt1, pt2, pt3, pt4); 348 | //get the second intersect point through reflection 349 | group.outPath.push(new Point64(ClipperOffset.reflectPoint(pt, ptQ).x, ClipperOffset.reflectPoint(pt, ptQ).y)); 350 | group.outPath.push(new Point64(pt.x, pt.y)); 351 | } else { 352 | const pt4 = this.getPerpendicD(path[j], this._normals[k]); 353 | const pt = ClipperOffset.intersectPoint(pt1, pt2, pt3, pt4); 354 | group.outPath.push(new Point64(pt.x, pt.y)); 355 | //get the second intersect point through reflection 356 | group.outPath.push(new Point64(ClipperOffset.reflectPoint(pt, ptQ).x, ClipperOffset.reflectPoint(pt, ptQ).y)); 357 | } 358 | } 359 | 360 | private doMiter(group: Group, path: Path64, j: number, k: number, cosA: number): void { 361 | const q = this._groupDelta / (cosA + 1); 362 | group.outPath.push(new Point64( 363 | path[j].x + (this._normals[k].x + this._normals[j].x) * q, 364 | path[j].y + (this._normals[k].y + this._normals[j].y) * q 365 | )); 366 | } 367 | 368 | private doRound(group: Group, path: Path64, j: number, k: number, angle: number): void { 369 | if (typeof this.DeltaCallback !== "undefined") { 370 | const absDelta = Math.abs(this._groupDelta); 371 | const arcTol = this.ArcTolerance > 0.01 372 | ? this.ArcTolerance 373 | : Math.log10(2 + absDelta) * InternalClipper.defaultArcTolerance; 374 | const stepsPer360 = Math.PI / Math.acos(1 - arcTol / absDelta); 375 | this._stepSin = Math.sin((2 * Math.PI) / stepsPer360); 376 | this._stepCos = Math.cos((2 * Math.PI) / stepsPer360); 377 | if (this._groupDelta < 0.0) this._stepSin = -this._stepSin; 378 | this._stepsPerRad = stepsPer360 / (2 * Math.PI); 379 | } 380 | 381 | const pt = path[j]; 382 | let offsetVec = new PointD(this._normals[k].x * this._groupDelta, this._normals[k].y * this._groupDelta); 383 | if (j === k) offsetVec.negate(); 384 | group.outPath.push(new Point64(pt.x + offsetVec.x, pt.y + offsetVec.y)); 385 | 386 | const steps = Math.ceil(this._stepsPerRad * Math.abs(angle)); 387 | for (let i = 1; i < steps; i++) { 388 | offsetVec = new PointD( 389 | offsetVec.x * this._stepCos - this._stepSin * offsetVec.y, 390 | offsetVec.x * this._stepSin + offsetVec.y * this._stepCos 391 | ); 392 | group.outPath.push(new Point64(pt.x + offsetVec.x, pt.y + offsetVec.y)); 393 | } 394 | group.outPath.push(this.getPerpendic(pt, this._normals[j])); 395 | } 396 | 397 | private buildNormals(path: Path64): void { 398 | const cnt = path.length; 399 | this._normals = []; 400 | this._normals.length = cnt; 401 | 402 | for (let i = 0; i < cnt - 1; i++) { 403 | this._normals[i] = ClipperOffset.getUnitNormal(path[i], path[i + 1]); 404 | } 405 | this._normals[cnt - 1] = ClipperOffset.getUnitNormal(path[cnt - 1], path[0]); 406 | } 407 | 408 | crossProduct(vec1: PointD, vec2: PointD): number { 409 | return (vec1.y * vec2.x - vec2.y * vec1.x); 410 | } 411 | 412 | dotProduct(vec1: PointD, vec2: PointD): number { 413 | return (vec1.x * vec2.x + vec1.y * vec2.y); 414 | } 415 | 416 | private offsetPoint(group: Group, path: Path64, j: number, k: number): void { 417 | const sinA = this.crossProduct(this._normals[j], this._normals[k]); 418 | let cosA = this.dotProduct(this._normals[j], this._normals[k]); 419 | if (sinA > 1.0) cosA = 1.0; 420 | else if (sinA < -1.0) cosA = -1.0; 421 | 422 | if (typeof this.DeltaCallback !== "undefined") { 423 | this._groupDelta = this.DeltaCallback(path, this._normals, j, k); 424 | if (group.pathsReversed) this._groupDelta = -this._groupDelta; 425 | } 426 | 427 | if (Math.abs(this._groupDelta) < ClipperOffset.Tolerance) { 428 | group.outPath.push(path[j]); 429 | return; 430 | } 431 | 432 | if (cosA > -0.99 && (sinA * this._groupDelta < 0)) { // test for concavity first (#593) 433 | // is concave 434 | group.outPath.push(this.getPerpendic(path[j], this._normals[k])); 435 | // this extra point is the only (simple) way to ensure that 436 | // path reversals are fully cleaned with the trailing clipper 437 | group.outPath.push(path[j]); 438 | group.outPath.push(this.getPerpendic(path[j], this._normals[j])); 439 | } else if (cosA > 0.999) { 440 | this.doMiter(group, path, j, k, cosA); 441 | } else if (this._joinType === JoinType.Miter) { 442 | // miter unless the angle is so acute the miter would exceeds ML 443 | if (cosA > this._mitLimSqr - 1) { 444 | this.doMiter(group, path, j, k, cosA); 445 | } else { 446 | this.doSquare(group, path, j, k); 447 | } 448 | } else if (cosA > 0.99 || this._joinType == JoinType.Bevel) 449 | //angle less than 8 degrees or a squared join 450 | this.doBevel(group, path, j, k); 451 | else if (this._joinType == JoinType.Round) 452 | this.doRound(group, path, j, k, Math.atan2(sinA, cosA)); 453 | else 454 | this.doSquare(group, path, j, k); 455 | 456 | k = j; 457 | } 458 | 459 | private offsetPolygon(group: Group, path: Path64): void { 460 | const area = Clipper.area(path); 461 | if ((area < 0) !== (this._groupDelta < 0)) { 462 | const rect = Clipper.getBounds(path); 463 | const offsetMinDim = Math.abs(this._groupDelta) * 2; 464 | if (offsetMinDim > rect.width || offsetMinDim > rect.height) return; 465 | } 466 | 467 | group.outPath = []; 468 | const cnt = path.length; 469 | const prev = cnt - 1; 470 | for (let i = 0; i < cnt; i++) { 471 | this.offsetPoint(group, path, i, prev); 472 | } 473 | group.outPaths.push(group.outPath); 474 | } 475 | 476 | private offsetOpenJoined(group: Group, path: Path64): void { 477 | this.offsetPolygon(group, path); 478 | path = Clipper.reversePath(path); 479 | this.buildNormals(path); 480 | this.offsetPolygon(group, path); 481 | } 482 | 483 | private offsetOpenPath(group: Group, path: Path64): void { 484 | group.outPath = []; 485 | const highI = path.length - 1; 486 | 487 | if (typeof this.DeltaCallback !== "undefined") { 488 | this._groupDelta = this.DeltaCallback(path, this._normals, 0, 0); 489 | } 490 | 491 | if (Math.abs(this._groupDelta) < ClipperOffset.Tolerance) { 492 | group.outPath.push(path[0]); 493 | } else { 494 | switch (this._endType) { 495 | case EndType.Butt: 496 | this.doBevel(group, path, 0, 0); 497 | break; 498 | case EndType.Round: 499 | this.doRound(group, path, 0, 0, Math.PI); 500 | break; 501 | default: 502 | this.doSquare(group, path, 0, 0); 503 | break; 504 | } 505 | } 506 | 507 | for (let i = 1, k = 0; i < highI; i++) { 508 | this.offsetPoint(group, path, i, k); 509 | } 510 | 511 | for (let i = highI; i > 0; i--) { 512 | this._normals[i] = new PointD(-this._normals[i - 1].x, -this._normals[i - 1].y); 513 | } 514 | this._normals[0] = this._normals[highI]; 515 | 516 | if (typeof this.DeltaCallback !== "undefined") { 517 | this._groupDelta = this.DeltaCallback(path, this._normals, highI, highI); 518 | } 519 | 520 | if (Math.abs(this._groupDelta) < ClipperOffset.Tolerance) { 521 | group.outPath.push(path[highI]); 522 | } else { 523 | switch (this._endType) { 524 | case EndType.Butt: 525 | this.doBevel(group, path, highI, highI); 526 | break; 527 | case EndType.Round: 528 | this.doRound(group, path, highI, highI, Math.PI); 529 | break; 530 | default: 531 | this.doSquare(group, path, highI, highI); 532 | break; 533 | } 534 | } 535 | 536 | for (let i = highI, k = 0; i > 0; i--) { 537 | this.offsetPoint(group, path, i, k); 538 | } 539 | 540 | group.outPaths.push(group.outPath); 541 | } 542 | 543 | private doGroupOffset(group: Group): void { 544 | if (group.endType == EndType.Polygon) { 545 | 546 | const { index } = ClipperOffset.getBoundsAndLowestPolyIdx(group.inPaths); 547 | 548 | if (index < 0) return; 549 | 550 | const area = Clipper.area(group.inPaths[index]); 551 | group.pathsReversed = area < 0; 552 | 553 | if (group.pathsReversed) { 554 | this._groupDelta = -this._delta; 555 | } else { 556 | this._groupDelta = this._delta; 557 | } 558 | } else { 559 | group.pathsReversed = false; 560 | this._groupDelta = Math.abs(this._delta) * 0.5; 561 | } 562 | 563 | const absDelta = Math.abs(this._groupDelta); 564 | this._joinType = group.joinType; 565 | this._endType = group.endType; 566 | 567 | if (!this.DeltaCallback && 568 | (group.joinType == JoinType.Round || group.endType == EndType.Round)) { 569 | const arcTol = this.ArcTolerance > 0.01 570 | ? this.ArcTolerance 571 | : Math.log10(2 + absDelta) * InternalClipper.defaultArcTolerance; 572 | 573 | const stepsPer360 = Math.PI / Math.acos(1 - arcTol / absDelta); 574 | this._stepSin = Math.sin((2 * Math.PI) / stepsPer360); 575 | this._stepCos = Math.cos((2 * Math.PI) / stepsPer360); 576 | 577 | if (this._groupDelta < 0.0) { 578 | this._stepSin = -this._stepSin; 579 | } 580 | 581 | this._stepsPerRad = stepsPer360 / (2 * Math.PI); 582 | } 583 | 584 | const isJoined = group.endType == EndType.Joined || group.endType == EndType.Polygon; 585 | 586 | for (const p of group.inPaths) { 587 | const path = Clipper.stripDuplicates(p, isJoined); 588 | const cnt = path.length; 589 | 590 | if (cnt === 0 || (cnt < 3 && this._endType == EndType.Polygon)) { 591 | continue; 592 | } 593 | 594 | if (cnt == 1) { 595 | group.outPath = []; 596 | 597 | if (group.endType == EndType.Round) { 598 | const r = absDelta; 599 | const steps = Math.ceil(this._stepsPerRad * 2 * Math.PI); 600 | group.outPath = Clipper.ellipse(path[0], r, r, steps); 601 | } else { 602 | const d = Math.ceil(this._groupDelta); 603 | const r = new Rect64(path[0].x - d, path[0].y - d, path[0].x - d, path[0].y - d); 604 | group.outPath = r.asPath(); 605 | } 606 | 607 | group.outPaths.push(group.outPath); 608 | } else { 609 | if (cnt == 2 && group.endType == EndType.Joined) { 610 | if (group.joinType == JoinType.Round) { 611 | this._endType = EndType.Round; 612 | } else { 613 | this._endType = EndType.Square; 614 | } 615 | } 616 | 617 | this.buildNormals(path); 618 | 619 | if (this._endType == EndType.Polygon) { 620 | this.offsetPolygon(group, path); 621 | } else if (this._endType == EndType.Joined) { 622 | this.offsetOpenJoined(group, path); 623 | } else { 624 | this.offsetOpenPath(group, path); 625 | } 626 | } 627 | } 628 | 629 | this._solution.push(...group.outPaths); 630 | group.outPaths = []; 631 | } 632 | } 633 | -------------------------------------------------------------------------------- /projects/clipper2-js/src/lib/rectclip.ts: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Author : Angus Johnson * 3 | * Date : 8 September 2023 * 4 | * Website : http://www.angusj.com * 5 | * Copyright : Angus Johnson 2010-2023 * 6 | * Purpose : FAST rectangular clipping * 7 | * License : http://www.boost.org/LICENSE_1_0.txt * 8 | *******************************************************************************/ 9 | 10 | // 11 | // Converted from C# implemention https://github.com/AngusJohnson/Clipper2/blob/main/CSharp/Clipper2Lib/Clipper.Core.cs 12 | // Removed support for USINGZ 13 | // 14 | // Converted by ChatGPT 4 August 3 version https://help.openai.com/en/articles/6825453-chatgpt-release-notes 15 | // 16 | 17 | import { Clipper } from "./clipper"; 18 | import { IPoint64, InternalClipper, Path64, Paths64, Point64, Rect64 } from "./core"; 19 | import { PointInPolygonResult } from "./engine"; 20 | 21 | export class OutPt2 { 22 | next?: OutPt2; 23 | prev?: OutPt2; 24 | 25 | pt: IPoint64; 26 | ownerIdx: number; 27 | edge?: Array; 28 | 29 | constructor(pt: IPoint64) { 30 | this.pt = pt; 31 | this.ownerIdx = 0 32 | } 33 | } 34 | 35 | enum Location { 36 | left, top, right, bottom, inside 37 | } 38 | 39 | export class RectClip64 { 40 | protected rect: Rect64; 41 | protected mp: Point64; 42 | protected rectPath: Path64; 43 | protected pathBounds!: Rect64; 44 | protected results: Array 45 | protected edges: Array[]; 46 | protected currIdx = -1; 47 | 48 | constructor(rect: Rect64) { 49 | this.rect = rect; 50 | this.mp = rect.midPoint(); 51 | this.rectPath = rect.asPath(); 52 | this.results = []; 53 | this.edges = Array(8).fill(undefined).map(() => []); 54 | } 55 | 56 | protected add(pt: IPoint64, startingNewPath: boolean = false): OutPt2 { 57 | let currIdx = this.results.length; 58 | let result: OutPt2; 59 | if (currIdx === 0 || startingNewPath) { 60 | result = new OutPt2(pt); 61 | this.results.push(result); 62 | result.ownerIdx = currIdx; 63 | result.prev = result; 64 | result.next = result; 65 | } else { 66 | currIdx--; 67 | const prevOp = this.results[currIdx]; 68 | if (prevOp!.pt === pt) return prevOp!; 69 | result = new OutPt2(pt); 70 | result.ownerIdx = currIdx; 71 | result.next = prevOp!.next; 72 | prevOp!.next!.prev = result; 73 | prevOp!.next = result; 74 | result.prev = prevOp!; 75 | this.results[currIdx] = result; 76 | } 77 | return result; 78 | } 79 | 80 | private static path1ContainsPath2(path1: Path64, path2: Path64): boolean { 81 | let ioCount = 0; 82 | for (const pt of path2) { 83 | const pip = InternalClipper.pointInPolygon(pt, path1); 84 | switch (pip) { 85 | case PointInPolygonResult.IsInside: 86 | ioCount--; break; 87 | case PointInPolygonResult.IsOutside: 88 | ioCount++; break; 89 | } 90 | if (Math.abs(ioCount) > 1) break; 91 | } 92 | return ioCount <= 0; 93 | } 94 | 95 | private static isClockwise(prev: Location, curr: Location, prevPt: IPoint64, currPt: IPoint64, rectMidPoint: Point64): boolean { 96 | if (this.areOpposites(prev, curr)) 97 | return InternalClipper.crossProduct(prevPt, rectMidPoint, currPt) < 0; 98 | else 99 | return this.headingClockwise(prev, curr); 100 | } 101 | 102 | private static areOpposites(prev: Location, curr: Location): boolean { 103 | return Math.abs(prev - curr) === 2; 104 | } 105 | 106 | private static headingClockwise(prev: Location, curr: Location): boolean { 107 | return (prev + 1) % 4 === curr; 108 | } 109 | 110 | private static getAdjacentLocation(loc: Location, isClockwise: boolean): Location { 111 | const delta = isClockwise ? 1 : 3; 112 | return (loc + delta) % 4; 113 | } 114 | 115 | private static unlinkOp(op: OutPt2 | undefined): OutPt2 | undefined { 116 | if (op!.next === op) return undefined; 117 | op!.prev!.next = op!.next; 118 | op!.next!.prev = op!.prev; 119 | return op!.next; 120 | } 121 | 122 | private static unlinkOpBack(op: OutPt2 | undefined): OutPt2 | undefined { 123 | if (op!.next === op) return undefined; 124 | op!.prev!.next = op!.next; 125 | op!.next!.prev = op!.prev; 126 | return op!.prev; 127 | } 128 | 129 | private static getEdgesForPt(pt: IPoint64, rec: Rect64): number { 130 | let result = 0; 131 | if (pt.x === rec.left) result = 1; 132 | else if (pt.x === rec.right) result = 4; 133 | if (pt.y === rec.top) result += 2; 134 | else if (pt.y === rec.bottom) result += 8; 135 | return result; 136 | } 137 | 138 | private static isHeadingClockwise(pt1: IPoint64, pt2: IPoint64, edgeIdx: number): boolean { 139 | switch (edgeIdx) { 140 | case 0: return pt2.y < pt1.y; 141 | case 1: return pt2.x > pt1.x; 142 | case 2: return pt2.y > pt1.y; 143 | default: return pt2.x < pt1.x; 144 | } 145 | } 146 | 147 | private static hasHorzOverlap(left1: IPoint64, right1: IPoint64, left2: IPoint64, right2: IPoint64): boolean { 148 | return (left1.x < right2.x) && (right1.x > left2.x); 149 | } 150 | 151 | private static hasVertOverlap(top1: IPoint64, bottom1: IPoint64, top2: IPoint64, bottom2: IPoint64): boolean { 152 | return (top1.y < bottom2.y) && (bottom1.y > top2.y); 153 | } 154 | 155 | private static addToEdge(edge: (OutPt2 | undefined)[], op: OutPt2): void { 156 | if (op.edge) return; 157 | op.edge = edge; 158 | edge.push(op); 159 | } 160 | 161 | private static uncoupleEdge(op: OutPt2): void { 162 | if (!op.edge) return; 163 | for (let i = 0; i < op.edge.length; i++) { 164 | const op2 = op.edge[i]; 165 | if (op2 === op) { 166 | op.edge[i] = undefined; 167 | break; 168 | } 169 | } 170 | op.edge = undefined; 171 | } 172 | 173 | private static setNewOwner(op: OutPt2, newIdx: number): void { 174 | op.ownerIdx = newIdx; 175 | let op2 = op.next!; 176 | while (op2 !== op) { 177 | op2.ownerIdx = newIdx; 178 | op2 = op2.next!; 179 | } 180 | } 181 | 182 | private addCorner(prev: Location, curr: Location): void { 183 | if (RectClip64.headingClockwise(prev, curr)) 184 | this.add(this.rectPath[prev]); 185 | else 186 | this.add(this.rectPath[curr]); 187 | } 188 | 189 | private addCornerByRef(loc: Location, isClockwise: boolean): void { 190 | if (isClockwise) { 191 | this.add(this.rectPath[loc]); 192 | loc = RectClip64.getAdjacentLocation(loc, true); 193 | } else { 194 | loc = RectClip64.getAdjacentLocation(loc, false); 195 | this.add(this.rectPath[loc]); 196 | } 197 | } 198 | 199 | protected static getLocation(rec: Rect64, pt: IPoint64): { success: boolean, loc: Location } { 200 | let loc: Location; 201 | 202 | if (pt.x === rec.left && pt.y >= rec.top && pt.y <= rec.bottom) { 203 | loc = Location.left; // pt on rec 204 | return { success: false, loc } 205 | } 206 | if (pt.x === rec.right && pt.y >= rec.top && pt.y <= rec.bottom) { 207 | loc = Location.right; // pt on rec 208 | return { success: false, loc }; 209 | } 210 | if (pt.y === rec.top && pt.x >= rec.left && pt.x <= rec.right) { 211 | loc = Location.top; // pt on rec 212 | return { success: false, loc }; 213 | } 214 | if (pt.y === rec.bottom && pt.x >= rec.left && pt.x <= rec.right) { 215 | loc = Location.bottom; // pt on rec 216 | return { success: false, loc }; 217 | } 218 | if (pt.x < rec.left) loc = Location.left; 219 | else if (pt.x > rec.right) loc = Location.right; 220 | else if (pt.y < rec.top) loc = Location.top; 221 | else if (pt.y > rec.bottom) loc = Location.bottom; 222 | else loc = Location.inside; 223 | 224 | return { success: true, loc }; 225 | } 226 | 227 | private static isHorizontal(pt1: IPoint64, pt2: IPoint64): boolean { 228 | return pt1.y == pt2.y; 229 | } 230 | 231 | private static getSegmentIntersection(p1: IPoint64, p2: IPoint64, p3: IPoint64, p4: IPoint64): { success: boolean, ip: IPoint64 } { 232 | let res1 = InternalClipper.crossProduct(p1, p3, p4); 233 | let res2 = InternalClipper.crossProduct(p2, p3, p4); 234 | let ip: IPoint64 = new Point64(0, 0); 235 | 236 | const equals = (lhs: IPoint64, rhs: IPoint64): boolean => { 237 | return lhs.x === rhs.x && lhs.y === rhs.y; 238 | } 239 | 240 | if (res1 === 0) { 241 | ip = p1; 242 | if (res2 === 0) return { ip, success: false }; 243 | else if (equals(p1, p3) || equals(p1, p4)) return { ip, success: true }; 244 | else if (RectClip64.isHorizontal(p3, p4)) return { ip, success: ((p1.x > p3.x) === (p1.x < p4.x)) }; 245 | else return { ip, success: ((p1.y > p3.y) === (p1.y < p4.y)) }; 246 | } 247 | else if (res2 === 0) { 248 | ip = p2; 249 | if (equals(p2, p3) || equals(p2, p4)) return { ip, success: true }; 250 | else if (RectClip64.isHorizontal(p3, p4)) return { ip, success: ((p2.x > p3.x) === (p2.x < p4.x)) }; 251 | else return { ip, success: ((p2.y > p3.y) === (p2.y < p4.y)) }; 252 | } 253 | 254 | if ((res1 > 0) === (res2 > 0)) return { ip: new Point64(0, 0), success: false }; 255 | 256 | let res3 = InternalClipper.crossProduct(p3, p1, p2); 257 | let res4 = InternalClipper.crossProduct(p4, p1, p2); 258 | 259 | if (res3 === 0) { 260 | ip = p3; 261 | if (equals(p3, p1) || equals(p3, p2)) return { ip, success: true }; 262 | else if (RectClip64.isHorizontal(p1, p2)) return { ip, success: ((p3.x > p1.x) === (p3.x < p2.x)) }; 263 | else return { ip, success: ((p3.y > p1.y) === (p3.y < p2.y)) }; 264 | } 265 | else if (res4 === 0) { 266 | ip = p4; 267 | if (equals(p4, p1) || equals(p4, p2)) return { ip, success: true }; 268 | else if (RectClip64.isHorizontal(p1, p2)) return { ip, success: ((p4.x > p1.x) === (p4.x < p2.x)) }; 269 | else return { ip, success: ((p4.y > p1.y) === (p4.y < p2.y)) }; 270 | } 271 | 272 | if ((res3 > 0) === (res4 > 0)) return { ip: new Point64(0, 0), success: false }; 273 | 274 | return InternalClipper.getIntersectPoint(p1, p2, p3, p4); 275 | } 276 | 277 | protected static getIntersection(rectPath: Path64, p: IPoint64, p2: IPoint64, loc: Location): { success: boolean, loc: Location, ip: IPoint64 } { 278 | // gets the pt of intersection between rectPath and segment(p, p2) that's closest to 'p' 279 | // when result == false, loc will remain unchanged 280 | let ip: IPoint64 = new Point64(); 281 | let result: { success: boolean, ip: IPoint64 } 282 | 283 | switch (loc) { 284 | case Location.left: 285 | if ((result = RectClip64.getSegmentIntersection(p, p2, rectPath[0], rectPath[3])).success) 286 | return { success: true, loc, ip: result.ip } 287 | else if (p.y < rectPath[0].y && (result = RectClip64.getSegmentIntersection(p, p2, rectPath[0], rectPath[1])).success) { 288 | loc = Location.top; 289 | return { success: true, loc, ip: result.ip } 290 | } 291 | else if ((result = RectClip64.getSegmentIntersection(p, p2, rectPath[2], rectPath[3])).success) { 292 | loc = Location.bottom; 293 | return { success: true, loc, ip: result.ip } 294 | } 295 | else return { success: false, loc, ip } 296 | 297 | case Location.right: 298 | if ((result = RectClip64.getSegmentIntersection(p, p2, rectPath[1], rectPath[2])).success) 299 | return { success: true, loc, ip: result.ip } 300 | else if (p.y < rectPath[0].y && (result = RectClip64.getSegmentIntersection(p, p2, rectPath[0], rectPath[1])).success) { 301 | loc = Location.top; 302 | return { success: true, loc, ip: result.ip } 303 | } 304 | else if ((result = RectClip64.getSegmentIntersection(p, p2, rectPath[2], rectPath[3])).success) { 305 | loc = Location.bottom; 306 | return { success: true, loc, ip: result.ip } 307 | } 308 | else return { success: false, loc, ip } 309 | 310 | case Location.top: 311 | if ((result = RectClip64.getSegmentIntersection(p, p2, rectPath[0], rectPath[1])).success) 312 | return { success: true, loc, ip: result.ip } 313 | else if (p.x < rectPath[0].x && (result = RectClip64.getSegmentIntersection(p, p2, rectPath[0], rectPath[3])).success) { 314 | loc = Location.left; 315 | return { success: true, loc, ip: result.ip } 316 | } 317 | else if (p.x > rectPath[1].x && (result = RectClip64.getSegmentIntersection(p, p2, rectPath[1], rectPath[2])).success) { 318 | loc = Location.right; 319 | return { success: true, loc, ip: result.ip } 320 | } 321 | else return { success: false, loc, ip } 322 | 323 | case Location.bottom: 324 | if ((result = RectClip64.getSegmentIntersection(p, p2, rectPath[2], rectPath[3])).success) 325 | return { success: true, loc, ip: result.ip } 326 | else if (p.x < rectPath[3].x && (result = RectClip64.getSegmentIntersection(p, p2, rectPath[0], rectPath[3])).success) { 327 | loc = Location.left; 328 | return { success: true, loc, ip: result.ip } 329 | } 330 | else if (p.x > rectPath[2].x && (result = RectClip64.getSegmentIntersection(p, p2, rectPath[1], rectPath[2])).success) { 331 | loc = Location.right; 332 | return { success: true, loc, ip: result.ip } 333 | } 334 | else return { success: false, loc, ip } 335 | 336 | default: 337 | if ((result = RectClip64.getSegmentIntersection(p, p2, rectPath[0], rectPath[3])).success) { 338 | loc = Location.left; 339 | return { success: true, loc, ip: result.ip } 340 | } 341 | else if ((result = RectClip64.getSegmentIntersection(p, p2, rectPath[0], rectPath[1])).success) { 342 | loc = Location.top; 343 | return { success: true, loc, ip: result.ip } 344 | } 345 | else if ((result = RectClip64.getSegmentIntersection(p, p2, rectPath[1], rectPath[2])).success) { 346 | loc = Location.right; 347 | return { success: true, loc, ip: result.ip } 348 | } 349 | else if ((result = RectClip64.getSegmentIntersection(p, p2, rectPath[2], rectPath[3])).success) { 350 | loc = Location.bottom; 351 | return { success: true, loc, ip: result.ip } 352 | } 353 | else return { success: false, loc, ip } 354 | } 355 | } 356 | 357 | protected getNextLocation(path: Path64, context: { loc: Location, i: number, highI: number }): void { 358 | 359 | switch (context.loc) { 360 | case Location.left: 361 | while (context.i <= context.highI && path[context.i].x <= this.rect.left) context.i++; 362 | if (context.i > context.highI) break; 363 | if (path[context.i].x >= this.rect.right) context.loc = Location.right; 364 | else if (path[context.i].y <= this.rect.top) context.loc = Location.top; 365 | else if (path[context.i].y >= this.rect.bottom) context.loc = Location.bottom; 366 | else context.loc = Location.inside; 367 | break; 368 | 369 | case Location.top: 370 | while (context.i <= context.highI && path[context.i].y <= this.rect.top) context.i++; 371 | if (context.i > context.highI) break; 372 | if (path[context.i].y >= this.rect.bottom) context.loc = Location.bottom; 373 | else if (path[context.i].x <= this.rect.left) context.loc = Location.left; 374 | else if (path[context.i].x >= this.rect.right) context.loc = Location.right; 375 | else context.loc = Location.inside; 376 | break; 377 | 378 | case Location.right: 379 | while (context.i <= context.highI && path[context.i].x >= this.rect.right) context.i++; 380 | if (context.i > context.highI) break; 381 | if (path[context.i].x <= this.rect.left) context.loc = Location.left; 382 | else if (path[context.i].y <= this.rect.top) context.loc = Location.top; 383 | else if (path[context.i].y >= this.rect.bottom) context.loc = Location.bottom; 384 | else context.loc = Location.inside; 385 | break; 386 | 387 | case Location.bottom: 388 | while (context.i <= context.highI && path[context.i].y >= this.rect.bottom) context.i++; 389 | if (context.i > context.highI) break; 390 | if (path[context.i].y <= this.rect.top) context.loc = Location.top; 391 | else if (path[context.i].x <= this.rect.left) context.loc = Location.left; 392 | else if (path[context.i].x >= this.rect.right) context.loc = Location.right; 393 | else context.loc = Location.inside; 394 | break; 395 | 396 | case Location.inside: 397 | while (context.i <= context.highI) { 398 | if (path[context.i].x < this.rect.left) context.loc = Location.left; 399 | else if (path[context.i].x > this.rect.right) context.loc = Location.right; 400 | else if (path[context.i].y > this.rect.bottom) context.loc = Location.bottom; 401 | else if (path[context.i].y < this.rect.top) context.loc = Location.top; 402 | else { 403 | this.add(path[context.i]); 404 | context.i++; 405 | continue; 406 | } 407 | break; 408 | } 409 | break; 410 | } 411 | } 412 | 413 | protected executeInternal(path: Path64): void { 414 | if (path.length < 3 || this.rect.isEmpty()) return; 415 | const startLocs: Location[] = []; 416 | 417 | let firstCross: Location = Location.inside; 418 | let crossingLoc: Location = firstCross, prev: Location = firstCross; 419 | 420 | let i: number 421 | const highI = path.length - 1; 422 | let result = RectClip64.getLocation(this.rect, path[highI]) 423 | let loc: Location = result.loc 424 | if (!result.success) { 425 | i = highI - 1; 426 | while (i >= 0 && !result.success) { 427 | i-- 428 | result = RectClip64.getLocation(this.rect, path[i]) 429 | prev = result.loc 430 | } 431 | if (i < 0) { 432 | for (const pt of path) { 433 | this.add(pt); 434 | } 435 | return; 436 | } 437 | if (prev == Location.inside) loc = Location.inside; 438 | } 439 | const startingLoc = loc; 440 | 441 | /////////////////////////////////////////////////// 442 | i = 0; 443 | while (i <= highI) { 444 | prev = loc; 445 | const prevCrossLoc: Location = crossingLoc; 446 | this.getNextLocation(path, { loc, i, highI }); 447 | if (i > highI) break; 448 | 449 | const prevPt = (i == 0) ? path[highI] : path[i - 1]; 450 | crossingLoc = loc; 451 | 452 | let result = RectClip64.getIntersection(this.rectPath, path[i], prevPt, crossingLoc) 453 | const ip: IPoint64 = result.ip 454 | 455 | if (!result.success) { 456 | if (prevCrossLoc == Location.inside) { 457 | const isClockw = RectClip64.isClockwise(prev, loc, prevPt, path[i], this.mp); 458 | do { 459 | startLocs.push(prev); 460 | prev = RectClip64.getAdjacentLocation(prev, isClockw); 461 | } while (prev != loc); 462 | crossingLoc = prevCrossLoc; 463 | } else if (prev != Location.inside && prev != loc) { 464 | const isClockw = RectClip64.isClockwise(prev, loc, prevPt, path[i], this.mp); 465 | do { 466 | this.addCornerByRef(prev, isClockw); 467 | } while (prev != loc); 468 | } 469 | ++i; 470 | continue; 471 | } 472 | 473 | //////////////////////////////////////////////////// 474 | // we must be crossing the rect boundary to get here 475 | //////////////////////////////////////////////////// 476 | if (loc == Location.inside) { 477 | if (firstCross == Location.inside) { 478 | firstCross = crossingLoc; 479 | startLocs.push(prev); 480 | } else if (prev != crossingLoc) { 481 | const isClockw = RectClip64.isClockwise(prev, crossingLoc, prevPt, path[i], this.mp); 482 | do { 483 | this.addCornerByRef(prev, isClockw); 484 | } while (prev != crossingLoc); 485 | } 486 | } else if (prev != Location.inside) { 487 | // passing right through rect. 'ip' here will be the second 488 | // intersect pt but we'll also need the first intersect pt (ip2) 489 | 490 | loc = prev; 491 | result = RectClip64.getIntersection(this.rectPath, prevPt, path[i], loc); 492 | const ip2: IPoint64 = result.ip 493 | 494 | if (prevCrossLoc != Location.inside && prevCrossLoc != loc) 495 | this.addCorner(prevCrossLoc, loc); 496 | 497 | if (firstCross == Location.inside) { 498 | firstCross = loc; 499 | startLocs.push(prev); 500 | } 501 | 502 | loc = crossingLoc; 503 | this.add(ip2); 504 | if (ip == ip2) { 505 | loc = RectClip64.getLocation(this.rect, path[i]).loc; 506 | this.addCorner(crossingLoc, loc); 507 | crossingLoc = loc; 508 | continue; 509 | } 510 | } else { 511 | loc = crossingLoc; 512 | if (firstCross == Location.inside) 513 | firstCross = crossingLoc; 514 | } 515 | 516 | this.add(ip); 517 | }//while i <= highI 518 | /////////////////////////////////////////////////// 519 | 520 | if (firstCross == Location.inside) { 521 | if (startingLoc != Location.inside) { 522 | if (this.pathBounds.containsRect(this.rect) && RectClip64.path1ContainsPath2(path, this.rectPath)) { 523 | for (let j = 0; j < 4; j++) { 524 | this.add(this.rectPath[j]); 525 | RectClip64.addToEdge(this.edges[j * 2], this.results[0]!); 526 | } 527 | } 528 | } 529 | } else if (loc != Location.inside && (loc != firstCross || startLocs.length > 2)) { 530 | if (startLocs.length > 0) { 531 | prev = loc; 532 | for (const loc2 of startLocs) { 533 | if (prev == loc2) continue; 534 | this.addCornerByRef(prev, RectClip64.headingClockwise(prev, loc2)); 535 | prev = loc2; 536 | } 537 | loc = prev; 538 | } 539 | if (loc != firstCross) 540 | this.addCornerByRef(loc, RectClip64.headingClockwise(loc, firstCross)); 541 | } 542 | } 543 | 544 | public execute(paths: Paths64): Paths64 { 545 | const result: Paths64 = []; 546 | if (this.rect.isEmpty()) return result; 547 | 548 | for (const path of paths) { 549 | if (path.length < 3) continue; 550 | this.pathBounds = Clipper.getBounds(path); 551 | 552 | if (!this.rect.intersects(this.pathBounds)) continue; 553 | else if (this.rect.containsRect(this.pathBounds)) { 554 | result.push(path); 555 | continue; 556 | } 557 | this.executeInternal(path); 558 | this.checkEdges(); 559 | for (let i = 0; i < 4; ++i) 560 | this.tidyEdgePair(i, this.edges[i * 2], this.edges[i * 2 + 1]); 561 | 562 | for (const op of this.results) { 563 | const tmp = this.getPath(op); 564 | if (tmp.length > 0) result.push(tmp); 565 | } 566 | 567 | this.results.length = 0 568 | for (let i = 0; i < 8; i++) 569 | this.edges[i].length = 0 570 | } 571 | return result; 572 | } 573 | 574 | private checkEdges(): void { 575 | for (let i = 0; i < this.results.length; i++) { 576 | let op = this.results[i]; 577 | let op2 = op; 578 | 579 | if (op === undefined) continue; 580 | 581 | do { 582 | if (InternalClipper.crossProduct(op2!.prev!.pt, op2!.pt, op2!.next!.pt) === 0) { 583 | if (op2 === op) { 584 | op2 = RectClip64.unlinkOpBack(op2); 585 | if (op2 === undefined) break; 586 | op = op2.prev; 587 | } else { 588 | op2 = RectClip64.unlinkOpBack(op2); 589 | if (op2 === undefined) break; 590 | } 591 | } else { 592 | op2 = op2!.next; 593 | } 594 | } while (op2 !== op); 595 | 596 | if (op2 === undefined) { 597 | this.results[i] = undefined; 598 | continue; 599 | } 600 | this.results[i] = op2; 601 | 602 | let edgeSet1 = RectClip64.getEdgesForPt(op!.prev!.pt, this.rect); 603 | op2 = op; 604 | do { 605 | const edgeSet2 = RectClip64.getEdgesForPt(op2!.pt, this.rect); 606 | if (edgeSet2 !== 0 && op2!.edge === undefined) { 607 | const combinedSet = (edgeSet1 & edgeSet2); 608 | for (let j = 0; j < 4; ++j) { 609 | if ((combinedSet & (1 << j)) !== 0) { 610 | if (RectClip64.isHeadingClockwise(op2!.prev!.pt, op2!.pt, j)) 611 | RectClip64.addToEdge(this.edges[j * 2], op2!); 612 | else 613 | RectClip64.addToEdge(this.edges[j * 2 + 1], op2!); 614 | } 615 | } 616 | } 617 | edgeSet1 = edgeSet2; 618 | op2 = op2!.next; 619 | } while (op2 !== op); 620 | } 621 | } 622 | 623 | private tidyEdgePair(idx: number, cw: Array, ccw: Array): void { 624 | if (ccw.length === 0) return; 625 | const isHorz = (idx === 1 || idx === 3); 626 | const cwIsTowardLarger = (idx === 1 || idx === 2); 627 | let i = 0, j = 0; 628 | let p1: OutPt2 | undefined, p2: OutPt2 | undefined, p1a: OutPt2 | undefined, p2a: OutPt2 | undefined, op: OutPt2 | undefined, op2: OutPt2 | undefined; 629 | 630 | while (i < cw.length) { 631 | p1 = cw[i]; 632 | if (!p1 || p1.next === p1.prev) { 633 | cw[i++] = undefined; 634 | j = 0; 635 | continue; 636 | } 637 | 638 | const jLim = ccw.length; 639 | while (j < jLim && (!ccw[j] || ccw[j]!.next === ccw[j]!.prev)) ++j; 640 | 641 | if (j === jLim) { 642 | ++i; 643 | j = 0; 644 | continue; 645 | } 646 | 647 | if (cwIsTowardLarger) { 648 | p1 = cw[i]!.prev!; 649 | p1a = cw[i]; 650 | p2 = ccw[j]; 651 | p2a = ccw[j]!.prev!; 652 | } else { 653 | p1 = cw[i]; 654 | p1a = cw[i]!.prev!; 655 | p2 = ccw[j]!.prev!; 656 | p2a = ccw[j]; 657 | } 658 | 659 | if ((isHorz && !RectClip64.hasHorzOverlap(p1!.pt, p1a!.pt, p2!.pt, p2a!.pt)) || 660 | (!isHorz && !RectClip64.hasVertOverlap(p1!.pt, p1a!.pt, p2!.pt, p2a!.pt))) { 661 | ++j; 662 | continue; 663 | } 664 | 665 | const isRejoining = cw[i]!.ownerIdx !== ccw[j]!.ownerIdx; 666 | 667 | if (isRejoining) { 668 | this.results[p2!.ownerIdx] = undefined; 669 | RectClip64.setNewOwner(p2!, p1!.ownerIdx); 670 | } 671 | 672 | if (cwIsTowardLarger) { 673 | // p1 >> | >> p1a; 674 | // p2 << | << p2a; 675 | p1!.next = p2; 676 | p2!.prev = p1; 677 | p1a!.prev = p2a; 678 | p2a!.next = p1a; 679 | } else { 680 | // p1 << | << p1a; 681 | // p2 >> | >> p2a; 682 | p1!.prev = p2; 683 | p2!.next = p1; 684 | p1a!.next = p2a; 685 | p2a!.prev = p1a; 686 | } 687 | 688 | if (!isRejoining) { 689 | const new_idx = this.results.length; 690 | this.results.push(p1a); 691 | RectClip64.setNewOwner(p1a!, new_idx); 692 | } 693 | 694 | if (cwIsTowardLarger) { 695 | op = p2; 696 | op2 = p1a; 697 | } else { 698 | op = p1; 699 | op2 = p2a; 700 | } 701 | this.results[op!.ownerIdx] = op; 702 | this.results[op2!.ownerIdx] = op2; 703 | 704 | // and now lots of work to get ready for the next loop 705 | 706 | let opIsLarger: boolean, op2IsLarger: boolean; 707 | if (isHorz) { // X 708 | opIsLarger = op!.pt.x > op!.prev!.pt.x; 709 | op2IsLarger = op2!.pt.x > op2!.prev!.pt.x; 710 | } else { // Y 711 | opIsLarger = op!.pt.y > op!.prev!.pt.y; 712 | op2IsLarger = op2!.pt.y > op2!.prev!.pt.y; 713 | } 714 | 715 | if ((op!.next === op!.prev) || (op!.pt === op!.prev!.pt)) { 716 | if (op2IsLarger === cwIsTowardLarger) { 717 | cw[i] = op2; 718 | ccw[j++] = undefined; 719 | } else { 720 | ccw[j] = op2; 721 | cw[i++] = undefined; 722 | } 723 | } else if ((op2!.next === op2!.prev) || (op2!.pt === op2!.prev!.pt)) { 724 | if (opIsLarger === cwIsTowardLarger) { 725 | cw[i] = op; 726 | ccw[j++] = undefined; 727 | } else { 728 | ccw[j] = op; 729 | cw[i++] = undefined; 730 | } 731 | } else if (opIsLarger === op2IsLarger) { 732 | if (opIsLarger === cwIsTowardLarger) { 733 | cw[i] = op; 734 | RectClip64.uncoupleEdge(op2!); 735 | RectClip64.addToEdge(cw, op2!); 736 | ccw[j++] = undefined; 737 | } else { 738 | cw[i++] = undefined; 739 | ccw[j] = op2; 740 | RectClip64.uncoupleEdge(op!); 741 | RectClip64.addToEdge(ccw, op!); 742 | j = 0; 743 | } 744 | } else { 745 | if (opIsLarger === cwIsTowardLarger) 746 | cw[i] = op; 747 | else 748 | ccw[j] = op; 749 | 750 | if (op2IsLarger === cwIsTowardLarger) 751 | cw[i] = op2; 752 | else 753 | ccw[j] = op2; 754 | } 755 | } 756 | } 757 | 758 | protected getPath(op: OutPt2 | undefined): Path64 { 759 | const result = new Path64(); 760 | if (!op || op.prev === op.next) return result; 761 | 762 | let op2: OutPt2 | undefined = op.next; 763 | while (op2 && op2 !== op) { 764 | if (InternalClipper.crossProduct(op2.prev!.pt, op2.pt, op2.next!.pt) === 0) { 765 | op = op2.prev!; 766 | op2 = RectClip64.unlinkOp(op2); 767 | } else { 768 | op2 = op2.next!; 769 | } 770 | } 771 | 772 | if (!op2) return new Path64(); 773 | 774 | result.push(op.pt); 775 | op2 = op.next!; 776 | while (op2 !== op) { 777 | result.push(op2.pt); 778 | op2 = op2.next!; 779 | } 780 | 781 | return result; 782 | } 783 | } 784 | 785 | export class RectClipLines64 extends RectClip64 { 786 | 787 | constructor(rect: Rect64) { 788 | super(rect); 789 | } 790 | 791 | public override execute(paths: Paths64): Paths64 { 792 | const result = new Paths64(); 793 | if (this.rect.isEmpty()) return result; 794 | for (const path of paths) { 795 | if (path.length < 2) continue; 796 | this.pathBounds = Clipper.getBounds(path); 797 | if (!this.rect.intersects(this.pathBounds)) continue; 798 | 799 | this.executeInternal(path); 800 | 801 | for (const op of this.results) { 802 | const tmp = this.getPath(op); 803 | if (tmp.length > 0) result.push(tmp); 804 | } 805 | 806 | // Clean up after every loop 807 | this.results.length = 0; // Clear the array 808 | for (let i = 0; i < 8; i++) { 809 | this.edges[i].length = 0; // Clear each array 810 | } 811 | } 812 | return result; 813 | } 814 | 815 | protected override getPath(op: OutPt2 | undefined): Path64 { 816 | const result = new Path64(); 817 | if (!op || op === op.next) return result; 818 | op = op.next; // starting at path beginning 819 | result.push(op!.pt); 820 | let op2 = op!.next!; 821 | while (op2 !== op) { 822 | result.push(op2.pt); 823 | op2 = op2.next!; 824 | } 825 | return result; 826 | } 827 | 828 | protected override executeInternal(path: Path64): void { 829 | this.results = []; 830 | if (path.length < 2 || this.rect.isEmpty()) return; 831 | 832 | let prev: Location = Location.inside; 833 | let i = 1; 834 | const highI = path.length - 1; 835 | 836 | let result = RectClipLines64.getLocation(this.rect, path[0]) 837 | let loc: Location = result.loc 838 | if (!result.success) { 839 | while (i <= highI && !result.success) { 840 | i++ 841 | result = RectClipLines64.getLocation(this.rect, path[i]) 842 | prev = result.loc 843 | } 844 | if (i > highI) { 845 | for (const pt of path) this.add(pt); 846 | } 847 | if (prev == Location.inside) loc = Location.inside; 848 | i = 1; 849 | } 850 | if (loc == Location.inside) this.add(path[0]); 851 | 852 | while (i <= highI) { 853 | prev = loc; 854 | this.getNextLocation(path, { loc, i, highI }); 855 | 856 | if (i > highI) break; 857 | 858 | const prevPt: IPoint64 = path[i - 1]; 859 | let crossingLoc: Location = loc; 860 | 861 | let result = RectClipLines64.getIntersection(this.rectPath, path[i], prevPt, crossingLoc) 862 | const ip: IPoint64 = result.ip 863 | crossingLoc = result.loc 864 | 865 | if (!result.success) { 866 | i++; 867 | continue; 868 | } 869 | 870 | if (loc == Location.inside) { 871 | this.add(ip, true); 872 | } else if (prev !== Location.inside) { 873 | crossingLoc = prev; 874 | 875 | result = RectClipLines64.getIntersection(this.rectPath, prevPt, path[i], crossingLoc); 876 | const ip2: IPoint64 = result.ip 877 | crossingLoc = result.loc 878 | 879 | this.add(ip2); 880 | this.add(ip); 881 | } else { 882 | this.add(ip); 883 | } 884 | } 885 | } 886 | } 887 | -------------------------------------------------------------------------------- /projects/clipper2-js/src/public-api.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Public API Surface of clipper2-js 3 | */ 4 | 5 | export * from './lib/core'; 6 | export * from './lib/clipper'; 7 | export * from './lib/engine'; 8 | export * from './lib/minkowski'; 9 | export * from './lib/offset'; 10 | export * from './lib/rectclip'; 11 | -------------------------------------------------------------------------------- /projects/clipper2-js/tests/clipperparse.ts: -------------------------------------------------------------------------------- 1 | import { ClipType, FillRule, Path64, Paths64, Point64 } from "../src/lib/core" 2 | 3 | export class TestCase { 4 | 5 | constructor( 6 | public caption: string, 7 | public clipType: ClipType, 8 | public fillRule: FillRule, 9 | public area: number, 10 | public count: number, 11 | public GetIdx: number, 12 | public subj: Paths64, 13 | public subj_open: Paths64, 14 | public clip: Paths64, 15 | public testNum: number) { } 16 | } 17 | 18 | export class ClipperParse { 19 | 20 | static testCases(lines: string[]): TestCase[] { 21 | let caption = "" 22 | let ct: ClipType = ClipType.None 23 | let fillRule: FillRule = FillRule.EvenOdd 24 | let area: number = 0 25 | let count: number = 0 26 | let GetIdx: number = 0 27 | const subj = new Paths64() 28 | const subj_open = new Paths64() 29 | const clip = new Paths64() 30 | 31 | const cases: TestCase[] = [] 32 | 33 | for (const s of lines) { 34 | if (s.trim() === "") { 35 | if (GetIdx !== 0) { 36 | cases.push(new TestCase(caption, ct, fillRule, area, count, GetIdx, new Paths64(...subj), new Paths64(...subj_open), new Paths64(...clip), cases.length + 1)) 37 | subj.length = 0 38 | subj_open.length = 0 39 | clip.length = 0 40 | GetIdx = 0 41 | } 42 | continue 43 | } 44 | 45 | if (s.startsWith("CAPTION: ")) { 46 | caption = s.substring(9) 47 | continue 48 | } 49 | 50 | if (s.startsWith("CLIPTYPE: ")) { 51 | if (s.includes("INTERSECTION")) { 52 | ct = ClipType.Intersection 53 | } else if (s.includes("UNION")) { 54 | ct = ClipType.Union 55 | } else if (s.includes("DIFFERENCE")) { 56 | ct = ClipType.Difference 57 | } else { 58 | ct = ClipType.Xor 59 | } 60 | continue 61 | } 62 | 63 | if (s.startsWith("FILLTYPE: ") || s.startsWith("FILLRULE: ")) { 64 | 65 | if (s.includes("EVENODD")) { 66 | fillRule = FillRule.EvenOdd 67 | } else if (s.includes("POSITIVE")) { 68 | fillRule = FillRule.Positive 69 | } else if (s.includes("NEGATIVE")) { 70 | fillRule = FillRule.Negative 71 | } else { 72 | fillRule = FillRule.NonZero 73 | } 74 | continue 75 | } 76 | 77 | if (s.startsWith("SOL_AREA: ")) { 78 | area = +s.substring(10) 79 | continue 80 | } 81 | 82 | if (s.startsWith("SOL_COUNT: ")) { 83 | count = +s.substring(11) 84 | continue 85 | } 86 | 87 | if (s.startsWith("SUBJECTS_OPEN")) { 88 | GetIdx = 2 89 | continue 90 | } else if (s.startsWith("SUBJECTS")) { 91 | GetIdx = 1 92 | continue 93 | } else if (s.startsWith("CLIPS")) { 94 | GetIdx = 3 95 | continue 96 | } 97 | 98 | const paths: Paths64 | undefined = ClipperParse.pathFromStr(s) 99 | 100 | if (!paths || paths.length == 0) { 101 | if (GetIdx == 3) { 102 | //return cases 103 | } 104 | if (s.indexOf("SUBJECTS_OPEN") == 0) { 105 | GetIdx = 2 106 | } else if (s.indexOf("CLIPS") == 0) { 107 | GetIdx = 3 108 | } else { 109 | //return cases 110 | } 111 | continue 112 | } 113 | 114 | if (GetIdx === 1) { 115 | subj.push(...paths) 116 | } else if (GetIdx === 2) { 117 | subj_open.push(...paths) 118 | } else { 119 | clip.push(...paths) 120 | } 121 | } 122 | 123 | return cases 124 | } 125 | 126 | static pathFromStr(s: string | undefined): Paths64 { 127 | const pp = new Paths64() 128 | if (s) { 129 | const p = new Path64() 130 | const pairs = s.split(' ') 131 | 132 | pairs.forEach(pair => { 133 | const point = pair.split(',') 134 | p.push(new Point64(+point[0], +point[1])) 135 | }) 136 | 137 | pp.push(p) 138 | } 139 | return pp 140 | } 141 | 142 | static longTryParse(s: string): number | undefined { 143 | const parsed = Number(s) 144 | if (isNaN(parsed)) { 145 | return undefined 146 | } 147 | return parsed 148 | } 149 | 150 | 151 | } 152 | -------------------------------------------------------------------------------- /projects/clipper2-js/tests/lines.test.ts: -------------------------------------------------------------------------------- 1 | import { Clipper64, Paths64, Clipper } from '../src/public-api'; 2 | import { ClipperParse } from './clipperparse'; 3 | 4 | 5 | test('TestOpenPaths', () => { 6 | const testcases = ClipperParse.testCases(lines.split('\n')) 7 | 8 | testcases.forEach(testcase => { 9 | const c64 = new Clipper64(); 10 | c64.addSubjectPaths(testcase.subj); 11 | c64.addOpenSubjectPaths(testcase.subj_open); 12 | c64.addClipPaths(testcase.clip); 13 | 14 | const solution = new Paths64(); 15 | c64.execute(testcase.clipType, testcase.fillRule, solution); 16 | 17 | if (testcase.area > 0) { 18 | const area2 = Clipper.areaPaths(solution); 19 | const a = testcase.area / area2; 20 | 21 | expect(a).toBeGreaterThanOrEqual(0.995); 22 | expect(a).toBeLessThanOrEqual(1.005); 23 | 24 | } 25 | 26 | if (testcase.count > 0 && Math.abs(solution.length - testcase.count) > 0) { 27 | expect(Math.abs(solution.length - testcase.count)).toBeLessThan(2); 28 | } 29 | }) 30 | }); 31 | 32 | const lines = ` 33 | CAPTION: 1. 34 | CLIPTYPE: DIFFERENCE 35 | FILLRULE: EVENODD 36 | SOL_AREA: 8 37 | SOL_COUNT: 1 38 | SUBJECTS 39 | 5,4, 8,4, 8,8, 5,8 40 | SUBJECTS_OPEN 41 | 6,7, 6,5 42 | CLIPS 43 | 7,9, 4,9, 4,6, 7,6 44 | 45 | CAPTION: 2. 46 | CLIPTYPE: INTERSECTION 47 | FILLRULE: EVENODD 48 | SOL_AREA: 0 49 | SOL_COUNT: 0 50 | SUBJECTS_OPEN 51 | 40,10, 10,10, 10,90, 90,90, 90,10, 60,10 52 | CLIPS 53 | 0,0, 100,0, 100,100, 0,100 54 | 55 | CAPTION: 3. 56 | CLIPTYPE: INTERSECTION 57 | FILLRULE: EVENODD 58 | SOL_AREA: 0 59 | SOL_COUNT: 0 60 | SUBJECTS_OPEN 61 | 40,90, 10,90, 10,10, 90,10, 90,90, 60,90 62 | CLIPS 63 | 40,90, 10,90, 10,10, 90,10, 90,90, 60,90 64 | 65 | CAPTION: 4. 66 | CLIPTYPE: INTERSECTION 67 | FILLRULE: EVENODD 68 | SOL_AREA: 0 69 | SOL_COUNT: 0 70 | SUBJECTS_OPEN 71 | 40,90, 10,90, 10,10, 90,10, 90,90, 60,90 72 | CLIPS 73 | 0,0, 100,0, 100,100, 0,100 74 | 75 | CAPTION: 5. 76 | CLIPTYPE: INTERSECTION 77 | FILLRULE: EVENODD 78 | SOL_AREA: 0 79 | SOL_COUNT: 0 80 | SUBJECTS_OPEN 81 | 10,40, 10,10, 90,10, 90,90, 10,90, 10,60 82 | CLIPS 83 | 0,0, 100,0, 100,100, 0,100 84 | 85 | CAPTION: 6. 86 | CLIPTYPE: INTERSECTION 87 | FILLRULE: EVENODD 88 | SOL_AREA: 0 89 | SOL_COUNT: 0 90 | SUBJECTS_OPEN 91 | 90,40, 90,10, 10,10, 10,90, 90,90, 90,60 92 | CLIPS 93 | 0,0, 100,0, 100,100, 0,100 94 | 95 | CAPTION: 7. 96 | CLIPTYPE: INTERSECTION 97 | FILLRULE: EVENODD 98 | SOL_AREA: 0 99 | SOL_COUNT: 0 100 | SUBJECTS_OPEN 101 | 40,10, 10,10, 10,90, 90,90, 90,10, 60,10 102 | CLIPS 103 | 20,0, 120,0, 120,100, 20,100 104 | 105 | CAPTION: 8. 106 | CLIPTYPE: INTERSECTION 107 | FILLRULE: EVENODD 108 | SOL_AREA: 0 109 | SOL_COUNT: 0 110 | SUBJECTS_OPEN 111 | 40,10, 10,10, 10,90, 90,90, 90,10, 60,10 112 | CLIPS 113 | -20,0, 80,0, 80,100, -20,100 114 | 115 | CAPTION: 9. 116 | CLIPTYPE: INTERSECTION 117 | FILLRULE: EVENODD 118 | SOL_AREA: 0 119 | SOL_COUNT: 0 120 | SUBJECTS_OPEN 121 | 40,90, 10,90, 10,10, 90,10, 90,90, 60,90 122 | CLIPS 123 | 20,0, 120,0, 120,100, 20,100 124 | 125 | CAPTION: 10. 126 | CLIPTYPE: INTERSECTION 127 | FILLRULE: EVENODD 128 | SOL_AREA: 0 129 | SOL_COUNT: 0 130 | SUBJECTS_OPEN 131 | 40,90, 10,90, 10,10, 90,10, 90,90, 60,90 132 | CLIPS 133 | -20,0, 80,0, 80,100, -20,100 134 | 135 | CAPTION: 11. 136 | CLIPTYPE: INTERSECTION 137 | FILLRULE: EVENODD 138 | SOL_AREA: 0 139 | SOL_COUNT: 0 140 | SUBJECTS_OPEN 141 | 10,40, 10,10, 90,10, 90,90, 10,90, 10,60 142 | CLIPS 143 | 20,0, 120,0, 120,100, 20,100 144 | 145 | CAPTION: 12. 146 | CLIPTYPE: INTERSECTION 147 | FILLRULE: EVENODD 148 | SOL_AREA: 0 149 | SOL_COUNT: 0 150 | SUBJECTS_OPEN 151 | 10,40, 10,10, 90,10, 90,90, 10,90, 10,60 152 | CLIPS 153 | -20,0, 80,0, 80,100, -20,100 154 | 155 | CAPTION: 13. 156 | CLIPTYPE: INTERSECTION 157 | FILLRULE: EVENODD 158 | SOL_AREA: 0 159 | SOL_COUNT: 0 160 | SUBJECTS_OPEN 161 | 90,40, 90,10, 10,10, 10,90, 90,90, 90,60 162 | CLIPS 163 | 20,0, 120,0, 120,100, 20,100 164 | 165 | CAPTION: 14. 166 | CLIPTYPE: INTERSECTION 167 | FILLRULE: EVENODD 168 | SOL_AREA: 0 169 | SOL_COUNT: 0 170 | SUBJECTS_OPEN 171 | 90,40, 90,10, 10,10, 10,90, 90,90, 90,60 172 | CLIPS 173 | -20,0, 80,0, 80,100, -20,100 174 | 175 | CAPTION: 15. 176 | CLIPTYPE: INTERSECTION 177 | FILLRULE: EVENODD 178 | SOL_AREA: 0 179 | SOL_COUNT: 0 180 | SUBJECTS_OPEN 181 | 65,-15, 65,-55, -5,-55 182 | CLIPS 183 | 30,-80, 30,0, 50,0, 50,-80 184 | 185 | CAPTION: 16. 186 | CLIPTYPE: INTERSECTION 187 | FILLRULE: EVENODD 188 | SOL_AREA: 0 189 | SOL_COUNT: 0 190 | SUBJECTS_OPEN 191 | 30,-80, 30,0 192 | CLIPS 193 | -5,-55, -5,-15, 65,-15, 65,-55 194 | 195 | ` 196 | -------------------------------------------------------------------------------- /projects/clipper2-js/tests/offset.test.ts: -------------------------------------------------------------------------------- 1 | import { Paths64, Clipper, JoinType, EndType } from '../src/public-api'; 2 | 3 | describe('InflatePaths', () => { 4 | it('offsets an open line', () => { 5 | const paths = new Paths64(); 6 | paths.push(Clipper.makePath([0, 0, 10, 0])) 7 | 8 | const inflatedPaths = Clipper.InflatePaths( 9 | paths, 10 | 1, 11 | JoinType.Miter, 12 | EndType.Butt, 13 | ); 14 | 15 | expect(inflatedPaths).toEqual([[ 16 | { x: 10, y: 1, }, 17 | { x: -0, y: 1, }, 18 | { x: -0, y: -1, }, 19 | { x: 10, y: -1, }, 20 | ]]); 21 | }) 22 | 23 | }) -------------------------------------------------------------------------------- /projects/clipper2-js/tsconfig.lib.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "../../tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "../../out-tsc/lib", 6 | "declaration": true, 7 | "declarationMap": true, 8 | "inlineSources": true, 9 | "types": [] 10 | }, 11 | "exclude": [ 12 | "**/*.spec.ts" 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /projects/clipper2-js/tsconfig.lib.prod.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.lib.json", 4 | "compilerOptions": { 5 | "declarationMap": false 6 | }, 7 | "angularCompilerOptions": { 8 | "compilationMode": "partial" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /projects/clipper2-js/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "../../tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "../../out-tsc/spec", 6 | "types": [ 7 | "jasmine" 8 | ] 9 | }, 10 | "include": [ 11 | "**/*.spec.ts", 12 | "**/*.d.ts" 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /setup-jest.ts: -------------------------------------------------------------------------------- 1 | import 'jest-preset-angular/setup-jest'; 2 | -------------------------------------------------------------------------------- /src/app/app.component.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IRobot1/clipper2-ts/eefbad501c878c3c28ecd39f7af210ba9b53c937/src/app/app.component.html -------------------------------------------------------------------------------- /src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { BrowserModule } from '@angular/platform-browser'; 3 | 4 | import { AppComponent } from './app.component'; 5 | 6 | @NgModule({ 7 | declarations: [ 8 | AppComponent 9 | ], 10 | imports: [ 11 | BrowserModule 12 | ], 13 | providers: [], 14 | bootstrap: [AppComponent] 15 | }) 16 | export class AppModule { } 17 | -------------------------------------------------------------------------------- /src/app/clipper-example.ts: -------------------------------------------------------------------------------- 1 | import { AmbientLight, BufferGeometry, CircleGeometry, MathUtils, Mesh, MeshBasicMaterial, PointLight, Scene, Shape, ShapeGeometry, Vector2 } from "three" 2 | import { OrbitControls } from "three/examples/jsm/controls/OrbitControls"; 3 | import { TextGeometry } from 'three/examples/jsm/geometries/TextGeometry'; 4 | import { FontLoader } from "three/examples/jsm/loaders/FontLoader"; 5 | 6 | import { Clipper, FillRule, Path64, Paths64, Point64 } from "clipper2-js"; 7 | 8 | import { ThreeJSApp } from "./threejs-app" 9 | 10 | export class ClipperExample { 11 | 12 | dispose = () => { } 13 | 14 | constructor(app: ThreeJSApp) { 15 | 16 | const scene = new Scene() 17 | app.scene = scene 18 | 19 | app.camera.position.z = 140 20 | 21 | const orbit = new OrbitControls(app.camera, app.domElement); 22 | orbit.target.set(0, app.camera.position.y, 0) 23 | //orbit.enableRotate = false; 24 | orbit.update(); 25 | 26 | const ambient = new AmbientLight() 27 | ambient.intensity = 0.1 28 | scene.add(ambient) 29 | 30 | const light = new PointLight(0xffffff, 1, 100) 31 | light.position.set(-1, 1, 2) 32 | light.shadow.bias = -0.001 // this prevents artifacts 33 | light.shadow.mapSize.width = light.shadow.mapSize.height = 512 * 2 34 | scene.add(light) 35 | 36 | const loader = new FontLoader(); 37 | 38 | loader.load('assets/helvetiker_regular.typeface.json', function (font) { 39 | 40 | const union = new Mesh(new TextGeometry('Union', { font: font, size: 10, height: 0, bevelEnabled: false })) 41 | union.position.set(-135,60,0) 42 | scene.add(union) 43 | 44 | const intersection = new Mesh(new TextGeometry('Intersection', { font: font, size: 10, height: 0, bevelEnabled: false })) 45 | intersection.position.set(-30,60,0) 46 | scene.add(intersection) 47 | 48 | const difference = new Mesh(new TextGeometry('Difference', { font: font, size: 10, height: 0, bevelEnabled: false })) 49 | difference.position.set(90,60,0) 50 | scene.add(difference) 51 | 52 | }); 53 | // intersect 54 | const star1shape = this.createStarShape(50) 55 | const star1geometry = new ShapeGeometry(star1shape) 56 | 57 | const star1 = new Mesh(star1geometry, new MeshBasicMaterial({ color: 'blue' })) 58 | star1.position.z = -0.1 59 | scene.add(star1) 60 | 61 | const star2 = new Mesh(undefined, new MeshBasicMaterial({ color: 'red' })) 62 | scene.add(star2) 63 | 64 | const intersect = new Mesh(undefined, new MeshBasicMaterial({ color: 'white' })) 65 | intersect.position.z = 5 66 | scene.add(intersect) 67 | 68 | // union 69 | const star3 = new Mesh(star1geometry, new MeshBasicMaterial({ color: 'blue' })) 70 | star3.position.z = -0.1 71 | star3.position.x = -120 72 | scene.add(star3) 73 | 74 | const star4 = new Mesh(undefined, new MeshBasicMaterial({ color: 'red' })) 75 | star4.position.x = -120 76 | scene.add(star4) 77 | 78 | const union = new Mesh(undefined, new MeshBasicMaterial({ color: 'white' })) 79 | union.position.z = 5 80 | union.position.x = -120 81 | scene.add(union) 82 | 83 | // difference 84 | const star5 = new Mesh(star1geometry, new MeshBasicMaterial({ color: 'blue' })) 85 | star5.position.z = -0.1 86 | star5.position.x = 120 87 | scene.add(star5) 88 | 89 | const star6 = new Mesh(undefined, new MeshBasicMaterial({ color: 'red' })) 90 | star6.position.x = 120 91 | scene.add(star6) 92 | 93 | const diffmesh: Array = [] 94 | 95 | let i = 0 96 | setInterval(() => { 97 | // star2 is star1 rotated a bit 98 | const tempgeometry = star1geometry.clone() 99 | tempgeometry.rotateZ(MathUtils.degToRad(i)) 100 | //tempgeometry.translate(10, 0, 0) 101 | 102 | const tempshape = this.geometryToShape(tempgeometry) 103 | const star2geometry = new ShapeGeometry(tempshape) 104 | star2.geometry = star2geometry 105 | star4.geometry = star2geometry 106 | star6.geometry = star2geometry 107 | 108 | const subj = new Paths64(); 109 | const clip = new Paths64(); 110 | subj.push(this.geometryToClipperPath(star1geometry)) 111 | clip.push(this.geometryToClipperPath(star2geometry)); 112 | let solution = Clipper.Intersect(subj, clip, FillRule.NonZero); 113 | 114 | solution.forEach(path => { 115 | const points = this.clipperPathToPoints(path) 116 | if (points.length > 0) { 117 | const shape = new Shape(points) 118 | intersect.geometry = new ShapeGeometry(shape) 119 | } 120 | }) 121 | 122 | solution = Clipper.Union(subj, clip, FillRule.NonZero); 123 | 124 | solution.forEach(path => { 125 | const points = this.clipperPathToPoints(path) 126 | if (points.length > 0) { 127 | const shape = new Shape(points) 128 | union.geometry = new ShapeGeometry(shape) 129 | } 130 | }) 131 | 132 | solution = Clipper.Difference(subj, clip, FillRule.NonZero); 133 | 134 | if (solution.length > diffmesh.length) { 135 | solution.forEach(() => { 136 | const diff = new Mesh(undefined, new MeshBasicMaterial({ color: 'white' })) 137 | diff.position.z = 5 138 | diff.position.x = 120 139 | scene.add(diff) 140 | diffmesh.push(diff) 141 | }) 142 | } 143 | 144 | solution.forEach((path, index) => { 145 | const points = this.clipperPathToPoints(path) 146 | if (points.length > 0) { 147 | const shape = new Shape(points) 148 | diffmesh[index].geometry = new ShapeGeometry(shape) 149 | } 150 | }) 151 | 152 | i += 1 153 | }, 1000 / 30) 154 | 155 | 156 | this.dispose = () => { 157 | orbit.dispose() 158 | } 159 | } 160 | 161 | geometryToClipperPath(geometry: BufferGeometry, scale = 1e6): Path64 { 162 | const positions = geometry.getAttribute('position') 163 | const clipperPath = new Path64(); 164 | 165 | for (let i = 0; i < positions.count; i++) { 166 | clipperPath.push(new Point64( 167 | Math.round(positions.getX(i) * scale), 168 | Math.round(positions.getY(i) * scale), 169 | )); 170 | } 171 | //console.warn('{' + clipperPath.map(pt => `${pt.x},${pt.y}`).join(',') + '}') 172 | return clipperPath; 173 | } 174 | 175 | stringToPoints(s: string, scale = 1e6): Array { 176 | if (!s) return [] 177 | 178 | const points: Array = [] 179 | const pairs = s.split(' ') 180 | //console.warn(pairs) 181 | pairs.forEach(pair => { 182 | const point = pair.split(',') 183 | const x = +point[0] 184 | const y = +point[1] 185 | points.push(new Vector2(x, y).divideScalar(scale)) 186 | }) 187 | return points 188 | } 189 | 190 | geometryToShape(geometry: BufferGeometry) { 191 | const positions = geometry.getAttribute('position') 192 | const points: Array = [] 193 | 194 | for (let i = 0; i < positions.count; i++) { 195 | points.push(new Vector2(positions.getX(i), positions.getY(i))) 196 | } 197 | 198 | return new Shape(points) 199 | } 200 | 201 | clipperPathToPoints(path: Path64, scale = 1e6): Array { 202 | const points: Array = [] 203 | 204 | path.forEach(item => { 205 | points.push(new Vector2(item.x / scale, item.y / scale)) 206 | }) 207 | return points 208 | } 209 | 210 | createStarShape(outerRadius = 50, innerRadius = 20, spikes = 5): Shape { 211 | const shape = new Shape(); 212 | 213 | const pi2 = Math.PI * 2; 214 | 215 | let angle = -Math.PI / 2; // Starting angle is pointing up. 216 | const angleIncrement = pi2 / spikes / 2; // Divide by 2 because there are two vertices (inner & outer) per spike. 217 | 218 | 219 | shape.moveTo(Math.cos(angle) * outerRadius, Math.sin(angle) * outerRadius) 220 | for (let i = 0; i < spikes; i++) { 221 | shape.lineTo(Math.cos(angle) * outerRadius, Math.sin(angle) * outerRadius); 222 | angle += angleIncrement; 223 | 224 | shape.lineTo(Math.cos(angle) * innerRadius, Math.sin(angle) * innerRadius); 225 | angle += angleIncrement; 226 | } 227 | 228 | shape.closePath(); 229 | 230 | return shape; 231 | } 232 | 233 | roundedRect(width: number, height: number, radius: number): Shape { 234 | const ctx = new Shape(); 235 | const halfwidth = width / 2 236 | const halfheight = height / 2 237 | ctx.moveTo(-halfwidth + radius, -halfheight); 238 | ctx.lineTo(halfwidth - radius, -halfheight); 239 | ctx.quadraticCurveTo(halfwidth, -halfheight, halfwidth, -halfheight + radius); 240 | ctx.lineTo(halfwidth, halfheight - radius); 241 | ctx.quadraticCurveTo(halfwidth, halfheight, halfwidth - radius, halfheight); 242 | ctx.lineTo(-halfwidth + radius, halfheight); 243 | ctx.quadraticCurveTo(-halfwidth, halfheight, -halfwidth, halfheight - radius); 244 | ctx.lineTo(-halfwidth, -halfheight + radius); 245 | ctx.quadraticCurveTo(-halfwidth, -halfheight, -halfwidth + radius, -halfheight); 246 | ctx.closePath(); 247 | return ctx; 248 | } 249 | 250 | circleShape(radius: number, segments = 32): Shape { 251 | const circle = new CircleGeometry(radius, segments) 252 | const positions = circle.getAttribute('position') 253 | const points: Array = [] 254 | 255 | for (let i = 0; i < positions.count; i++) { 256 | points.push(new Vector2(positions.getX(i), positions.getY(i))) 257 | } 258 | 259 | return new Shape(points) 260 | } 261 | 262 | rectangle(width: number, height: number): Shape { 263 | const ctx = new Shape(); 264 | const halfwidth = width / 2 265 | const halfheight = height / 2 266 | ctx.moveTo(-halfwidth, halfheight); 267 | ctx.lineTo(halfwidth, halfheight); 268 | ctx.lineTo(halfwidth, -halfheight); 269 | ctx.lineTo(-halfwidth, -halfheight); 270 | ctx.closePath(); 271 | return ctx 272 | } 273 | } 274 | -------------------------------------------------------------------------------- /src/app/threejs-app.ts: -------------------------------------------------------------------------------- 1 | import { Camera, PerspectiveCamera, Scene, WebGLRenderer } from "three"; 2 | import { UIRouter } from "./ui-routes"; 3 | 4 | export interface renderState { scene: Scene, camera: Camera, renderer: WebGLRenderer } 5 | 6 | export class ThreeJSApp extends WebGLRenderer { 7 | public camera!: Camera; 8 | 9 | public router = new UIRouter() 10 | 11 | constructor(public scene?: Scene, camera?: Camera) { 12 | super() 13 | 14 | this.router.addEventListener('load', () => { 15 | this.camera.position.set(0, 0, 0) 16 | this.camera.rotation.set(0, 0, 0) 17 | }) 18 | 19 | if (!camera) { 20 | this.camera = new PerspectiveCamera( 21 | 75, 22 | window.innerWidth / window.innerHeight, 23 | 0.1, 24 | 1000 25 | ); 26 | } 27 | else 28 | this.camera = camera 29 | 30 | this.setSize(window.innerWidth, window.innerHeight); 31 | document.body.appendChild(this.domElement); 32 | 33 | this.shadowMap.enabled = true; 34 | 35 | window.addEventListener('resize', () => { 36 | const width = window.innerWidth; 37 | const height = window.innerHeight; 38 | this.setSize(width, height); 39 | 40 | if (this.camera.type == 'PerspectiveCamera') { 41 | const perspective = this.camera as PerspectiveCamera 42 | perspective.aspect = width / height; 43 | perspective.updateProjectionMatrix(); 44 | } 45 | }); 46 | 47 | 48 | const animate = () => { 49 | requestAnimationFrame(animate); 50 | if (!this.scene) return 51 | 52 | const scene = this.scene 53 | 54 | this.render(scene, this.camera); 55 | 56 | }; 57 | 58 | animate() 59 | } 60 | 61 | // short-cut 62 | navigateto(route: string) { 63 | this.router.navigateto(route) 64 | } 65 | 66 | 67 | } 68 | -------------------------------------------------------------------------------- /src/app/ui-routes.ts: -------------------------------------------------------------------------------- 1 | import { EventDispatcher } from "three"; 2 | 3 | interface Route { 4 | [path: string]: () => any 5 | } 6 | 7 | export class UIRouter extends EventDispatcher { 8 | constructor(public routes: Route = {}) { 9 | super() 10 | 11 | let context: any 12 | 13 | // The actual router, get the current URL and generate the corresponding template 14 | const router = () => { 15 | if (context) { 16 | context.dispose() 17 | this.dispatchEvent({ type: 'unload' }) 18 | } 19 | 20 | const url = window.location.hash.slice(1) || "/"; 21 | //try { 22 | console.log('loading', url) 23 | this.dispatchEvent({ type: 'load' }) 24 | context = routes[url]() 25 | //} catch (error) { 26 | // console.error(`Invalid route ${url}`) 27 | //} 28 | }; 29 | 30 | window.addEventListener('load', router); 31 | window.addEventListener('hashchange', router); 32 | } 33 | 34 | add(path: string, example: () => any) { 35 | this.routes[path] = example 36 | } 37 | 38 | navigateto(route: string) { 39 | window.location.href = '#' + route 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IRobot1/clipper2-ts/eefbad501c878c3c28ecd39f7af210ba9b53c937/src/assets/.gitkeep -------------------------------------------------------------------------------- /src/assets/helvetiker_regular.typeface.json: -------------------------------------------------------------------------------- 1 | {"glyphs":{"ο":{"x_min":0,"x_max":712,"ha":815,"o":"m 356 -25 q 96 88 192 -25 q 0 368 0 201 q 92 642 0 533 q 356 761 192 761 q 617 644 517 761 q 712 368 712 533 q 619 91 712 201 q 356 -25 520 -25 m 356 85 q 527 175 465 85 q 583 369 583 255 q 528 562 583 484 q 356 651 466 651 q 189 560 250 651 q 135 369 135 481 q 187 177 135 257 q 356 85 250 85 "},"S":{"x_min":0,"x_max":788,"ha":890,"o":"m 788 291 q 662 54 788 144 q 397 -26 550 -26 q 116 68 226 -26 q 0 337 0 168 l 131 337 q 200 152 131 220 q 384 85 269 85 q 557 129 479 85 q 650 270 650 183 q 490 429 650 379 q 194 513 341 470 q 33 739 33 584 q 142 964 33 881 q 388 1041 242 1041 q 644 957 543 1041 q 756 716 756 867 l 625 716 q 561 874 625 816 q 395 933 497 933 q 243 891 309 933 q 164 759 164 841 q 325 609 164 656 q 625 526 475 568 q 788 291 788 454 "},"¦":{"x_min":343,"x_max":449,"ha":792,"o":"m 449 462 l 343 462 l 343 986 l 449 986 l 449 462 m 449 -242 l 343 -242 l 343 280 l 449 280 l 449 -242 "},"/":{"x_min":183.25,"x_max":608.328125,"ha":792,"o":"m 608 1041 l 266 -129 l 183 -129 l 520 1041 l 608 1041 "},"Τ":{"x_min":-0.4375,"x_max":777.453125,"ha":839,"o":"m 777 893 l 458 893 l 458 0 l 319 0 l 319 892 l 0 892 l 0 1013 l 777 1013 l 777 893 "},"y":{"x_min":0,"x_max":684.78125,"ha":771,"o":"m 684 738 l 388 -83 q 311 -216 356 -167 q 173 -279 252 -279 q 97 -266 133 -279 l 97 -149 q 132 -155 109 -151 q 168 -160 155 -160 q 240 -114 213 -160 q 274 -26 248 -98 l 0 738 l 137 737 l 341 139 l 548 737 l 684 738 "},"Π":{"x_min":0,"x_max":803,"ha":917,"o":"m 803 0 l 667 0 l 667 886 l 140 886 l 140 0 l 0 0 l 0 1012 l 803 1012 l 803 0 "},"ΐ":{"x_min":-111,"x_max":339,"ha":361,"o":"m 339 800 l 229 800 l 229 925 l 339 925 l 339 800 m -1 800 l -111 800 l -111 925 l -1 925 l -1 800 m 284 3 q 233 -10 258 -5 q 182 -15 207 -15 q 85 26 119 -15 q 42 200 42 79 l 42 737 l 167 737 l 168 215 q 172 141 168 157 q 226 101 183 101 q 248 103 239 101 q 284 112 257 104 l 284 3 m 302 1040 l 113 819 l 30 819 l 165 1040 l 302 1040 "},"g":{"x_min":0,"x_max":686,"ha":838,"o":"m 686 34 q 586 -213 686 -121 q 331 -306 487 -306 q 131 -252 216 -306 q 31 -84 31 -190 l 155 -84 q 228 -174 166 -138 q 345 -207 284 -207 q 514 -109 454 -207 q 564 89 564 -27 q 461 6 521 36 q 335 -23 401 -23 q 88 100 184 -23 q 0 370 0 215 q 87 634 0 522 q 330 758 183 758 q 457 728 398 758 q 564 644 515 699 l 564 737 l 686 737 l 686 34 m 582 367 q 529 560 582 481 q 358 652 468 652 q 189 561 250 652 q 135 369 135 482 q 189 176 135 255 q 361 85 251 85 q 529 176 468 85 q 582 367 582 255 "},"²":{"x_min":0,"x_max":442,"ha":539,"o":"m 442 383 l 0 383 q 91 566 0 492 q 260 668 176 617 q 354 798 354 727 q 315 875 354 845 q 227 905 277 905 q 136 869 173 905 q 99 761 99 833 l 14 761 q 82 922 14 864 q 232 974 141 974 q 379 926 316 974 q 442 797 442 878 q 351 635 442 704 q 183 539 321 611 q 92 455 92 491 l 442 455 l 442 383 "},"–":{"x_min":0,"x_max":705.5625,"ha":803,"o":"m 705 334 l 0 334 l 0 410 l 705 410 l 705 334 "},"Κ":{"x_min":0,"x_max":819.5625,"ha":893,"o":"m 819 0 l 650 0 l 294 509 l 139 356 l 139 0 l 0 0 l 0 1013 l 139 1013 l 139 526 l 626 1013 l 809 1013 l 395 600 l 819 0 "},"ƒ":{"x_min":-46.265625,"x_max":392,"ha":513,"o":"m 392 651 l 259 651 l 79 -279 l -46 -278 l 134 651 l 14 651 l 14 751 l 135 751 q 151 948 135 900 q 304 1041 185 1041 q 334 1040 319 1041 q 392 1034 348 1039 l 392 922 q 337 931 360 931 q 271 883 287 931 q 260 793 260 853 l 260 751 l 392 751 l 392 651 "},"e":{"x_min":0,"x_max":714,"ha":813,"o":"m 714 326 l 140 326 q 200 157 140 227 q 359 87 260 87 q 488 130 431 87 q 561 245 545 174 l 697 245 q 577 48 670 123 q 358 -26 484 -26 q 97 85 195 -26 q 0 363 0 197 q 94 642 0 529 q 358 765 195 765 q 626 627 529 765 q 714 326 714 503 m 576 429 q 507 583 564 522 q 355 650 445 650 q 206 583 266 650 q 140 429 152 522 l 576 429 "},"ό":{"x_min":0,"x_max":712,"ha":815,"o":"m 356 -25 q 94 91 194 -25 q 0 368 0 202 q 92 642 0 533 q 356 761 192 761 q 617 644 517 761 q 712 368 712 533 q 619 91 712 201 q 356 -25 520 -25 m 356 85 q 527 175 465 85 q 583 369 583 255 q 528 562 583 484 q 356 651 466 651 q 189 560 250 651 q 135 369 135 481 q 187 177 135 257 q 356 85 250 85 m 576 1040 l 387 819 l 303 819 l 438 1040 l 576 1040 "},"J":{"x_min":0,"x_max":588,"ha":699,"o":"m 588 279 q 287 -26 588 -26 q 58 73 126 -26 q 0 327 0 158 l 133 327 q 160 172 133 227 q 288 96 198 96 q 426 171 391 96 q 449 336 449 219 l 449 1013 l 588 1013 l 588 279 "},"»":{"x_min":-1,"x_max":503,"ha":601,"o":"m 503 302 l 280 136 l 281 256 l 429 373 l 281 486 l 280 608 l 503 440 l 503 302 m 221 302 l 0 136 l 0 255 l 145 372 l 0 486 l -1 608 l 221 440 l 221 302 "},"©":{"x_min":-3,"x_max":1008,"ha":1106,"o":"m 502 -7 q 123 151 263 -7 q -3 501 -3 294 q 123 851 -3 706 q 502 1011 263 1011 q 881 851 739 1011 q 1008 501 1008 708 q 883 151 1008 292 q 502 -7 744 -7 m 502 60 q 830 197 709 60 q 940 501 940 322 q 831 805 940 681 q 502 944 709 944 q 174 805 296 944 q 65 501 65 680 q 173 197 65 320 q 502 60 294 60 m 741 394 q 661 246 731 302 q 496 190 591 190 q 294 285 369 190 q 228 497 228 370 q 295 714 228 625 q 499 813 370 813 q 656 762 588 813 q 733 625 724 711 l 634 625 q 589 704 629 673 q 498 735 550 735 q 377 666 421 735 q 334 504 334 597 q 374 340 334 408 q 490 272 415 272 q 589 304 549 272 q 638 394 628 337 l 741 394 "},"ώ":{"x_min":0,"x_max":922,"ha":1030,"o":"m 687 1040 l 498 819 l 415 819 l 549 1040 l 687 1040 m 922 339 q 856 97 922 203 q 650 -26 780 -26 q 538 9 587 -26 q 461 103 489 44 q 387 12 436 46 q 277 -22 339 -22 q 69 97 147 -22 q 0 338 0 202 q 45 551 0 444 q 161 737 84 643 l 302 737 q 175 552 219 647 q 124 336 124 446 q 155 179 124 248 q 275 88 197 88 q 375 163 341 88 q 400 294 400 219 l 400 572 l 524 572 l 524 294 q 561 135 524 192 q 643 88 591 88 q 762 182 719 88 q 797 341 797 257 q 745 555 797 450 q 619 737 705 637 l 760 737 q 874 551 835 640 q 922 339 922 444 "},"^":{"x_min":193.0625,"x_max":598.609375,"ha":792,"o":"m 598 772 l 515 772 l 395 931 l 277 772 l 193 772 l 326 1013 l 462 1013 l 598 772 "},"«":{"x_min":0,"x_max":507.203125,"ha":604,"o":"m 506 136 l 284 302 l 284 440 l 506 608 l 507 485 l 360 371 l 506 255 l 506 136 m 222 136 l 0 302 l 0 440 l 222 608 l 221 486 l 73 373 l 222 256 l 222 136 "},"D":{"x_min":0,"x_max":828,"ha":935,"o":"m 389 1013 q 714 867 593 1013 q 828 521 828 729 q 712 161 828 309 q 382 0 587 0 l 0 0 l 0 1013 l 389 1013 m 376 124 q 607 247 523 124 q 681 510 681 355 q 607 771 681 662 q 376 896 522 896 l 139 896 l 139 124 l 376 124 "},"∙":{"x_min":0,"x_max":142,"ha":239,"o":"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 "},"ÿ":{"x_min":0,"x_max":47,"ha":125,"o":"m 47 3 q 37 -7 47 -7 q 28 0 30 -7 q 39 -4 32 -4 q 45 3 45 -1 l 37 0 q 28 9 28 0 q 39 19 28 19 l 47 16 l 47 19 l 47 3 m 37 1 q 44 8 44 1 q 37 16 44 16 q 30 8 30 16 q 37 1 30 1 m 26 1 l 23 22 l 14 0 l 3 22 l 3 3 l 0 25 l 13 1 l 22 25 l 26 1 "},"w":{"x_min":0,"x_max":1009.71875,"ha":1100,"o":"m 1009 738 l 783 0 l 658 0 l 501 567 l 345 0 l 222 0 l 0 738 l 130 738 l 284 174 l 432 737 l 576 738 l 721 173 l 881 737 l 1009 738 "},"$":{"x_min":0,"x_max":700,"ha":793,"o":"m 664 717 l 542 717 q 490 825 531 785 q 381 872 450 865 l 381 551 q 620 446 540 522 q 700 241 700 370 q 618 45 700 116 q 381 -25 536 -25 l 381 -152 l 307 -152 l 307 -25 q 81 62 162 -25 q 0 297 0 149 l 124 297 q 169 146 124 204 q 307 81 215 89 l 307 441 q 80 536 148 469 q 13 725 13 603 q 96 910 13 839 q 307 982 180 982 l 307 1077 l 381 1077 l 381 982 q 574 917 494 982 q 664 717 664 845 m 307 565 l 307 872 q 187 831 233 872 q 142 724 142 791 q 180 618 142 656 q 307 565 218 580 m 381 76 q 562 237 562 96 q 517 361 562 313 q 381 423 472 409 l 381 76 "},"\\":{"x_min":-0.015625,"x_max":425.0625,"ha":522,"o":"m 425 -129 l 337 -129 l 0 1041 l 83 1041 l 425 -129 "},"µ":{"x_min":0,"x_max":697.21875,"ha":747,"o":"m 697 -4 q 629 -14 658 -14 q 498 97 513 -14 q 422 9 470 41 q 313 -23 374 -23 q 207 4 258 -23 q 119 81 156 32 l 119 -278 l 0 -278 l 0 738 l 124 738 l 124 343 q 165 173 124 246 q 308 83 216 83 q 452 178 402 83 q 493 359 493 255 l 493 738 l 617 738 l 617 214 q 623 136 617 160 q 673 92 637 92 q 697 96 684 92 l 697 -4 "},"Ι":{"x_min":42,"x_max":181,"ha":297,"o":"m 181 0 l 42 0 l 42 1013 l 181 1013 l 181 0 "},"Ύ":{"x_min":0,"x_max":1144.5,"ha":1214,"o":"m 1144 1012 l 807 416 l 807 0 l 667 0 l 667 416 l 325 1012 l 465 1012 l 736 533 l 1004 1012 l 1144 1012 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},"’":{"x_min":0,"x_max":139,"ha":236,"o":"m 139 851 q 102 737 139 784 q 0 669 65 690 l 0 734 q 59 787 42 741 q 72 873 72 821 l 0 873 l 0 1013 l 139 1013 l 139 851 "},"Ν":{"x_min":0,"x_max":801,"ha":915,"o":"m 801 0 l 651 0 l 131 822 l 131 0 l 0 0 l 0 1013 l 151 1013 l 670 191 l 670 1013 l 801 1013 l 801 0 "},"-":{"x_min":8.71875,"x_max":350.390625,"ha":478,"o":"m 350 317 l 8 317 l 8 428 l 350 428 l 350 317 "},"Q":{"x_min":0,"x_max":968,"ha":1072,"o":"m 954 5 l 887 -79 l 744 35 q 622 -11 687 2 q 483 -26 556 -26 q 127 130 262 -26 q 0 504 0 279 q 127 880 0 728 q 484 1041 262 1041 q 841 884 708 1041 q 968 507 968 735 q 933 293 968 398 q 832 104 899 188 l 954 5 m 723 191 q 802 330 777 248 q 828 499 828 412 q 744 790 828 673 q 483 922 650 922 q 228 791 322 922 q 142 505 142 673 q 227 221 142 337 q 487 91 323 91 q 632 123 566 91 l 520 215 l 587 301 l 723 191 "},"ς":{"x_min":1,"x_max":676.28125,"ha":740,"o":"m 676 460 l 551 460 q 498 595 542 546 q 365 651 448 651 q 199 578 263 651 q 136 401 136 505 q 266 178 136 241 q 508 106 387 142 q 640 -50 640 62 q 625 -158 640 -105 q 583 -278 611 -211 l 465 -278 q 498 -182 490 -211 q 515 -80 515 -126 q 381 12 515 -15 q 134 91 197 51 q 1 388 1 179 q 100 651 1 542 q 354 761 199 761 q 587 680 498 761 q 676 460 676 599 "},"M":{"x_min":0,"x_max":954,"ha":1067,"o":"m 954 0 l 819 0 l 819 869 l 537 0 l 405 0 l 128 866 l 128 0 l 0 0 l 0 1013 l 200 1013 l 472 160 l 757 1013 l 954 1013 l 954 0 "},"Ψ":{"x_min":0,"x_max":1006,"ha":1094,"o":"m 1006 678 q 914 319 1006 429 q 571 200 814 200 l 571 0 l 433 0 l 433 200 q 92 319 194 200 q 0 678 0 429 l 0 1013 l 139 1013 l 139 679 q 191 417 139 492 q 433 326 255 326 l 433 1013 l 571 1013 l 571 326 l 580 326 q 813 423 747 326 q 868 679 868 502 l 868 1013 l 1006 1013 l 1006 678 "},"C":{"x_min":0,"x_max":886,"ha":944,"o":"m 886 379 q 760 87 886 201 q 455 -26 634 -26 q 112 136 236 -26 q 0 509 0 283 q 118 882 0 737 q 469 1041 245 1041 q 748 955 630 1041 q 879 708 879 859 l 745 708 q 649 862 724 805 q 473 920 573 920 q 219 791 312 920 q 136 509 136 675 q 217 229 136 344 q 470 99 311 99 q 672 179 591 99 q 753 379 753 259 l 886 379 "},"!":{"x_min":0,"x_max":138,"ha":236,"o":"m 138 684 q 116 409 138 629 q 105 244 105 299 l 33 244 q 16 465 33 313 q 0 684 0 616 l 0 1013 l 138 1013 l 138 684 m 138 0 l 0 0 l 0 151 l 138 151 l 138 0 "},"{":{"x_min":0,"x_max":480.5625,"ha":578,"o":"m 480 -286 q 237 -213 303 -286 q 187 -45 187 -159 q 194 48 187 -15 q 201 141 201 112 q 164 264 201 225 q 0 314 118 314 l 0 417 q 164 471 119 417 q 201 605 201 514 q 199 665 201 644 q 193 772 193 769 q 241 941 193 887 q 480 1015 308 1015 l 480 915 q 336 866 375 915 q 306 742 306 828 q 310 662 306 717 q 314 577 314 606 q 288 452 314 500 q 176 365 256 391 q 289 275 257 337 q 314 143 314 226 q 313 84 314 107 q 310 -11 310 -5 q 339 -131 310 -94 q 480 -182 377 -182 l 480 -286 "},"X":{"x_min":-0.015625,"x_max":854.15625,"ha":940,"o":"m 854 0 l 683 0 l 423 409 l 166 0 l 0 0 l 347 519 l 18 1013 l 186 1013 l 428 637 l 675 1013 l 836 1013 l 504 520 l 854 0 "},"#":{"x_min":0,"x_max":963.890625,"ha":1061,"o":"m 963 690 l 927 590 l 719 590 l 655 410 l 876 410 l 840 310 l 618 310 l 508 -3 l 393 -2 l 506 309 l 329 310 l 215 -2 l 102 -3 l 212 310 l 0 310 l 36 410 l 248 409 l 312 590 l 86 590 l 120 690 l 347 690 l 459 1006 l 573 1006 l 462 690 l 640 690 l 751 1006 l 865 1006 l 754 690 l 963 690 m 606 590 l 425 590 l 362 410 l 543 410 l 606 590 "},"ι":{"x_min":42,"x_max":284,"ha":361,"o":"m 284 3 q 233 -10 258 -5 q 182 -15 207 -15 q 85 26 119 -15 q 42 200 42 79 l 42 738 l 167 738 l 168 215 q 172 141 168 157 q 226 101 183 101 q 248 103 239 101 q 284 112 257 104 l 284 3 "},"Ά":{"x_min":0,"x_max":906.953125,"ha":982,"o":"m 283 1040 l 88 799 l 5 799 l 145 1040 l 283 1040 m 906 0 l 756 0 l 650 303 l 251 303 l 143 0 l 0 0 l 376 1012 l 529 1012 l 906 0 m 609 421 l 452 866 l 293 421 l 609 421 "},")":{"x_min":0,"x_max":318,"ha":415,"o":"m 318 365 q 257 25 318 191 q 87 -290 197 -141 l 0 -290 q 140 21 93 -128 q 193 360 193 189 q 141 704 193 537 q 0 1024 97 850 l 87 1024 q 257 706 197 871 q 318 365 318 542 "},"ε":{"x_min":0,"x_max":634.71875,"ha":714,"o":"m 634 234 q 527 38 634 110 q 300 -25 433 -25 q 98 29 183 -25 q 0 204 0 93 q 37 314 0 265 q 128 390 67 353 q 56 460 82 419 q 26 555 26 505 q 114 712 26 654 q 295 763 191 763 q 499 700 416 763 q 589 515 589 631 l 478 515 q 419 618 464 580 q 307 657 374 657 q 207 630 253 657 q 151 547 151 598 q 238 445 151 469 q 389 434 280 434 l 389 331 l 349 331 q 206 315 255 331 q 125 210 125 287 q 183 107 125 145 q 302 76 233 76 q 436 117 379 76 q 509 234 493 159 l 634 234 "},"Δ":{"x_min":0,"x_max":952.78125,"ha":1028,"o":"m 952 0 l 0 0 l 400 1013 l 551 1013 l 952 0 m 762 124 l 476 867 l 187 124 l 762 124 "},"}":{"x_min":0,"x_max":481,"ha":578,"o":"m 481 314 q 318 262 364 314 q 282 136 282 222 q 284 65 282 97 q 293 -58 293 -48 q 241 -217 293 -166 q 0 -286 174 -286 l 0 -182 q 143 -130 105 -182 q 171 -2 171 -93 q 168 81 171 22 q 165 144 165 140 q 188 275 165 229 q 306 365 220 339 q 191 455 224 391 q 165 588 165 505 q 168 681 165 624 q 171 742 171 737 q 141 865 171 827 q 0 915 102 915 l 0 1015 q 243 942 176 1015 q 293 773 293 888 q 287 675 293 741 q 282 590 282 608 q 318 466 282 505 q 481 417 364 417 l 481 314 "},"‰":{"x_min":-3,"x_max":1672,"ha":1821,"o":"m 846 0 q 664 76 732 0 q 603 244 603 145 q 662 412 603 344 q 846 489 729 489 q 1027 412 959 489 q 1089 244 1089 343 q 1029 76 1089 144 q 846 0 962 0 m 845 103 q 945 143 910 103 q 981 243 981 184 q 947 340 981 301 q 845 385 910 385 q 745 342 782 385 q 709 243 709 300 q 742 147 709 186 q 845 103 781 103 m 888 986 l 284 -25 l 199 -25 l 803 986 l 888 986 m 241 468 q 58 545 126 468 q -3 715 -3 615 q 56 881 -3 813 q 238 958 124 958 q 421 881 353 958 q 483 712 483 813 q 423 544 483 612 q 241 468 356 468 m 241 855 q 137 811 175 855 q 100 710 100 768 q 136 612 100 653 q 240 572 172 572 q 344 614 306 572 q 382 713 382 656 q 347 810 382 771 q 241 855 308 855 m 1428 0 q 1246 76 1314 0 q 1185 244 1185 145 q 1244 412 1185 344 q 1428 489 1311 489 q 1610 412 1542 489 q 1672 244 1672 343 q 1612 76 1672 144 q 1428 0 1545 0 m 1427 103 q 1528 143 1492 103 q 1564 243 1564 184 q 1530 340 1564 301 q 1427 385 1492 385 q 1327 342 1364 385 q 1291 243 1291 300 q 1324 147 1291 186 q 1427 103 1363 103 "},"a":{"x_min":0,"x_max":698.609375,"ha":794,"o":"m 698 0 q 661 -12 679 -7 q 615 -17 643 -17 q 536 12 564 -17 q 500 96 508 41 q 384 6 456 37 q 236 -25 312 -25 q 65 31 130 -25 q 0 194 0 88 q 118 390 0 334 q 328 435 180 420 q 488 483 476 451 q 495 523 495 504 q 442 619 495 584 q 325 654 389 654 q 209 617 257 654 q 152 513 161 580 l 33 513 q 123 705 33 633 q 332 772 207 772 q 528 712 448 772 q 617 531 617 645 l 617 163 q 624 108 617 126 q 664 90 632 90 l 698 94 l 698 0 m 491 262 l 491 372 q 272 329 350 347 q 128 201 128 294 q 166 113 128 144 q 264 83 205 83 q 414 130 346 83 q 491 262 491 183 "},"—":{"x_min":0,"x_max":941.671875,"ha":1039,"o":"m 941 334 l 0 334 l 0 410 l 941 410 l 941 334 "},"=":{"x_min":8.71875,"x_max":780.953125,"ha":792,"o":"m 780 510 l 8 510 l 8 606 l 780 606 l 780 510 m 780 235 l 8 235 l 8 332 l 780 332 l 780 235 "},"N":{"x_min":0,"x_max":801,"ha":914,"o":"m 801 0 l 651 0 l 131 823 l 131 0 l 0 0 l 0 1013 l 151 1013 l 670 193 l 670 1013 l 801 1013 l 801 0 "},"ρ":{"x_min":0,"x_max":712,"ha":797,"o":"m 712 369 q 620 94 712 207 q 362 -26 521 -26 q 230 2 292 -26 q 119 83 167 30 l 119 -278 l 0 -278 l 0 362 q 91 643 0 531 q 355 764 190 764 q 617 647 517 764 q 712 369 712 536 m 583 366 q 530 559 583 480 q 359 651 469 651 q 190 562 252 651 q 135 370 135 483 q 189 176 135 257 q 359 85 250 85 q 528 175 466 85 q 583 366 583 254 "},"2":{"x_min":59,"x_max":731,"ha":792,"o":"m 731 0 l 59 0 q 197 314 59 188 q 457 487 199 315 q 598 691 598 580 q 543 819 598 772 q 411 867 488 867 q 272 811 328 867 q 209 630 209 747 l 81 630 q 182 901 81 805 q 408 986 271 986 q 629 909 536 986 q 731 694 731 826 q 613 449 731 541 q 378 316 495 383 q 201 122 235 234 l 731 122 l 731 0 "},"¯":{"x_min":0,"x_max":941.671875,"ha":938,"o":"m 941 1033 l 0 1033 l 0 1109 l 941 1109 l 941 1033 "},"Z":{"x_min":0,"x_max":779,"ha":849,"o":"m 779 0 l 0 0 l 0 113 l 621 896 l 40 896 l 40 1013 l 779 1013 l 778 887 l 171 124 l 779 124 l 779 0 "},"u":{"x_min":0,"x_max":617,"ha":729,"o":"m 617 0 l 499 0 l 499 110 q 391 10 460 45 q 246 -25 322 -25 q 61 58 127 -25 q 0 258 0 136 l 0 738 l 125 738 l 125 284 q 156 148 125 202 q 273 82 197 82 q 433 165 369 82 q 493 340 493 243 l 493 738 l 617 738 l 617 0 "},"k":{"x_min":0,"x_max":612.484375,"ha":697,"o":"m 612 738 l 338 465 l 608 0 l 469 0 l 251 382 l 121 251 l 121 0 l 0 0 l 0 1013 l 121 1013 l 121 402 l 456 738 l 612 738 "},"Η":{"x_min":0,"x_max":803,"ha":917,"o":"m 803 0 l 667 0 l 667 475 l 140 475 l 140 0 l 0 0 l 0 1013 l 140 1013 l 140 599 l 667 599 l 667 1013 l 803 1013 l 803 0 "},"Α":{"x_min":0,"x_max":906.953125,"ha":985,"o":"m 906 0 l 756 0 l 650 303 l 251 303 l 143 0 l 0 0 l 376 1013 l 529 1013 l 906 0 m 609 421 l 452 866 l 293 421 l 609 421 "},"s":{"x_min":0,"x_max":604,"ha":697,"o":"m 604 217 q 501 36 604 104 q 292 -23 411 -23 q 86 43 166 -23 q 0 238 0 114 l 121 237 q 175 122 121 164 q 300 85 223 85 q 415 112 363 85 q 479 207 479 147 q 361 309 479 276 q 140 372 141 370 q 21 544 21 426 q 111 708 21 647 q 298 761 190 761 q 492 705 413 761 q 583 531 583 643 l 462 531 q 412 625 462 594 q 298 657 363 657 q 199 636 242 657 q 143 558 143 608 q 262 454 143 486 q 484 394 479 397 q 604 217 604 341 "},"B":{"x_min":0,"x_max":778,"ha":876,"o":"m 580 546 q 724 469 670 535 q 778 311 778 403 q 673 83 778 171 q 432 0 575 0 l 0 0 l 0 1013 l 411 1013 q 629 957 541 1013 q 732 768 732 892 q 691 633 732 693 q 580 546 650 572 m 393 899 l 139 899 l 139 588 l 379 588 q 521 624 462 588 q 592 744 592 667 q 531 859 592 819 q 393 899 471 899 m 419 124 q 566 169 504 124 q 635 303 635 219 q 559 436 635 389 q 402 477 494 477 l 139 477 l 139 124 l 419 124 "},"…":{"x_min":0,"x_max":614,"ha":708,"o":"m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 m 378 0 l 236 0 l 236 151 l 378 151 l 378 0 m 614 0 l 472 0 l 472 151 l 614 151 l 614 0 "},"?":{"x_min":0,"x_max":607,"ha":704,"o":"m 607 777 q 543 599 607 674 q 422 474 482 537 q 357 272 357 391 l 236 272 q 297 487 236 395 q 411 619 298 490 q 474 762 474 691 q 422 885 474 838 q 301 933 371 933 q 179 880 228 933 q 124 706 124 819 l 0 706 q 94 963 0 872 q 302 1044 177 1044 q 511 973 423 1044 q 607 777 607 895 m 370 0 l 230 0 l 230 151 l 370 151 l 370 0 "},"H":{"x_min":0,"x_max":803,"ha":915,"o":"m 803 0 l 667 0 l 667 475 l 140 475 l 140 0 l 0 0 l 0 1013 l 140 1013 l 140 599 l 667 599 l 667 1013 l 803 1013 l 803 0 "},"ν":{"x_min":0,"x_max":675,"ha":761,"o":"m 675 738 l 404 0 l 272 0 l 0 738 l 133 738 l 340 147 l 541 738 l 675 738 "},"c":{"x_min":1,"x_max":701.390625,"ha":775,"o":"m 701 264 q 584 53 681 133 q 353 -26 487 -26 q 91 91 188 -26 q 1 370 1 201 q 92 645 1 537 q 353 761 190 761 q 572 688 479 761 q 690 493 666 615 l 556 493 q 487 606 545 562 q 356 650 428 650 q 186 563 246 650 q 134 372 134 487 q 188 179 134 258 q 359 88 250 88 q 492 136 437 88 q 566 264 548 185 l 701 264 "},"¶":{"x_min":0,"x_max":566.671875,"ha":678,"o":"m 21 892 l 52 892 l 98 761 l 145 892 l 176 892 l 178 741 l 157 741 l 157 867 l 108 741 l 88 741 l 40 871 l 40 741 l 21 741 l 21 892 m 308 854 l 308 731 q 252 691 308 691 q 227 691 240 691 q 207 696 213 695 l 207 712 l 253 706 q 288 733 288 706 l 288 763 q 244 741 279 741 q 193 797 193 741 q 261 860 193 860 q 287 860 273 860 q 308 854 302 855 m 288 842 l 263 843 q 213 796 213 843 q 248 756 213 756 q 288 796 288 756 l 288 842 m 566 988 l 502 988 l 502 -1 l 439 -1 l 439 988 l 317 988 l 317 -1 l 252 -1 l 252 602 q 81 653 155 602 q 0 805 0 711 q 101 989 0 918 q 309 1053 194 1053 l 566 1053 l 566 988 "},"β":{"x_min":0,"x_max":660,"ha":745,"o":"m 471 550 q 610 450 561 522 q 660 280 660 378 q 578 64 660 151 q 367 -22 497 -22 q 239 5 299 -22 q 126 82 178 32 l 126 -278 l 0 -278 l 0 593 q 54 903 0 801 q 318 1042 127 1042 q 519 964 436 1042 q 603 771 603 887 q 567 644 603 701 q 471 550 532 586 m 337 79 q 476 138 418 79 q 535 279 535 198 q 427 437 535 386 q 226 477 344 477 l 226 583 q 398 620 329 583 q 486 762 486 668 q 435 884 486 833 q 312 935 384 935 q 169 861 219 935 q 126 698 126 797 l 126 362 q 170 169 126 242 q 337 79 224 79 "},"Μ":{"x_min":0,"x_max":954,"ha":1068,"o":"m 954 0 l 819 0 l 819 868 l 537 0 l 405 0 l 128 865 l 128 0 l 0 0 l 0 1013 l 199 1013 l 472 158 l 758 1013 l 954 1013 l 954 0 "},"Ό":{"x_min":0.109375,"x_max":1120,"ha":1217,"o":"m 1120 505 q 994 132 1120 282 q 642 -29 861 -29 q 290 130 422 -29 q 167 505 167 280 q 294 883 167 730 q 650 1046 430 1046 q 999 882 868 1046 q 1120 505 1120 730 m 977 504 q 896 784 977 669 q 644 915 804 915 q 391 785 484 915 q 307 504 307 669 q 391 224 307 339 q 644 95 486 95 q 894 224 803 95 q 977 504 977 339 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},"Ή":{"x_min":0,"x_max":1158,"ha":1275,"o":"m 1158 0 l 1022 0 l 1022 475 l 496 475 l 496 0 l 356 0 l 356 1012 l 496 1012 l 496 599 l 1022 599 l 1022 1012 l 1158 1012 l 1158 0 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},"•":{"x_min":0,"x_max":663.890625,"ha":775,"o":"m 663 529 q 566 293 663 391 q 331 196 469 196 q 97 294 194 196 q 0 529 0 393 q 96 763 0 665 q 331 861 193 861 q 566 763 469 861 q 663 529 663 665 "},"¥":{"x_min":0.1875,"x_max":819.546875,"ha":886,"o":"m 563 561 l 697 561 l 696 487 l 520 487 l 482 416 l 482 380 l 697 380 l 695 308 l 482 308 l 482 0 l 342 0 l 342 308 l 125 308 l 125 380 l 342 380 l 342 417 l 303 487 l 125 487 l 125 561 l 258 561 l 0 1013 l 140 1013 l 411 533 l 679 1013 l 819 1013 l 563 561 "},"(":{"x_min":0,"x_max":318.0625,"ha":415,"o":"m 318 -290 l 230 -290 q 61 23 122 -142 q 0 365 0 190 q 62 712 0 540 q 230 1024 119 869 l 318 1024 q 175 705 219 853 q 125 360 125 542 q 176 22 125 187 q 318 -290 223 -127 "},"U":{"x_min":0,"x_max":796,"ha":904,"o":"m 796 393 q 681 93 796 212 q 386 -25 566 -25 q 101 95 208 -25 q 0 393 0 211 l 0 1013 l 138 1013 l 138 391 q 204 191 138 270 q 394 107 276 107 q 586 191 512 107 q 656 391 656 270 l 656 1013 l 796 1013 l 796 393 "},"γ":{"x_min":0.5,"x_max":744.953125,"ha":822,"o":"m 744 737 l 463 54 l 463 -278 l 338 -278 l 338 54 l 154 495 q 104 597 124 569 q 13 651 67 651 l 0 651 l 0 751 l 39 753 q 168 711 121 753 q 242 594 207 676 l 403 208 l 617 737 l 744 737 "},"α":{"x_min":0,"x_max":765.5625,"ha":809,"o":"m 765 -4 q 698 -14 726 -14 q 564 97 586 -14 q 466 7 525 40 q 337 -26 407 -26 q 88 98 186 -26 q 0 369 0 212 q 88 637 0 525 q 337 760 184 760 q 465 728 407 760 q 563 637 524 696 l 563 739 l 685 739 l 685 222 q 693 141 685 168 q 748 94 708 94 q 765 96 760 94 l 765 -4 m 584 371 q 531 562 584 485 q 360 653 470 653 q 192 566 254 653 q 135 379 135 489 q 186 181 135 261 q 358 84 247 84 q 528 176 465 84 q 584 371 584 260 "},"F":{"x_min":0,"x_max":683.328125,"ha":717,"o":"m 683 888 l 140 888 l 140 583 l 613 583 l 613 458 l 140 458 l 140 0 l 0 0 l 0 1013 l 683 1013 l 683 888 "},"­":{"x_min":0,"x_max":705.5625,"ha":803,"o":"m 705 334 l 0 334 l 0 410 l 705 410 l 705 334 "},":":{"x_min":0,"x_max":142,"ha":239,"o":"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 "},"Χ":{"x_min":0,"x_max":854.171875,"ha":935,"o":"m 854 0 l 683 0 l 423 409 l 166 0 l 0 0 l 347 519 l 18 1013 l 186 1013 l 427 637 l 675 1013 l 836 1013 l 504 521 l 854 0 "},"*":{"x_min":116,"x_max":674,"ha":792,"o":"m 674 768 l 475 713 l 610 544 l 517 477 l 394 652 l 272 478 l 178 544 l 314 713 l 116 766 l 153 876 l 341 812 l 342 1013 l 446 1013 l 446 811 l 635 874 l 674 768 "},"†":{"x_min":0,"x_max":777,"ha":835,"o":"m 458 804 l 777 804 l 777 683 l 458 683 l 458 0 l 319 0 l 319 681 l 0 683 l 0 804 l 319 804 l 319 1015 l 458 1013 l 458 804 "},"°":{"x_min":0,"x_max":347,"ha":444,"o":"m 173 802 q 43 856 91 802 q 0 977 0 905 q 45 1101 0 1049 q 173 1153 90 1153 q 303 1098 255 1153 q 347 977 347 1049 q 303 856 347 905 q 173 802 256 802 m 173 884 q 238 910 214 884 q 262 973 262 937 q 239 1038 262 1012 q 173 1064 217 1064 q 108 1037 132 1064 q 85 973 85 1010 q 108 910 85 937 q 173 884 132 884 "},"V":{"x_min":0,"x_max":862.71875,"ha":940,"o":"m 862 1013 l 505 0 l 361 0 l 0 1013 l 143 1013 l 434 165 l 718 1012 l 862 1013 "},"Ξ":{"x_min":0,"x_max":734.71875,"ha":763,"o":"m 723 889 l 9 889 l 9 1013 l 723 1013 l 723 889 m 673 463 l 61 463 l 61 589 l 673 589 l 673 463 m 734 0 l 0 0 l 0 124 l 734 124 l 734 0 "}," ":{"x_min":0,"x_max":0,"ha":853},"Ϋ":{"x_min":0.328125,"x_max":819.515625,"ha":889,"o":"m 588 1046 l 460 1046 l 460 1189 l 588 1189 l 588 1046 m 360 1046 l 232 1046 l 232 1189 l 360 1189 l 360 1046 m 819 1012 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1012 l 140 1012 l 411 533 l 679 1012 l 819 1012 "},"0":{"x_min":73,"x_max":715,"ha":792,"o":"m 394 -29 q 153 129 242 -29 q 73 479 73 272 q 152 829 73 687 q 394 989 241 989 q 634 829 545 989 q 715 479 715 684 q 635 129 715 270 q 394 -29 546 -29 m 394 89 q 546 211 489 89 q 598 479 598 322 q 548 748 598 640 q 394 871 491 871 q 241 748 298 871 q 190 479 190 637 q 239 211 190 319 q 394 89 296 89 "},"”":{"x_min":0,"x_max":347,"ha":454,"o":"m 139 851 q 102 737 139 784 q 0 669 65 690 l 0 734 q 59 787 42 741 q 72 873 72 821 l 0 873 l 0 1013 l 139 1013 l 139 851 m 347 851 q 310 737 347 784 q 208 669 273 690 l 208 734 q 267 787 250 741 q 280 873 280 821 l 208 873 l 208 1013 l 347 1013 l 347 851 "},"@":{"x_min":0,"x_max":1260,"ha":1357,"o":"m 1098 -45 q 877 -160 1001 -117 q 633 -203 752 -203 q 155 -29 327 -203 q 0 360 0 127 q 176 802 0 616 q 687 1008 372 1008 q 1123 854 969 1008 q 1260 517 1260 718 q 1155 216 1260 341 q 868 82 1044 82 q 772 106 801 82 q 737 202 737 135 q 647 113 700 144 q 527 82 594 82 q 367 147 420 82 q 314 312 314 212 q 401 565 314 452 q 639 690 498 690 q 810 588 760 690 l 849 668 l 938 668 q 877 441 900 532 q 833 226 833 268 q 853 182 833 198 q 902 167 873 167 q 1088 272 1012 167 q 1159 512 1159 372 q 1051 793 1159 681 q 687 925 925 925 q 248 747 415 925 q 97 361 97 586 q 226 26 97 159 q 627 -122 370 -122 q 856 -87 737 -122 q 1061 8 976 -53 l 1098 -45 m 786 488 q 738 580 777 545 q 643 615 700 615 q 483 517 548 615 q 425 322 425 430 q 457 203 425 250 q 552 156 490 156 q 722 273 665 156 q 786 488 738 309 "},"Ί":{"x_min":0,"x_max":499,"ha":613,"o":"m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 m 499 0 l 360 0 l 360 1012 l 499 1012 l 499 0 "},"i":{"x_min":14,"x_max":136,"ha":275,"o":"m 136 873 l 14 873 l 14 1013 l 136 1013 l 136 873 m 136 0 l 14 0 l 14 737 l 136 737 l 136 0 "},"Β":{"x_min":0,"x_max":778,"ha":877,"o":"m 580 545 q 724 468 671 534 q 778 310 778 402 q 673 83 778 170 q 432 0 575 0 l 0 0 l 0 1013 l 411 1013 q 629 957 541 1013 q 732 768 732 891 q 691 632 732 692 q 580 545 650 571 m 393 899 l 139 899 l 139 587 l 379 587 q 521 623 462 587 q 592 744 592 666 q 531 859 592 819 q 393 899 471 899 m 419 124 q 566 169 504 124 q 635 302 635 219 q 559 435 635 388 q 402 476 494 476 l 139 476 l 139 124 l 419 124 "},"υ":{"x_min":0,"x_max":617,"ha":725,"o":"m 617 352 q 540 94 617 199 q 308 -24 455 -24 q 76 94 161 -24 q 0 352 0 199 l 0 739 l 126 739 l 126 355 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 355 492 257 l 492 739 l 617 739 l 617 352 "},"]":{"x_min":0,"x_max":275,"ha":372,"o":"m 275 -281 l 0 -281 l 0 -187 l 151 -187 l 151 920 l 0 920 l 0 1013 l 275 1013 l 275 -281 "},"m":{"x_min":0,"x_max":1019,"ha":1128,"o":"m 1019 0 l 897 0 l 897 454 q 860 591 897 536 q 739 660 816 660 q 613 586 659 660 q 573 436 573 522 l 573 0 l 447 0 l 447 455 q 412 591 447 535 q 294 657 372 657 q 165 586 213 657 q 122 437 122 521 l 122 0 l 0 0 l 0 738 l 117 738 l 117 640 q 202 730 150 697 q 316 763 254 763 q 437 730 381 763 q 525 642 494 697 q 621 731 559 700 q 753 763 682 763 q 943 694 867 763 q 1019 512 1019 625 l 1019 0 "},"χ":{"x_min":8.328125,"x_max":780.5625,"ha":815,"o":"m 780 -278 q 715 -294 747 -294 q 616 -257 663 -294 q 548 -175 576 -227 l 379 133 l 143 -277 l 9 -277 l 313 254 l 163 522 q 127 586 131 580 q 36 640 91 640 q 8 637 27 640 l 8 752 l 52 757 q 162 719 113 757 q 236 627 200 690 l 383 372 l 594 737 l 726 737 l 448 250 l 625 -69 q 670 -153 647 -110 q 743 -188 695 -188 q 780 -184 759 -188 l 780 -278 "},"8":{"x_min":55,"x_max":736,"ha":792,"o":"m 571 527 q 694 424 652 491 q 736 280 736 358 q 648 71 736 158 q 395 -26 551 -26 q 142 69 238 -26 q 55 279 55 157 q 96 425 55 359 q 220 527 138 491 q 120 615 153 562 q 88 726 88 668 q 171 904 88 827 q 395 986 261 986 q 618 905 529 986 q 702 727 702 830 q 670 616 702 667 q 571 527 638 565 m 394 565 q 519 610 475 565 q 563 717 563 655 q 521 823 563 781 q 392 872 474 872 q 265 824 312 872 q 224 720 224 783 q 265 613 224 656 q 394 565 312 565 m 395 91 q 545 150 488 91 q 597 280 597 204 q 546 408 597 355 q 395 465 492 465 q 244 408 299 465 q 194 280 194 356 q 244 150 194 203 q 395 91 299 91 "},"ί":{"x_min":42,"x_max":326.71875,"ha":361,"o":"m 284 3 q 233 -10 258 -5 q 182 -15 207 -15 q 85 26 119 -15 q 42 200 42 79 l 42 737 l 167 737 l 168 215 q 172 141 168 157 q 226 101 183 101 q 248 102 239 101 q 284 112 257 104 l 284 3 m 326 1040 l 137 819 l 54 819 l 189 1040 l 326 1040 "},"Ζ":{"x_min":0,"x_max":779.171875,"ha":850,"o":"m 779 0 l 0 0 l 0 113 l 620 896 l 40 896 l 40 1013 l 779 1013 l 779 887 l 170 124 l 779 124 l 779 0 "},"R":{"x_min":0,"x_max":781.953125,"ha":907,"o":"m 781 0 l 623 0 q 587 242 590 52 q 407 433 585 433 l 138 433 l 138 0 l 0 0 l 0 1013 l 396 1013 q 636 946 539 1013 q 749 731 749 868 q 711 597 749 659 q 608 502 674 534 q 718 370 696 474 q 729 207 722 352 q 781 26 736 62 l 781 0 m 373 551 q 533 594 465 551 q 614 731 614 645 q 532 859 614 815 q 373 896 465 896 l 138 896 l 138 551 l 373 551 "},"o":{"x_min":0,"x_max":713,"ha":821,"o":"m 357 -25 q 94 91 194 -25 q 0 368 0 202 q 93 642 0 533 q 357 761 193 761 q 618 644 518 761 q 713 368 713 533 q 619 91 713 201 q 357 -25 521 -25 m 357 85 q 528 175 465 85 q 584 369 584 255 q 529 562 584 484 q 357 651 467 651 q 189 560 250 651 q 135 369 135 481 q 187 177 135 257 q 357 85 250 85 "},"5":{"x_min":54.171875,"x_max":738,"ha":792,"o":"m 738 314 q 626 60 738 153 q 382 -23 526 -23 q 155 47 248 -23 q 54 256 54 125 l 183 256 q 259 132 204 174 q 382 91 314 91 q 533 149 471 91 q 602 314 602 213 q 538 469 602 411 q 386 528 475 528 q 284 506 332 528 q 197 439 237 484 l 81 439 l 159 958 l 684 958 l 684 840 l 254 840 l 214 579 q 306 627 258 612 q 407 643 354 643 q 636 552 540 643 q 738 314 738 457 "},"7":{"x_min":58.71875,"x_max":730.953125,"ha":792,"o":"m 730 839 q 469 448 560 641 q 335 0 378 255 l 192 0 q 328 441 235 252 q 593 830 421 630 l 58 830 l 58 958 l 730 958 l 730 839 "},"K":{"x_min":0,"x_max":819.46875,"ha":906,"o":"m 819 0 l 649 0 l 294 509 l 139 355 l 139 0 l 0 0 l 0 1013 l 139 1013 l 139 526 l 626 1013 l 809 1013 l 395 600 l 819 0 "},",":{"x_min":0,"x_max":142,"ha":239,"o":"m 142 -12 q 105 -132 142 -82 q 0 -205 68 -182 l 0 -138 q 57 -82 40 -124 q 70 0 70 -51 l 0 0 l 0 151 l 142 151 l 142 -12 "},"d":{"x_min":0,"x_max":683,"ha":796,"o":"m 683 0 l 564 0 l 564 93 q 456 6 516 38 q 327 -25 395 -25 q 87 100 181 -25 q 0 365 0 215 q 90 639 0 525 q 343 763 187 763 q 564 647 486 763 l 564 1013 l 683 1013 l 683 0 m 582 373 q 529 562 582 484 q 361 653 468 653 q 190 561 253 653 q 135 365 135 479 q 189 175 135 254 q 358 85 251 85 q 529 178 468 85 q 582 373 582 258 "},"¨":{"x_min":-109,"x_max":247,"ha":232,"o":"m 247 1046 l 119 1046 l 119 1189 l 247 1189 l 247 1046 m 19 1046 l -109 1046 l -109 1189 l 19 1189 l 19 1046 "},"E":{"x_min":0,"x_max":736.109375,"ha":789,"o":"m 736 0 l 0 0 l 0 1013 l 725 1013 l 725 889 l 139 889 l 139 585 l 677 585 l 677 467 l 139 467 l 139 125 l 736 125 l 736 0 "},"Y":{"x_min":0,"x_max":820,"ha":886,"o":"m 820 1013 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1013 l 140 1013 l 411 534 l 679 1012 l 820 1013 "},"\"":{"x_min":0,"x_max":299,"ha":396,"o":"m 299 606 l 203 606 l 203 988 l 299 988 l 299 606 m 96 606 l 0 606 l 0 988 l 96 988 l 96 606 "},"‹":{"x_min":17.984375,"x_max":773.609375,"ha":792,"o":"m 773 40 l 18 376 l 17 465 l 773 799 l 773 692 l 159 420 l 773 149 l 773 40 "},"„":{"x_min":0,"x_max":364,"ha":467,"o":"m 141 -12 q 104 -132 141 -82 q 0 -205 67 -182 l 0 -138 q 56 -82 40 -124 q 69 0 69 -51 l 0 0 l 0 151 l 141 151 l 141 -12 m 364 -12 q 327 -132 364 -82 q 222 -205 290 -182 l 222 -138 q 279 -82 262 -124 q 292 0 292 -51 l 222 0 l 222 151 l 364 151 l 364 -12 "},"δ":{"x_min":1,"x_max":710,"ha":810,"o":"m 710 360 q 616 87 710 196 q 356 -28 518 -28 q 99 82 197 -28 q 1 356 1 192 q 100 606 1 509 q 355 703 199 703 q 180 829 288 754 q 70 903 124 866 l 70 1012 l 643 1012 l 643 901 l 258 901 q 462 763 422 794 q 636 592 577 677 q 710 360 710 485 m 584 365 q 552 501 584 447 q 451 602 521 555 q 372 611 411 611 q 197 541 258 611 q 136 355 136 472 q 190 171 136 245 q 358 85 252 85 q 528 173 465 85 q 584 365 584 252 "},"έ":{"x_min":0,"x_max":634.71875,"ha":714,"o":"m 634 234 q 527 38 634 110 q 300 -25 433 -25 q 98 29 183 -25 q 0 204 0 93 q 37 313 0 265 q 128 390 67 352 q 56 459 82 419 q 26 555 26 505 q 114 712 26 654 q 295 763 191 763 q 499 700 416 763 q 589 515 589 631 l 478 515 q 419 618 464 580 q 307 657 374 657 q 207 630 253 657 q 151 547 151 598 q 238 445 151 469 q 389 434 280 434 l 389 331 l 349 331 q 206 315 255 331 q 125 210 125 287 q 183 107 125 145 q 302 76 233 76 q 436 117 379 76 q 509 234 493 159 l 634 234 m 520 1040 l 331 819 l 248 819 l 383 1040 l 520 1040 "},"ω":{"x_min":0,"x_max":922,"ha":1031,"o":"m 922 339 q 856 97 922 203 q 650 -26 780 -26 q 538 9 587 -26 q 461 103 489 44 q 387 12 436 46 q 277 -22 339 -22 q 69 97 147 -22 q 0 339 0 203 q 45 551 0 444 q 161 738 84 643 l 302 738 q 175 553 219 647 q 124 336 124 446 q 155 179 124 249 q 275 88 197 88 q 375 163 341 88 q 400 294 400 219 l 400 572 l 524 572 l 524 294 q 561 135 524 192 q 643 88 591 88 q 762 182 719 88 q 797 342 797 257 q 745 556 797 450 q 619 738 705 638 l 760 738 q 874 551 835 640 q 922 339 922 444 "},"´":{"x_min":0,"x_max":96,"ha":251,"o":"m 96 606 l 0 606 l 0 988 l 96 988 l 96 606 "},"±":{"x_min":11,"x_max":781,"ha":792,"o":"m 781 490 l 446 490 l 446 255 l 349 255 l 349 490 l 11 490 l 11 586 l 349 586 l 349 819 l 446 819 l 446 586 l 781 586 l 781 490 m 781 21 l 11 21 l 11 115 l 781 115 l 781 21 "},"|":{"x_min":343,"x_max":449,"ha":792,"o":"m 449 462 l 343 462 l 343 986 l 449 986 l 449 462 m 449 -242 l 343 -242 l 343 280 l 449 280 l 449 -242 "},"ϋ":{"x_min":0,"x_max":617,"ha":725,"o":"m 482 800 l 372 800 l 372 925 l 482 925 l 482 800 m 239 800 l 129 800 l 129 925 l 239 925 l 239 800 m 617 352 q 540 93 617 199 q 308 -24 455 -24 q 76 93 161 -24 q 0 352 0 199 l 0 738 l 126 738 l 126 354 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 354 492 257 l 492 738 l 617 738 l 617 352 "},"§":{"x_min":0,"x_max":593,"ha":690,"o":"m 593 425 q 554 312 593 369 q 467 233 516 254 q 537 83 537 172 q 459 -74 537 -12 q 288 -133 387 -133 q 115 -69 184 -133 q 47 96 47 -6 l 166 96 q 199 7 166 40 q 288 -26 232 -26 q 371 -5 332 -26 q 420 60 420 21 q 311 201 420 139 q 108 309 210 255 q 0 490 0 383 q 33 602 0 551 q 124 687 66 654 q 75 743 93 712 q 58 812 58 773 q 133 984 58 920 q 300 1043 201 1043 q 458 987 394 1043 q 529 814 529 925 l 411 814 q 370 908 404 877 q 289 939 336 939 q 213 911 246 939 q 180 841 180 883 q 286 720 180 779 q 484 612 480 615 q 593 425 593 534 m 467 409 q 355 544 467 473 q 196 630 228 612 q 146 587 162 609 q 124 525 124 558 q 239 387 124 462 q 398 298 369 315 q 448 345 429 316 q 467 409 467 375 "},"b":{"x_min":0,"x_max":685,"ha":783,"o":"m 685 372 q 597 99 685 213 q 347 -25 501 -25 q 219 5 277 -25 q 121 93 161 36 l 121 0 l 0 0 l 0 1013 l 121 1013 l 121 634 q 214 723 157 692 q 341 754 272 754 q 591 637 493 754 q 685 372 685 526 m 554 356 q 499 550 554 470 q 328 644 437 644 q 162 556 223 644 q 108 369 108 478 q 160 176 108 256 q 330 83 221 83 q 498 169 435 83 q 554 356 554 245 "},"q":{"x_min":0,"x_max":683,"ha":876,"o":"m 683 -278 l 564 -278 l 564 97 q 474 8 533 39 q 345 -23 415 -23 q 91 93 188 -23 q 0 364 0 203 q 87 635 0 522 q 337 760 184 760 q 466 727 408 760 q 564 637 523 695 l 564 737 l 683 737 l 683 -278 m 582 375 q 527 564 582 488 q 358 652 466 652 q 190 565 253 652 q 135 377 135 488 q 189 179 135 261 q 361 84 251 84 q 530 179 469 84 q 582 375 582 260 "},"Ω":{"x_min":-0.171875,"x_max":969.5625,"ha":1068,"o":"m 969 0 l 555 0 l 555 123 q 744 308 675 194 q 814 558 814 423 q 726 812 814 709 q 484 922 633 922 q 244 820 334 922 q 154 567 154 719 q 223 316 154 433 q 412 123 292 199 l 412 0 l 0 0 l 0 124 l 217 124 q 68 327 122 210 q 15 572 15 444 q 144 911 15 781 q 484 1041 274 1041 q 822 909 691 1041 q 953 569 953 777 q 899 326 953 443 q 750 124 846 210 l 969 124 l 969 0 "},"ύ":{"x_min":0,"x_max":617,"ha":725,"o":"m 617 352 q 540 93 617 199 q 308 -24 455 -24 q 76 93 161 -24 q 0 352 0 199 l 0 738 l 126 738 l 126 354 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 354 492 257 l 492 738 l 617 738 l 617 352 m 535 1040 l 346 819 l 262 819 l 397 1040 l 535 1040 "},"z":{"x_min":-0.015625,"x_max":613.890625,"ha":697,"o":"m 613 0 l 0 0 l 0 100 l 433 630 l 20 630 l 20 738 l 594 738 l 593 636 l 163 110 l 613 110 l 613 0 "},"™":{"x_min":0,"x_max":894,"ha":1000,"o":"m 389 951 l 229 951 l 229 503 l 160 503 l 160 951 l 0 951 l 0 1011 l 389 1011 l 389 951 m 894 503 l 827 503 l 827 939 l 685 503 l 620 503 l 481 937 l 481 503 l 417 503 l 417 1011 l 517 1011 l 653 580 l 796 1010 l 894 1011 l 894 503 "},"ή":{"x_min":0.78125,"x_max":697,"ha":810,"o":"m 697 -278 l 572 -278 l 572 454 q 540 587 572 536 q 425 650 501 650 q 271 579 337 650 q 206 420 206 509 l 206 0 l 81 0 l 81 489 q 73 588 81 562 q 0 644 56 644 l 0 741 q 68 755 38 755 q 158 721 124 755 q 200 630 193 687 q 297 726 234 692 q 434 761 359 761 q 620 692 544 761 q 697 516 697 624 l 697 -278 m 479 1040 l 290 819 l 207 819 l 341 1040 l 479 1040 "},"Θ":{"x_min":0,"x_max":960,"ha":1056,"o":"m 960 507 q 833 129 960 280 q 476 -32 698 -32 q 123 129 255 -32 q 0 507 0 280 q 123 883 0 732 q 476 1045 255 1045 q 832 883 696 1045 q 960 507 960 732 m 817 500 q 733 789 817 669 q 476 924 639 924 q 223 792 317 924 q 142 507 142 675 q 222 222 142 339 q 476 89 315 89 q 730 218 636 89 q 817 500 817 334 m 716 449 l 243 449 l 243 571 l 716 571 l 716 449 "},"®":{"x_min":-3,"x_max":1008,"ha":1106,"o":"m 503 532 q 614 562 566 532 q 672 658 672 598 q 614 747 672 716 q 503 772 569 772 l 338 772 l 338 532 l 503 532 m 502 -7 q 123 151 263 -7 q -3 501 -3 294 q 123 851 -3 706 q 502 1011 263 1011 q 881 851 739 1011 q 1008 501 1008 708 q 883 151 1008 292 q 502 -7 744 -7 m 502 60 q 830 197 709 60 q 940 501 940 322 q 831 805 940 681 q 502 944 709 944 q 174 805 296 944 q 65 501 65 680 q 173 197 65 320 q 502 60 294 60 m 788 146 l 678 146 q 653 316 655 183 q 527 449 652 449 l 338 449 l 338 146 l 241 146 l 241 854 l 518 854 q 688 808 621 854 q 766 658 766 755 q 739 563 766 607 q 668 497 713 519 q 751 331 747 472 q 788 164 756 190 l 788 146 "},"~":{"x_min":0,"x_max":833,"ha":931,"o":"m 833 958 q 778 753 833 831 q 594 665 716 665 q 402 761 502 665 q 240 857 302 857 q 131 795 166 857 q 104 665 104 745 l 0 665 q 54 867 0 789 q 237 958 116 958 q 429 861 331 958 q 594 765 527 765 q 704 827 670 765 q 729 958 729 874 l 833 958 "},"Ε":{"x_min":0,"x_max":736.21875,"ha":778,"o":"m 736 0 l 0 0 l 0 1013 l 725 1013 l 725 889 l 139 889 l 139 585 l 677 585 l 677 467 l 139 467 l 139 125 l 736 125 l 736 0 "},"³":{"x_min":0,"x_max":450,"ha":547,"o":"m 450 552 q 379 413 450 464 q 220 366 313 366 q 69 414 130 366 q 0 567 0 470 l 85 567 q 126 470 85 504 q 225 437 168 437 q 320 467 280 437 q 360 552 360 498 q 318 632 360 608 q 213 657 276 657 q 195 657 203 657 q 176 657 181 657 l 176 722 q 279 733 249 722 q 334 815 334 752 q 300 881 334 856 q 220 907 267 907 q 133 875 169 907 q 97 781 97 844 l 15 781 q 78 926 15 875 q 220 972 135 972 q 364 930 303 972 q 426 817 426 888 q 344 697 426 733 q 421 642 392 681 q 450 552 450 603 "},"[":{"x_min":0,"x_max":273.609375,"ha":371,"o":"m 273 -281 l 0 -281 l 0 1013 l 273 1013 l 273 920 l 124 920 l 124 -187 l 273 -187 l 273 -281 "},"L":{"x_min":0,"x_max":645.828125,"ha":696,"o":"m 645 0 l 0 0 l 0 1013 l 140 1013 l 140 126 l 645 126 l 645 0 "},"σ":{"x_min":0,"x_max":803.390625,"ha":894,"o":"m 803 628 l 633 628 q 713 368 713 512 q 618 93 713 204 q 357 -25 518 -25 q 94 91 194 -25 q 0 368 0 201 q 94 644 0 533 q 356 761 194 761 q 481 750 398 761 q 608 739 564 739 l 803 739 l 803 628 m 360 85 q 529 180 467 85 q 584 374 584 262 q 527 566 584 490 q 352 651 463 651 q 187 559 247 651 q 135 368 135 478 q 189 175 135 254 q 360 85 251 85 "},"ζ":{"x_min":0,"x_max":573,"ha":642,"o":"m 573 -40 q 553 -162 573 -97 q 510 -278 543 -193 l 400 -278 q 441 -187 428 -219 q 462 -90 462 -132 q 378 -14 462 -14 q 108 45 197 -14 q 0 290 0 117 q 108 631 0 462 q 353 901 194 767 l 55 901 l 55 1012 l 561 1012 l 561 924 q 261 669 382 831 q 128 301 128 489 q 243 117 128 149 q 458 98 350 108 q 573 -40 573 80 "},"θ":{"x_min":0,"x_max":674,"ha":778,"o":"m 674 496 q 601 160 674 304 q 336 -26 508 -26 q 73 153 165 -26 q 0 485 0 296 q 72 840 0 683 q 343 1045 166 1045 q 605 844 516 1045 q 674 496 674 692 m 546 579 q 498 798 546 691 q 336 935 437 935 q 178 798 237 935 q 126 579 137 701 l 546 579 m 546 475 l 126 475 q 170 233 126 348 q 338 80 230 80 q 504 233 447 80 q 546 475 546 346 "},"Ο":{"x_min":0,"x_max":958,"ha":1054,"o":"m 485 1042 q 834 883 703 1042 q 958 511 958 735 q 834 136 958 287 q 481 -26 701 -26 q 126 130 261 -26 q 0 504 0 279 q 127 880 0 729 q 485 1042 263 1042 m 480 98 q 731 225 638 98 q 815 504 815 340 q 733 783 815 670 q 480 913 640 913 q 226 785 321 913 q 142 504 142 671 q 226 224 142 339 q 480 98 319 98 "},"Γ":{"x_min":0,"x_max":705.28125,"ha":749,"o":"m 705 886 l 140 886 l 140 0 l 0 0 l 0 1012 l 705 1012 l 705 886 "}," ":{"x_min":0,"x_max":0,"ha":375},"%":{"x_min":-3,"x_max":1089,"ha":1186,"o":"m 845 0 q 663 76 731 0 q 602 244 602 145 q 661 412 602 344 q 845 489 728 489 q 1027 412 959 489 q 1089 244 1089 343 q 1029 76 1089 144 q 845 0 962 0 m 844 103 q 945 143 909 103 q 981 243 981 184 q 947 340 981 301 q 844 385 909 385 q 744 342 781 385 q 708 243 708 300 q 741 147 708 186 q 844 103 780 103 m 888 986 l 284 -25 l 199 -25 l 803 986 l 888 986 m 241 468 q 58 545 126 468 q -3 715 -3 615 q 56 881 -3 813 q 238 958 124 958 q 421 881 353 958 q 483 712 483 813 q 423 544 483 612 q 241 468 356 468 m 241 855 q 137 811 175 855 q 100 710 100 768 q 136 612 100 653 q 240 572 172 572 q 344 614 306 572 q 382 713 382 656 q 347 810 382 771 q 241 855 308 855 "},"P":{"x_min":0,"x_max":726,"ha":806,"o":"m 424 1013 q 640 931 555 1013 q 726 719 726 850 q 637 506 726 587 q 413 426 548 426 l 140 426 l 140 0 l 0 0 l 0 1013 l 424 1013 m 379 889 l 140 889 l 140 548 l 372 548 q 522 589 459 548 q 593 720 593 637 q 528 845 593 801 q 379 889 463 889 "},"Έ":{"x_min":0,"x_max":1078.21875,"ha":1118,"o":"m 1078 0 l 342 0 l 342 1013 l 1067 1013 l 1067 889 l 481 889 l 481 585 l 1019 585 l 1019 467 l 481 467 l 481 125 l 1078 125 l 1078 0 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},"Ώ":{"x_min":0.125,"x_max":1136.546875,"ha":1235,"o":"m 1136 0 l 722 0 l 722 123 q 911 309 842 194 q 981 558 981 423 q 893 813 981 710 q 651 923 800 923 q 411 821 501 923 q 321 568 321 720 q 390 316 321 433 q 579 123 459 200 l 579 0 l 166 0 l 166 124 l 384 124 q 235 327 289 210 q 182 572 182 444 q 311 912 182 782 q 651 1042 441 1042 q 989 910 858 1042 q 1120 569 1120 778 q 1066 326 1120 443 q 917 124 1013 210 l 1136 124 l 1136 0 m 277 1040 l 83 800 l 0 800 l 140 1041 l 277 1040 "},"_":{"x_min":0,"x_max":705.5625,"ha":803,"o":"m 705 -334 l 0 -334 l 0 -234 l 705 -234 l 705 -334 "},"Ϊ":{"x_min":-110,"x_max":246,"ha":275,"o":"m 246 1046 l 118 1046 l 118 1189 l 246 1189 l 246 1046 m 18 1046 l -110 1046 l -110 1189 l 18 1189 l 18 1046 m 136 0 l 0 0 l 0 1012 l 136 1012 l 136 0 "},"+":{"x_min":23,"x_max":768,"ha":792,"o":"m 768 372 l 444 372 l 444 0 l 347 0 l 347 372 l 23 372 l 23 468 l 347 468 l 347 840 l 444 840 l 444 468 l 768 468 l 768 372 "},"½":{"x_min":0,"x_max":1050,"ha":1149,"o":"m 1050 0 l 625 0 q 712 178 625 108 q 878 277 722 187 q 967 385 967 328 q 932 456 967 429 q 850 484 897 484 q 759 450 798 484 q 721 352 721 416 l 640 352 q 706 502 640 448 q 851 551 766 551 q 987 509 931 551 q 1050 385 1050 462 q 976 251 1050 301 q 829 179 902 215 q 717 68 740 133 l 1050 68 l 1050 0 m 834 985 l 215 -28 l 130 -28 l 750 984 l 834 985 m 224 422 l 142 422 l 142 811 l 0 811 l 0 867 q 104 889 62 867 q 164 973 157 916 l 224 973 l 224 422 "},"Ρ":{"x_min":0,"x_max":720,"ha":783,"o":"m 424 1013 q 637 933 554 1013 q 720 723 720 853 q 633 508 720 591 q 413 426 546 426 l 140 426 l 140 0 l 0 0 l 0 1013 l 424 1013 m 378 889 l 140 889 l 140 548 l 371 548 q 521 589 458 548 q 592 720 592 637 q 527 845 592 801 q 378 889 463 889 "},"'":{"x_min":0,"x_max":139,"ha":236,"o":"m 139 851 q 102 737 139 784 q 0 669 65 690 l 0 734 q 59 787 42 741 q 72 873 72 821 l 0 873 l 0 1013 l 139 1013 l 139 851 "},"ª":{"x_min":0,"x_max":350,"ha":397,"o":"m 350 625 q 307 616 328 616 q 266 631 281 616 q 247 673 251 645 q 190 628 225 644 q 116 613 156 613 q 32 641 64 613 q 0 722 0 669 q 72 826 0 800 q 247 866 159 846 l 247 887 q 220 934 247 916 q 162 953 194 953 q 104 934 129 953 q 76 882 80 915 l 16 882 q 60 976 16 941 q 166 1011 104 1011 q 266 979 224 1011 q 308 891 308 948 l 308 706 q 311 679 308 688 q 331 670 315 670 l 350 672 l 350 625 m 247 757 l 247 811 q 136 790 175 798 q 64 726 64 773 q 83 682 64 697 q 132 667 103 667 q 207 690 174 667 q 247 757 247 718 "},"΅":{"x_min":0,"x_max":450,"ha":553,"o":"m 450 800 l 340 800 l 340 925 l 450 925 l 450 800 m 406 1040 l 212 800 l 129 800 l 269 1040 l 406 1040 m 110 800 l 0 800 l 0 925 l 110 925 l 110 800 "},"T":{"x_min":0,"x_max":777,"ha":835,"o":"m 777 894 l 458 894 l 458 0 l 319 0 l 319 894 l 0 894 l 0 1013 l 777 1013 l 777 894 "},"Φ":{"x_min":0,"x_max":915,"ha":997,"o":"m 527 0 l 389 0 l 389 122 q 110 231 220 122 q 0 509 0 340 q 110 785 0 677 q 389 893 220 893 l 389 1013 l 527 1013 l 527 893 q 804 786 693 893 q 915 509 915 679 q 805 231 915 341 q 527 122 696 122 l 527 0 m 527 226 q 712 310 641 226 q 779 507 779 389 q 712 705 779 627 q 527 787 641 787 l 527 226 m 389 226 l 389 787 q 205 698 275 775 q 136 505 136 620 q 206 308 136 391 q 389 226 276 226 "},"⁋":{"x_min":0,"x_max":0,"ha":694},"j":{"x_min":-77.78125,"x_max":167,"ha":349,"o":"m 167 871 l 42 871 l 42 1013 l 167 1013 l 167 871 m 167 -80 q 121 -231 167 -184 q -26 -278 76 -278 l -77 -278 l -77 -164 l -41 -164 q 26 -143 11 -164 q 42 -65 42 -122 l 42 737 l 167 737 l 167 -80 "},"Σ":{"x_min":0,"x_max":756.953125,"ha":819,"o":"m 756 0 l 0 0 l 0 107 l 395 523 l 22 904 l 22 1013 l 745 1013 l 745 889 l 209 889 l 566 523 l 187 125 l 756 125 l 756 0 "},"1":{"x_min":215.671875,"x_max":574,"ha":792,"o":"m 574 0 l 442 0 l 442 697 l 215 697 l 215 796 q 386 833 330 796 q 475 986 447 875 l 574 986 l 574 0 "},"›":{"x_min":18.0625,"x_max":774,"ha":792,"o":"m 774 376 l 18 40 l 18 149 l 631 421 l 18 692 l 18 799 l 774 465 l 774 376 "},"<":{"x_min":17.984375,"x_max":773.609375,"ha":792,"o":"m 773 40 l 18 376 l 17 465 l 773 799 l 773 692 l 159 420 l 773 149 l 773 40 "},"£":{"x_min":0,"x_max":704.484375,"ha":801,"o":"m 704 41 q 623 -10 664 5 q 543 -26 583 -26 q 359 15 501 -26 q 243 36 288 36 q 158 23 197 36 q 73 -21 119 10 l 6 76 q 125 195 90 150 q 175 331 175 262 q 147 443 175 383 l 0 443 l 0 512 l 108 512 q 43 734 43 623 q 120 929 43 854 q 358 1010 204 1010 q 579 936 487 1010 q 678 729 678 857 l 678 684 l 552 684 q 504 838 552 780 q 362 896 457 896 q 216 852 263 896 q 176 747 176 815 q 199 627 176 697 q 248 512 217 574 l 468 512 l 468 443 l 279 443 q 297 356 297 398 q 230 194 297 279 q 153 107 211 170 q 227 133 190 125 q 293 142 264 142 q 410 119 339 142 q 516 96 482 96 q 579 105 550 96 q 648 142 608 115 l 704 41 "},"t":{"x_min":0,"x_max":367,"ha":458,"o":"m 367 0 q 312 -5 339 -2 q 262 -8 284 -8 q 145 28 183 -8 q 108 143 108 64 l 108 638 l 0 638 l 0 738 l 108 738 l 108 944 l 232 944 l 232 738 l 367 738 l 367 638 l 232 638 l 232 185 q 248 121 232 140 q 307 102 264 102 q 345 104 330 102 q 367 107 360 107 l 367 0 "},"¬":{"x_min":0,"x_max":706,"ha":803,"o":"m 706 411 l 706 158 l 630 158 l 630 335 l 0 335 l 0 411 l 706 411 "},"λ":{"x_min":0,"x_max":750,"ha":803,"o":"m 750 -7 q 679 -15 716 -15 q 538 59 591 -15 q 466 214 512 97 l 336 551 l 126 0 l 0 0 l 270 705 q 223 837 247 770 q 116 899 190 899 q 90 898 100 899 l 90 1004 q 152 1011 125 1011 q 298 938 244 1011 q 373 783 326 901 l 605 192 q 649 115 629 136 q 716 95 669 95 l 736 95 q 750 97 745 97 l 750 -7 "},"W":{"x_min":0,"x_max":1263.890625,"ha":1351,"o":"m 1263 1013 l 995 0 l 859 0 l 627 837 l 405 0 l 265 0 l 0 1013 l 136 1013 l 342 202 l 556 1013 l 701 1013 l 921 207 l 1133 1012 l 1263 1013 "},">":{"x_min":18.0625,"x_max":774,"ha":792,"o":"m 774 376 l 18 40 l 18 149 l 631 421 l 18 692 l 18 799 l 774 465 l 774 376 "},"v":{"x_min":0,"x_max":675.15625,"ha":761,"o":"m 675 738 l 404 0 l 272 0 l 0 738 l 133 737 l 340 147 l 541 737 l 675 738 "},"τ":{"x_min":0.28125,"x_max":644.5,"ha":703,"o":"m 644 628 l 382 628 l 382 179 q 388 120 382 137 q 436 91 401 91 q 474 94 447 91 q 504 97 501 97 l 504 0 q 454 -9 482 -5 q 401 -14 426 -14 q 278 67 308 -14 q 260 233 260 118 l 260 628 l 0 628 l 0 739 l 644 739 l 644 628 "},"ξ":{"x_min":0,"x_max":624.9375,"ha":699,"o":"m 624 -37 q 608 -153 624 -96 q 563 -278 593 -211 l 454 -278 q 491 -183 486 -200 q 511 -83 511 -126 q 484 -23 511 -44 q 370 1 452 1 q 323 0 354 1 q 283 -1 293 -1 q 84 76 169 -1 q 0 266 0 154 q 56 431 0 358 q 197 538 108 498 q 94 613 134 562 q 54 730 54 665 q 77 823 54 780 q 143 901 101 867 l 27 901 l 27 1012 l 576 1012 l 576 901 l 380 901 q 244 863 303 901 q 178 745 178 820 q 312 600 178 636 q 532 582 380 582 l 532 479 q 276 455 361 479 q 118 281 118 410 q 165 173 118 217 q 274 120 208 133 q 494 101 384 110 q 624 -37 624 76 "},"&":{"x_min":-3,"x_max":894.25,"ha":992,"o":"m 894 0 l 725 0 l 624 123 q 471 0 553 40 q 306 -41 390 -41 q 168 -7 231 -41 q 62 92 105 26 q 14 187 31 139 q -3 276 -3 235 q 55 433 -3 358 q 248 581 114 508 q 170 689 196 640 q 137 817 137 751 q 214 985 137 922 q 384 1041 284 1041 q 548 988 483 1041 q 622 824 622 928 q 563 666 622 739 q 431 556 516 608 l 621 326 q 649 407 639 361 q 663 493 653 426 l 781 493 q 703 229 781 352 l 894 0 m 504 818 q 468 908 504 877 q 384 940 433 940 q 293 907 331 940 q 255 818 255 875 q 289 714 255 767 q 363 628 313 678 q 477 729 446 682 q 504 818 504 771 m 556 209 l 314 499 q 179 395 223 449 q 135 283 135 341 q 146 222 135 253 q 183 158 158 192 q 333 80 241 80 q 556 209 448 80 "},"Λ":{"x_min":0,"x_max":862.5,"ha":942,"o":"m 862 0 l 719 0 l 426 847 l 143 0 l 0 0 l 356 1013 l 501 1013 l 862 0 "},"I":{"x_min":41,"x_max":180,"ha":293,"o":"m 180 0 l 41 0 l 41 1013 l 180 1013 l 180 0 "},"G":{"x_min":0,"x_max":921,"ha":1011,"o":"m 921 0 l 832 0 l 801 136 q 655 15 741 58 q 470 -28 568 -28 q 126 133 259 -28 q 0 499 0 284 q 125 881 0 731 q 486 1043 259 1043 q 763 957 647 1043 q 905 709 890 864 l 772 709 q 668 866 747 807 q 486 926 589 926 q 228 795 322 926 q 142 507 142 677 q 228 224 142 342 q 483 94 323 94 q 712 195 625 94 q 796 435 796 291 l 477 435 l 477 549 l 921 549 l 921 0 "},"ΰ":{"x_min":0,"x_max":617,"ha":725,"o":"m 524 800 l 414 800 l 414 925 l 524 925 l 524 800 m 183 800 l 73 800 l 73 925 l 183 925 l 183 800 m 617 352 q 540 93 617 199 q 308 -24 455 -24 q 76 93 161 -24 q 0 352 0 199 l 0 738 l 126 738 l 126 354 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 354 492 257 l 492 738 l 617 738 l 617 352 m 489 1040 l 300 819 l 216 819 l 351 1040 l 489 1040 "},"`":{"x_min":0,"x_max":138.890625,"ha":236,"o":"m 138 699 l 0 699 l 0 861 q 36 974 0 929 q 138 1041 72 1020 l 138 977 q 82 931 95 969 q 69 839 69 893 l 138 839 l 138 699 "},"·":{"x_min":0,"x_max":142,"ha":239,"o":"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 "},"Υ":{"x_min":0.328125,"x_max":819.515625,"ha":889,"o":"m 819 1013 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1013 l 140 1013 l 411 533 l 679 1013 l 819 1013 "},"r":{"x_min":0,"x_max":355.5625,"ha":432,"o":"m 355 621 l 343 621 q 179 569 236 621 q 122 411 122 518 l 122 0 l 0 0 l 0 737 l 117 737 l 117 604 q 204 719 146 686 q 355 753 262 753 l 355 621 "},"x":{"x_min":0,"x_max":675,"ha":764,"o":"m 675 0 l 525 0 l 331 286 l 144 0 l 0 0 l 256 379 l 12 738 l 157 737 l 336 473 l 516 738 l 661 738 l 412 380 l 675 0 "},"μ":{"x_min":0,"x_max":696.609375,"ha":747,"o":"m 696 -4 q 628 -14 657 -14 q 498 97 513 -14 q 422 8 470 41 q 313 -24 374 -24 q 207 3 258 -24 q 120 80 157 31 l 120 -278 l 0 -278 l 0 738 l 124 738 l 124 343 q 165 172 124 246 q 308 82 216 82 q 451 177 402 82 q 492 358 492 254 l 492 738 l 616 738 l 616 214 q 623 136 616 160 q 673 92 636 92 q 696 95 684 92 l 696 -4 "},"h":{"x_min":0,"x_max":615,"ha":724,"o":"m 615 472 l 615 0 l 490 0 l 490 454 q 456 590 490 535 q 338 654 416 654 q 186 588 251 654 q 122 436 122 522 l 122 0 l 0 0 l 0 1013 l 122 1013 l 122 633 q 218 727 149 694 q 362 760 287 760 q 552 676 484 760 q 615 472 615 600 "},".":{"x_min":0,"x_max":142,"ha":239,"o":"m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 "},"φ":{"x_min":-2,"x_max":878,"ha":974,"o":"m 496 -279 l 378 -279 l 378 -17 q 101 88 204 -17 q -2 367 -2 194 q 68 626 -2 510 q 283 758 151 758 l 283 646 q 167 537 209 626 q 133 373 133 462 q 192 177 133 254 q 378 93 259 93 l 378 758 q 445 764 426 763 q 476 765 464 765 q 765 659 653 765 q 878 377 878 553 q 771 96 878 209 q 496 -17 665 -17 l 496 -279 m 496 93 l 514 93 q 687 183 623 93 q 746 380 746 265 q 691 569 746 491 q 522 658 629 658 l 496 656 l 496 93 "},";":{"x_min":0,"x_max":142,"ha":239,"o":"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 m 142 -12 q 105 -132 142 -82 q 0 -206 68 -182 l 0 -138 q 58 -82 43 -123 q 68 0 68 -56 l 0 0 l 0 151 l 142 151 l 142 -12 "},"f":{"x_min":0,"x_max":378,"ha":472,"o":"m 378 638 l 246 638 l 246 0 l 121 0 l 121 638 l 0 638 l 0 738 l 121 738 q 137 935 121 887 q 290 1028 171 1028 q 320 1027 305 1028 q 378 1021 334 1026 l 378 908 q 323 918 346 918 q 257 870 273 918 q 246 780 246 840 l 246 738 l 378 738 l 378 638 "},"“":{"x_min":1,"x_max":348.21875,"ha":454,"o":"m 140 670 l 1 670 l 1 830 q 37 943 1 897 q 140 1011 74 990 l 140 947 q 82 900 97 940 q 68 810 68 861 l 140 810 l 140 670 m 348 670 l 209 670 l 209 830 q 245 943 209 897 q 348 1011 282 990 l 348 947 q 290 900 305 940 q 276 810 276 861 l 348 810 l 348 670 "},"A":{"x_min":0.03125,"x_max":906.953125,"ha":1008,"o":"m 906 0 l 756 0 l 648 303 l 251 303 l 142 0 l 0 0 l 376 1013 l 529 1013 l 906 0 m 610 421 l 452 867 l 293 421 l 610 421 "},"6":{"x_min":53,"x_max":739,"ha":792,"o":"m 739 312 q 633 62 739 162 q 400 -31 534 -31 q 162 78 257 -31 q 53 439 53 206 q 178 859 53 712 q 441 986 284 986 q 643 912 559 986 q 732 713 732 833 l 601 713 q 544 830 594 786 q 426 875 494 875 q 268 793 331 875 q 193 517 193 697 q 301 597 240 570 q 427 624 362 624 q 643 540 552 624 q 739 312 739 451 m 603 298 q 540 461 603 400 q 404 516 484 516 q 268 461 323 516 q 207 300 207 401 q 269 137 207 198 q 405 83 325 83 q 541 137 486 83 q 603 298 603 197 "},"‘":{"x_min":1,"x_max":139.890625,"ha":236,"o":"m 139 670 l 1 670 l 1 830 q 37 943 1 897 q 139 1011 74 990 l 139 947 q 82 900 97 940 q 68 810 68 861 l 139 810 l 139 670 "},"ϊ":{"x_min":-70,"x_max":283,"ha":361,"o":"m 283 800 l 173 800 l 173 925 l 283 925 l 283 800 m 40 800 l -70 800 l -70 925 l 40 925 l 40 800 m 283 3 q 232 -10 257 -5 q 181 -15 206 -15 q 84 26 118 -15 q 41 200 41 79 l 41 737 l 166 737 l 167 215 q 171 141 167 157 q 225 101 182 101 q 247 103 238 101 q 283 112 256 104 l 283 3 "},"π":{"x_min":-0.21875,"x_max":773.21875,"ha":857,"o":"m 773 -7 l 707 -11 q 575 40 607 -11 q 552 174 552 77 l 552 226 l 552 626 l 222 626 l 222 0 l 97 0 l 97 626 l 0 626 l 0 737 l 773 737 l 773 626 l 676 626 l 676 171 q 695 103 676 117 q 773 90 714 90 l 773 -7 "},"ά":{"x_min":0,"x_max":765.5625,"ha":809,"o":"m 765 -4 q 698 -14 726 -14 q 564 97 586 -14 q 466 7 525 40 q 337 -26 407 -26 q 88 98 186 -26 q 0 369 0 212 q 88 637 0 525 q 337 760 184 760 q 465 727 407 760 q 563 637 524 695 l 563 738 l 685 738 l 685 222 q 693 141 685 168 q 748 94 708 94 q 765 95 760 94 l 765 -4 m 584 371 q 531 562 584 485 q 360 653 470 653 q 192 566 254 653 q 135 379 135 489 q 186 181 135 261 q 358 84 247 84 q 528 176 465 84 q 584 371 584 260 m 604 1040 l 415 819 l 332 819 l 466 1040 l 604 1040 "},"O":{"x_min":0,"x_max":958,"ha":1057,"o":"m 485 1041 q 834 882 702 1041 q 958 512 958 734 q 834 136 958 287 q 481 -26 702 -26 q 126 130 261 -26 q 0 504 0 279 q 127 880 0 728 q 485 1041 263 1041 m 480 98 q 731 225 638 98 q 815 504 815 340 q 733 783 815 669 q 480 912 640 912 q 226 784 321 912 q 142 504 142 670 q 226 224 142 339 q 480 98 319 98 "},"n":{"x_min":0,"x_max":615,"ha":724,"o":"m 615 463 l 615 0 l 490 0 l 490 454 q 453 592 490 537 q 331 656 410 656 q 178 585 240 656 q 117 421 117 514 l 117 0 l 0 0 l 0 738 l 117 738 l 117 630 q 218 728 150 693 q 359 764 286 764 q 552 675 484 764 q 615 463 615 593 "},"3":{"x_min":54,"x_max":737,"ha":792,"o":"m 737 284 q 635 55 737 141 q 399 -25 541 -25 q 156 52 248 -25 q 54 308 54 140 l 185 308 q 245 147 185 202 q 395 96 302 96 q 539 140 484 96 q 602 280 602 190 q 510 429 602 390 q 324 454 451 454 l 324 565 q 487 584 441 565 q 565 719 565 617 q 515 835 565 791 q 395 879 466 879 q 255 824 307 879 q 203 661 203 769 l 78 661 q 166 909 78 822 q 387 992 250 992 q 603 921 513 992 q 701 723 701 844 q 669 607 701 656 q 578 524 637 558 q 696 434 655 499 q 737 284 737 369 "},"9":{"x_min":53,"x_max":739,"ha":792,"o":"m 739 524 q 619 94 739 241 q 362 -32 516 -32 q 150 47 242 -32 q 59 244 59 126 l 191 244 q 246 129 191 176 q 373 82 301 82 q 526 161 466 82 q 597 440 597 255 q 363 334 501 334 q 130 432 216 334 q 53 650 53 521 q 134 880 53 786 q 383 986 226 986 q 659 841 566 986 q 739 524 739 719 m 388 449 q 535 514 480 449 q 585 658 585 573 q 535 805 585 744 q 388 873 480 873 q 242 809 294 873 q 191 658 191 745 q 239 514 191 572 q 388 449 292 449 "},"l":{"x_min":41,"x_max":166,"ha":279,"o":"m 166 0 l 41 0 l 41 1013 l 166 1013 l 166 0 "},"¤":{"x_min":40.09375,"x_max":728.796875,"ha":825,"o":"m 728 304 l 649 224 l 512 363 q 383 331 458 331 q 256 363 310 331 l 119 224 l 40 304 l 177 441 q 150 553 150 493 q 184 673 150 621 l 40 818 l 119 898 l 267 749 q 321 766 291 759 q 384 773 351 773 q 447 766 417 773 q 501 749 477 759 l 649 898 l 728 818 l 585 675 q 612 618 604 648 q 621 553 621 587 q 591 441 621 491 l 728 304 m 384 682 q 280 643 318 682 q 243 551 243 604 q 279 461 243 499 q 383 423 316 423 q 487 461 449 423 q 525 553 525 500 q 490 641 525 605 q 384 682 451 682 "},"κ":{"x_min":0,"x_max":632.328125,"ha":679,"o":"m 632 0 l 482 0 l 225 384 l 124 288 l 124 0 l 0 0 l 0 738 l 124 738 l 124 446 l 433 738 l 596 738 l 312 466 l 632 0 "},"4":{"x_min":48,"x_max":742.453125,"ha":792,"o":"m 742 243 l 602 243 l 602 0 l 476 0 l 476 243 l 48 243 l 48 368 l 476 958 l 602 958 l 602 354 l 742 354 l 742 243 m 476 354 l 476 792 l 162 354 l 476 354 "},"p":{"x_min":0,"x_max":685,"ha":786,"o":"m 685 364 q 598 96 685 205 q 350 -23 504 -23 q 121 89 205 -23 l 121 -278 l 0 -278 l 0 738 l 121 738 l 121 633 q 220 726 159 691 q 351 761 280 761 q 598 636 504 761 q 685 364 685 522 m 557 371 q 501 560 557 481 q 330 651 437 651 q 162 559 223 651 q 108 366 108 479 q 162 177 108 254 q 333 87 224 87 q 502 178 441 87 q 557 371 557 258 "},"‡":{"x_min":0,"x_max":777,"ha":835,"o":"m 458 238 l 458 0 l 319 0 l 319 238 l 0 238 l 0 360 l 319 360 l 319 681 l 0 683 l 0 804 l 319 804 l 319 1015 l 458 1013 l 458 804 l 777 804 l 777 683 l 458 683 l 458 360 l 777 360 l 777 238 l 458 238 "},"ψ":{"x_min":0,"x_max":808,"ha":907,"o":"m 465 -278 l 341 -278 l 341 -15 q 87 102 180 -15 q 0 378 0 210 l 0 739 l 133 739 l 133 379 q 182 195 133 275 q 341 98 242 98 l 341 922 l 465 922 l 465 98 q 623 195 563 98 q 675 382 675 278 l 675 742 l 808 742 l 808 381 q 720 104 808 213 q 466 -13 627 -13 l 465 -278 "},"η":{"x_min":0.78125,"x_max":697,"ha":810,"o":"m 697 -278 l 572 -278 l 572 454 q 540 587 572 536 q 425 650 501 650 q 271 579 337 650 q 206 420 206 509 l 206 0 l 81 0 l 81 489 q 73 588 81 562 q 0 644 56 644 l 0 741 q 68 755 38 755 q 158 720 124 755 q 200 630 193 686 q 297 726 234 692 q 434 761 359 761 q 620 692 544 761 q 697 516 697 624 l 697 -278 "}},"cssFontWeight":"normal","ascender":1189,"underlinePosition":-100,"cssFontStyle":"normal","boundingBox":{"yMin":-334,"xMin":-111,"yMax":1189,"xMax":1672},"resolution":1000,"original_font_information":{"postscript_name":"Helvetiker-Regular","version_string":"Version 1.00 2004 initial release","vendor_url":"http://www.magenta.gr/","full_font_name":"Helvetiker","font_family_name":"Helvetiker","copyright":"Copyright (c) Μagenta ltd, 2004","description":"","trademark":"","designer":"","designer_url":"","unique_font_identifier":"Μagenta ltd:Helvetiker:22-10-104","license_url":"http://www.ellak.gr/fonts/MgOpen/license.html","license_description":"Copyright (c) 2004 by MAGENTA Ltd. All Rights Reserved.\r\n\r\nPermission is hereby granted, free of charge, to any person obtaining a copy of the fonts accompanying this license (\"Fonts\") and associated documentation files (the \"Font Software\"), to reproduce and distribute the Font Software, including without limitation the rights to use, copy, merge, publish, distribute, and/or sell copies of the Font Software, and to permit persons to whom the Font Software is furnished to do so, subject to the following conditions: \r\n\r\nThe above copyright and this permission notice shall be included in all copies of one or more of the Font Software typefaces.\r\n\r\nThe Font Software may be modified, altered, or added to, and in particular the designs of glyphs or characters in the Fonts may be modified and additional glyphs or characters may be added to the Fonts, only if the fonts are renamed to names not containing the word \"MgOpen\", or if the modifications are accepted for inclusion in the Font Software itself by the each appointed Administrator.\r\n\r\nThis License becomes null and void to the extent applicable to Fonts or Font Software that has been modified and is distributed under the \"MgOpen\" name.\r\n\r\nThe Font Software may be sold as part of a larger software package but no copy of one or more of the Font Software typefaces may be sold by itself. \r\n\r\nTHE FONT SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL MAGENTA OR PERSONS OR BODIES IN CHARGE OF ADMINISTRATION AND MAINTENANCE OF THE FONT SOFTWARE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.","manufacturer_name":"Μagenta ltd","font_sub_family_name":"Regular"},"descender":-334,"familyName":"Helvetiker","lineHeight":1522,"underlineThickness":50} -------------------------------------------------------------------------------- /src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IRobot1/clipper2-ts/eefbad501c878c3c28ecd39f7af210ba9b53c937/src/favicon.ico -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Clipper2Ts 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 2 | 3 | import { AppModule } from './app/app.module'; 4 | 5 | 6 | platformBrowserDynamic().bootstrapModule(AppModule) 7 | .catch(err => console.error(err)); 8 | -------------------------------------------------------------------------------- /src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | body { 3 | margin: 0; 4 | background-color: black; 5 | overflow: hidden; 6 | } 7 | -------------------------------------------------------------------------------- /tsconfig.app.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/app", 6 | "types": [] 7 | }, 8 | "files": [ 9 | "src/main.ts" 10 | ], 11 | "include": [ 12 | "src/**/*.d.ts" 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "compileOnSave": false, 4 | "compilerOptions": { 5 | "baseUrl": "./", 6 | "paths": { 7 | "clipper2-js": [ 8 | "projects/clipper2-js/src/public-api" 9 | ] 10 | }, 11 | "outDir": "./dist/out-tsc", 12 | "forceConsistentCasingInFileNames": true, 13 | "strict": true, 14 | "noImplicitOverride": true, 15 | "noPropertyAccessFromIndexSignature": true, 16 | "noImplicitReturns": true, 17 | "noFallthroughCasesInSwitch": true, 18 | "sourceMap": true, 19 | "declaration": false, 20 | "downlevelIteration": true, 21 | "experimentalDecorators": true, 22 | "moduleResolution": "node", 23 | "importHelpers": true, 24 | "target": "ES2022", 25 | "module": "ES2022", 26 | "useDefineForClassFields": false, 27 | "lib": [ 28 | "ES2022", 29 | "dom" 30 | ] 31 | }, 32 | "angularCompilerOptions": { 33 | "enableI18nLegacyMessageIdFormat": false, 34 | "strictInjectionParameters": true, 35 | "strictInputAccessModifiers": true, 36 | "strictTemplates": true 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/spec", 6 | "types": [ "jest" ], 7 | "esModuleInterop": true 8 | }, 9 | "include": [ 10 | "src/**/*.spec.ts", 11 | "src/**/*.d.ts" 12 | ] 13 | } 14 | --------------------------------------------------------------------------------