plotboilerplate 1.26.0 → 1.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/index.esm.js +33 -11
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.esm.min.js.map +1 -1
- package/dist/plotboilerplate.browser.min.js +1 -1
- package/dist/plotboilerplate.browser.min.js.map +1 -1
- package/dist/plotboilerplate.js +33 -11
- package/dist/plotboilerplate.min.js +1 -1
- package/package.json +6 -2
- package/src/cjs/PlotBoilerplate.d.ts +4 -3
- package/src/cjs/PlotBoilerplate.js +2 -1
- package/src/cjs/PlotBoilerplate.js.map +1 -1
- package/src/cjs/draw.d.ts +4 -2
- package/src/cjs/draw.js +9 -4
- package/src/cjs/draw.js.map +1 -1
- package/src/cjs/drawgl.d.ts +3 -2
- package/src/cjs/drawgl.js +2 -1
- package/src/cjs/drawgl.js.map +1 -1
- package/src/cjs/drawutilssvg.d.ts +9 -4
- package/src/cjs/drawutilssvg.js +20 -5
- package/src/cjs/drawutilssvg.js.map +1 -1
- package/src/cjs/interfaces/DrawLib.d.ts +2 -0
- package/src/cjs/interfaces/DrawLib.js +1 -0
- package/src/cjs/interfaces/DrawLib.js.map +1 -1
- package/src/cjs/utils/WebColors.d.ts +2 -1
- package/src/cjs/utils/WebColors.js +14 -25
- package/src/cjs/utils/WebColors.js.map +1 -1
- package/src/cjs/utils/algorithms/PolygonTesselationOutlines.d.ts +145 -0
- package/src/cjs/utils/algorithms/PolygonTesselationOutlines.js +269 -0
- package/src/cjs/utils/algorithms/PolygonTesselationOutlines.js.map +1 -0
- package/src/cjs/utils/datastructures/Color.js +0 -19
- package/src/cjs/utils/datastructures/Color.js.map +1 -1
- package/src/cjs/utils/datastructures/ColorGradient.d.ts +2 -0
- package/src/cjs/utils/datastructures/ColorGradient.js +5 -0
- package/src/cjs/utils/datastructures/ColorGradient.js.map +1 -1
- package/src/cjs/utils/datastructures/Girih.d.ts +38 -1
- package/src/cjs/utils/datastructures/Girih.js +71 -1
- package/src/cjs/utils/datastructures/Girih.js.map +1 -1
- package/src/cjs/utils/io/FileDrop.d.ts +2 -0
- package/src/cjs/utils/io/FileDrop.js +4 -0
- package/src/cjs/utils/io/FileDrop.js.map +1 -1
- package/src/esm/PlotBoilerplate.d.ts +4 -3
- package/src/esm/PlotBoilerplate.js +2 -1
- package/src/esm/PlotBoilerplate.js.map +1 -1
- package/src/esm/draw.d.ts +4 -2
- package/src/esm/draw.js +9 -4
- package/src/esm/draw.js.map +1 -1
- package/src/esm/drawgl.d.ts +3 -2
- package/src/esm/drawgl.js +2 -1
- package/src/esm/drawgl.js.map +1 -1
- package/src/esm/drawutilssvg.d.ts +9 -4
- package/src/esm/drawutilssvg.js +20 -5
- package/src/esm/drawutilssvg.js.map +1 -1
- package/src/esm/interfaces/DrawLib.d.ts +2 -0
- package/src/esm/interfaces/DrawLib.js +1 -0
- package/src/esm/interfaces/DrawLib.js.map +1 -1
- package/src/esm/utils/WebColors.d.ts +2 -1
- package/src/esm/utils/WebColors.js +14 -25
- package/src/esm/utils/WebColors.js.map +1 -1
- package/src/esm/utils/algorithms/PolygonTesselationOutlines.d.ts +145 -0
- package/src/esm/utils/algorithms/PolygonTesselationOutlines.js +262 -0
- package/src/esm/utils/algorithms/PolygonTesselationOutlines.js.map +1 -0
- package/src/esm/utils/datastructures/Color.js +0 -19
- package/src/esm/utils/datastructures/Color.js.map +1 -1
- package/src/esm/utils/datastructures/ColorGradient.d.ts +2 -0
- package/src/esm/utils/datastructures/ColorGradient.js +5 -0
- package/src/esm/utils/datastructures/ColorGradient.js.map +1 -1
- package/src/esm/utils/datastructures/Girih.d.ts +38 -1
- package/src/esm/utils/datastructures/Girih.js +71 -1
- package/src/esm/utils/datastructures/Girih.js.map +1 -1
- package/src/esm/utils/io/FileDrop.d.ts +2 -0
- package/src/esm/utils/io/FileDrop.js +4 -0
- package/src/esm/utils/io/FileDrop.js.map +1 -1
- package/src/ts/PlotBoilerplate.ts +4 -3
- package/src/ts/draw.ts +8 -3
- package/src/ts/drawgl.ts +3 -2
- package/src/ts/drawutilssvg.ts +27 -5
- package/src/ts/interfaces/DrawLib.ts +3 -0
- package/src/ts/utils/WebColors.ts +20 -33
- package/src/ts/utils/algorithms/PolygonTesselationOutlines.ts +296 -0
- package/src/ts/utils/datastructures/Color.ts +0 -19
- package/src/ts/utils/datastructures/ColorGradient.ts +6 -0
- package/src/ts/utils/datastructures/Girih.ts +78 -1
- package/src/ts/utils/datastructures/interfaces.ts +4 -4
- package/src/ts/utils/io/FileDrop.ts +5 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DrawLib.js","sourceRoot":"","sources":["../../ts/interfaces/DrawLib.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"DrawLib.js","sourceRoot":"","sources":["../../ts/interfaces/DrawLib.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA4BI"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @author Ikaros Kappler
|
|
3
|
-
* @version 1.0.1
|
|
4
3
|
* @date 2018-11-10
|
|
5
4
|
* @modified 2020-10-23 Ported to Typescript.
|
|
6
5
|
* @modified 2020-10-30 Exporting each color under its name globally.
|
|
6
|
+
* @modified 2025-12-08 Replaying self defined colors by official web colors.
|
|
7
|
+
* @version 1.0.2
|
|
7
8
|
**/
|
|
8
9
|
import { Color } from "./datastructures/Color";
|
|
9
10
|
export declare const Red: Color;
|
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
3
|
* @author Ikaros Kappler
|
|
4
|
-
* @version 1.0.1
|
|
5
4
|
* @date 2018-11-10
|
|
6
5
|
* @modified 2020-10-23 Ported to Typescript.
|
|
7
6
|
* @modified 2020-10-30 Exporting each color under its name globally.
|
|
7
|
+
* @modified 2025-12-08 Replaying self defined colors by official web colors.
|
|
8
|
+
* @version 1.0.2
|
|
8
9
|
**/
|
|
9
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
11
|
exports.shuffleWebColors = exports.WebColors = exports.LightGreen = exports.Green = exports.Teal = exports.Cyan = exports.LightBlue = exports.Blue = exports.Indigo = exports.DeepPurple = exports.Purple = exports.Pink = exports.Red = void 0;
|
|
11
12
|
var Color_1 = require("./datastructures/Color");
|
|
12
|
-
exports.Red = Color_1.Color.makeRGB(255,
|
|
13
|
-
exports.Pink = Color_1.Color.makeRGB(232,
|
|
14
|
-
exports.Purple = Color_1.Color.makeRGB(156,
|
|
15
|
-
exports.DeepPurple = Color_1.Color.makeRGB(103,
|
|
16
|
-
exports.Indigo = Color_1.Color.makeRGB(64,
|
|
17
|
-
exports.Blue = Color_1.Color.makeRGB(35,
|
|
18
|
-
exports.LightBlue = Color_1.Color.makeRGB(6,
|
|
19
|
-
exports.Cyan = Color_1.Color.makeRGB(3,
|
|
20
|
-
exports.Teal = Color_1.Color.makeRGB(1,
|
|
21
|
-
exports.Green = Color_1.Color.makeRGB(77,
|
|
22
|
-
exports.LightGreen = Color_1.Color.makeRGB(141,
|
|
13
|
+
exports.Red = Color_1.Color.Red; // Color.makeRGB(255,67,55);
|
|
14
|
+
exports.Pink = Color_1.Color.Pink; // Color.makeRGB(232,31,100);
|
|
15
|
+
exports.Purple = Color_1.Color.Purple; // Color.makeRGB(156,39,175);
|
|
16
|
+
exports.DeepPurple = Color_1.Color.DeepPink; // Color.makeRGB(103,59,184);
|
|
17
|
+
exports.Indigo = Color_1.Color.Indigo; // Color.makeRGB(64,81,181);
|
|
18
|
+
exports.Blue = Color_1.Color.Blue; // Color.makeRGB(35,151,245);
|
|
19
|
+
exports.LightBlue = Color_1.Color.LightBlue; // Color.makeRGB(6,170,245);
|
|
20
|
+
exports.Cyan = Color_1.Color.Cyan; // Color.makeRGB(3,189,214);
|
|
21
|
+
exports.Teal = Color_1.Color.Teal; // Color.makeRGB(1,150,137);
|
|
22
|
+
exports.Green = Color_1.Color.Green; // Color.makeRGB(77,175,82);
|
|
23
|
+
exports.LightGreen = Color_1.Color.LightGreen; // Color.makeRGB(141,195,67);
|
|
23
24
|
/**
|
|
24
25
|
* A set of beautiful web colors (I know, beauty is in the eye of the beholder).
|
|
25
26
|
*
|
|
@@ -29,19 +30,7 @@ exports.LightGreen = Color_1.Color.makeRGB(141, 195, 67);
|
|
|
29
30
|
* @requires Color
|
|
30
31
|
*
|
|
31
32
|
*/
|
|
32
|
-
exports.WebColors = [
|
|
33
|
-
exports.Red,
|
|
34
|
-
exports.Pink,
|
|
35
|
-
exports.Purple,
|
|
36
|
-
exports.DeepPurple,
|
|
37
|
-
exports.Indigo,
|
|
38
|
-
exports.Blue,
|
|
39
|
-
exports.LightBlue,
|
|
40
|
-
exports.Cyan,
|
|
41
|
-
exports.Teal,
|
|
42
|
-
exports.Green,
|
|
43
|
-
exports.LightGreen
|
|
44
|
-
];
|
|
33
|
+
exports.WebColors = [exports.Red, exports.Pink, exports.Purple, exports.DeepPurple, exports.Indigo, exports.Blue, exports.LightBlue, exports.Cyan, exports.Teal, exports.Green, exports.LightGreen];
|
|
45
34
|
/**
|
|
46
35
|
* A helper function to shuffle the colors into a new order.
|
|
47
36
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebColors.js","sourceRoot":"","sources":["../../ts/utils/WebColors.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"WebColors.js","sourceRoot":"","sources":["../../ts/utils/WebColors.ts"],"names":[],"mappings":";AAAA;;;;;;;IAOI;;;AAEJ,gDAA+C;AAElC,QAAA,GAAG,GAAU,aAAK,CAAC,GAAG,CAAC,CAAC,4BAA4B;AACpD,QAAA,IAAI,GAAU,aAAK,CAAC,IAAI,CAAC,CAAC,6BAA6B;AACvD,QAAA,MAAM,GAAU,aAAK,CAAC,MAAM,CAAC,CAAC,6BAA6B;AAC3D,QAAA,UAAU,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` will return a simple graph containing all vertices and edges
|
|
5
|
+
* that belong to the outer hull.
|
|
6
|
+
*
|
|
7
|
+
* The method `findAllOutlinesPolygons` will detect connected paths inside the graph and return
|
|
8
|
+
* an array of Polygons.
|
|
9
|
+
*
|
|
10
|
+
*
|
|
11
|
+
* @require detectPaths
|
|
12
|
+
*
|
|
13
|
+
* @author Ikaros Kappler
|
|
14
|
+
* @date 2026-01-20
|
|
15
|
+
* @version 1.0.0
|
|
16
|
+
*/
|
|
17
|
+
import { Polygon } from "../../Polygon";
|
|
18
|
+
import { Vertex } from "../../Vertex";
|
|
19
|
+
import { IndexPair } from "../datastructures/interfaces";
|
|
20
|
+
export interface PolygonTesselationOutlinesOptions {
|
|
21
|
+
tolerance?: number;
|
|
22
|
+
removeUnusedVertices?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface TesselationGraph {
|
|
25
|
+
vertices: Array<Vertex>;
|
|
26
|
+
edges: Array<IndexPair>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Convert any non-intersecting tesselation to a graph.
|
|
30
|
+
* Adjadent tiles (polygons) will result in duplicate edges.
|
|
31
|
+
*
|
|
32
|
+
* @param {Polygon[]} polygons - The polygon tesselation to use.
|
|
33
|
+
* @return {TesselationGraph} A tesselation graph.
|
|
34
|
+
*/
|
|
35
|
+
export declare const polygonTesselationToGraph: (polygons: Polygon[]) => TesselationGraph;
|
|
36
|
+
/**
|
|
37
|
+
* A class to calculate the tesselation's outer hull.
|
|
38
|
+
*/
|
|
39
|
+
export declare class PolygonTesselationOutlines {
|
|
40
|
+
static readonly DEFAULT_TOLERANCE = 0.01;
|
|
41
|
+
private readonly polygons;
|
|
42
|
+
private readonly tolerance;
|
|
43
|
+
private readonly removeUnusedVertices;
|
|
44
|
+
/**
|
|
45
|
+
* @constructor
|
|
46
|
+
* @param {Polygon[]} polygons - The polygon tesselation to use.
|
|
47
|
+
* @param {PolygonTesselationOutlinesOptions} options - (optional)
|
|
48
|
+
*/
|
|
49
|
+
constructor(polygons: Polygon[], options?: PolygonTesselationOutlinesOptions);
|
|
50
|
+
/**
|
|
51
|
+
* Clears duplicate edges.
|
|
52
|
+
*
|
|
53
|
+
* Note: this works only for duplicates. Triplets will not be removed.
|
|
54
|
+
*
|
|
55
|
+
* @name __eliminateDuplicateEdges
|
|
56
|
+
* @private
|
|
57
|
+
* @memberof TesselationGraph
|
|
58
|
+
* @instance
|
|
59
|
+
* @param {TesselationGraph} tesselationGraph - The tesselation graph to remove duplicate edges from.
|
|
60
|
+
* @return {TesselationGraph} A new tesselation graph with cleaned up edges.
|
|
61
|
+
*/
|
|
62
|
+
private __eliminateDuplicateEdges;
|
|
63
|
+
/**
|
|
64
|
+
* Locate some edge that adjacent to the given vertex index
|
|
65
|
+
*
|
|
66
|
+
* @name __locateEdgeWithVertIndex
|
|
67
|
+
* @private
|
|
68
|
+
* @memberof TesselationGraph
|
|
69
|
+
* @instance
|
|
70
|
+
* @param {number} vertIndex - The vertex index to find an edge for.
|
|
71
|
+
* @param {TesselationGraph} tesselationGraph - The tesselation graph to remove unused vertices from.
|
|
72
|
+
* @return {number} The edge index that's adjacent to the given vertex index.
|
|
73
|
+
* @return -1 if no such edge is found.
|
|
74
|
+
*/
|
|
75
|
+
private __locateEdgeWithVertIndex;
|
|
76
|
+
/**
|
|
77
|
+
* Removes all unused vertices from the graph and re-matps the edges.
|
|
78
|
+
*
|
|
79
|
+
* @name __removeUnusedVertices
|
|
80
|
+
* @private
|
|
81
|
+
* @memberof TesselationGraph
|
|
82
|
+
* @instance
|
|
83
|
+
* @param {TesselationGraph} tesselationGraph - The tesselation graph to remove unused vertices from.
|
|
84
|
+
* @return {TesselationGraph} A new tesselation graph.
|
|
85
|
+
*/
|
|
86
|
+
private __removeUnusedVertices;
|
|
87
|
+
/**
|
|
88
|
+
* Creates a tesselation graph and removes all inner edges.
|
|
89
|
+
*
|
|
90
|
+
* @name findAllOutlinesGraph
|
|
91
|
+
* @private
|
|
92
|
+
* @memberof PolygonTesselationOutlines
|
|
93
|
+
* @instance
|
|
94
|
+
* @return {TesselationGraph} A tesselation graph containing the outer hull edges only.
|
|
95
|
+
*/
|
|
96
|
+
findAllOutlinesGraph(): TesselationGraph;
|
|
97
|
+
/**
|
|
98
|
+
* Convert any generic path to a polygon. Each path segment (start point and end point)
|
|
99
|
+
* are interpreted as a linear segment here.
|
|
100
|
+
*
|
|
101
|
+
* @name __convertGenericPathToPolygon
|
|
102
|
+
* @private
|
|
103
|
+
* @memberof PolygonTesselationOutlines
|
|
104
|
+
* @instance
|
|
105
|
+
* @param {GenericPath} path - The path to convert.
|
|
106
|
+
*/
|
|
107
|
+
private __convertGenericPathToPolygon;
|
|
108
|
+
/**
|
|
109
|
+
* Creates a tesselation graph and removes all inner edges.
|
|
110
|
+
*
|
|
111
|
+
* @name findAllOutlinesPolygons
|
|
112
|
+
* @private
|
|
113
|
+
* @memberof PolygonTesselationOutlines
|
|
114
|
+
* @instance
|
|
115
|
+
* @param {TesselationGraph} tesselationGraph - Find all outlines on the tesselation graph.
|
|
116
|
+
*/
|
|
117
|
+
findAllOutlinesPolygons(tesselationGraph: TesselationGraph): Array<Polygon>;
|
|
118
|
+
/**
|
|
119
|
+
* Checks if two vertices are equal – regarding to the current tolerance setting.
|
|
120
|
+
*
|
|
121
|
+
* @name __isEqualPoint
|
|
122
|
+
* @private
|
|
123
|
+
* @memberof PolygonTesselationOutlines
|
|
124
|
+
* @instance
|
|
125
|
+
* @param {boolean} vertA - The first point.
|
|
126
|
+
* @param {boolean} vertB - The second point.
|
|
127
|
+
* @return True if the vertices are equal.
|
|
128
|
+
*/
|
|
129
|
+
private __isEqualPoint;
|
|
130
|
+
/**
|
|
131
|
+
* Checks if two edges (identified as two pairs of vertices) are equal – regarding to the
|
|
132
|
+
* current tolerance setting.
|
|
133
|
+
*
|
|
134
|
+
* @name __isEqualEdge
|
|
135
|
+
* @private
|
|
136
|
+
* @memberof PolygonTesselationOutlines
|
|
137
|
+
* @instance
|
|
138
|
+
* @param {boolean} edgeAvertA - The first edge's point A.
|
|
139
|
+
* @param {boolean} edgeAvertB - The first edge's point B.
|
|
140
|
+
* @param {boolean} edgeBvertA - The second edge's point A.
|
|
141
|
+
* @param {boolean} edgeBvertB - The second edge's point B.
|
|
142
|
+
* @return True if the edges are equal.
|
|
143
|
+
*/
|
|
144
|
+
private __isEqualEdge;
|
|
145
|
+
}
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Find the outer hull outlines of a (not necessarily full connected) polygon tesellation.
|
|
4
|
+
*
|
|
5
|
+
* The method `findAllOutlinesGraph` will return a simple graph containing all vertices and edges
|
|
6
|
+
* that belong to the outer hull.
|
|
7
|
+
*
|
|
8
|
+
* The method `findAllOutlinesPolygons` will detect connected paths inside the graph and return
|
|
9
|
+
* an array of Polygons.
|
|
10
|
+
*
|
|
11
|
+
*
|
|
12
|
+
* @require detectPaths
|
|
13
|
+
*
|
|
14
|
+
* @author Ikaros Kappler
|
|
15
|
+
* @date 2026-01-20
|
|
16
|
+
* @version 1.0.0
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.PolygonTesselationOutlines = exports.polygonTesselationToGraph = void 0;
|
|
20
|
+
var Line_1 = require("../../Line");
|
|
21
|
+
var Polygon_1 = require("../../Polygon");
|
|
22
|
+
var arrayFill_1 = require("./arrayFill");
|
|
23
|
+
var detectPaths_1 = require("./detectPaths");
|
|
24
|
+
/**
|
|
25
|
+
* Convert any non-intersecting tesselation to a graph.
|
|
26
|
+
* Adjadent tiles (polygons) will result in duplicate edges.
|
|
27
|
+
*
|
|
28
|
+
* @param {Polygon[]} polygons - The polygon tesselation to use.
|
|
29
|
+
* @return {TesselationGraph} A tesselation graph.
|
|
30
|
+
*/
|
|
31
|
+
var polygonTesselationToGraph = function (polygons) {
|
|
32
|
+
var vertices = [];
|
|
33
|
+
var edges = [];
|
|
34
|
+
// const vertexPolygonMapping: Array<number>[] = []; // Map polygon+vertex to graph vertices
|
|
35
|
+
for (var i = 0; i < polygons.length; i++) {
|
|
36
|
+
var polygon = polygons[i];
|
|
37
|
+
var polygonMapping = [];
|
|
38
|
+
// vertexPolygonMapping.push(polygonMapping);
|
|
39
|
+
// Add vertices
|
|
40
|
+
for (var j = 0; j < polygon.vertices.length; j++) {
|
|
41
|
+
var graphVertIndex = vertices.length;
|
|
42
|
+
vertices.push(polygon.vertices[j]);
|
|
43
|
+
polygonMapping.push(graphVertIndex);
|
|
44
|
+
}
|
|
45
|
+
// Now add edges
|
|
46
|
+
for (var j = 0; j < polygon.vertices.length; j++) {
|
|
47
|
+
var polyEdgeIndexA = j;
|
|
48
|
+
var polyEdgeIndexB = (j + 1) % polygon.vertices.length;
|
|
49
|
+
var grapgVertIndexA = polygonMapping[polyEdgeIndexA];
|
|
50
|
+
var grapgVertIndexB = polygonMapping[polyEdgeIndexB];
|
|
51
|
+
edges.push({ i: grapgVertIndexA, j: grapgVertIndexB });
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return { vertices: vertices, edges: edges };
|
|
55
|
+
};
|
|
56
|
+
exports.polygonTesselationToGraph = polygonTesselationToGraph;
|
|
57
|
+
/**
|
|
58
|
+
* A class to calculate the tesselation's outer hull.
|
|
59
|
+
*/
|
|
60
|
+
var PolygonTesselationOutlines = /** @class */ (function () {
|
|
61
|
+
/**
|
|
62
|
+
* @constructor
|
|
63
|
+
* @param {Polygon[]} polygons - The polygon tesselation to use.
|
|
64
|
+
* @param {PolygonTesselationOutlinesOptions} options - (optional)
|
|
65
|
+
*/
|
|
66
|
+
function PolygonTesselationOutlines(polygons, options) {
|
|
67
|
+
var _a, _b;
|
|
68
|
+
this.polygons = polygons;
|
|
69
|
+
// this.tesselationGraph = tesselationToGraph(polygons);
|
|
70
|
+
this.tolerance = (_a = options === null || options === void 0 ? void 0 : options.tolerance) !== null && _a !== void 0 ? _a : PolygonTesselationOutlines.DEFAULT_TOLERANCE;
|
|
71
|
+
this.removeUnusedVertices = (_b = options === null || options === void 0 ? void 0 : options.removeUnusedVertices) !== null && _b !== void 0 ? _b : true;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Clears duplicate edges.
|
|
75
|
+
*
|
|
76
|
+
* Note: this works only for duplicates. Triplets will not be removed.
|
|
77
|
+
*
|
|
78
|
+
* @name __eliminateDuplicateEdges
|
|
79
|
+
* @private
|
|
80
|
+
* @memberof TesselationGraph
|
|
81
|
+
* @instance
|
|
82
|
+
* @param {TesselationGraph} tesselationGraph - The tesselation graph to remove duplicate edges from.
|
|
83
|
+
* @return {TesselationGraph} A new tesselation graph with cleaned up edges.
|
|
84
|
+
*/
|
|
85
|
+
PolygonTesselationOutlines.prototype.__eliminateDuplicateEdges = function (tesselationGraph) {
|
|
86
|
+
var newEdges = [];
|
|
87
|
+
for (var e = 0; e < tesselationGraph.edges.length; e++) {
|
|
88
|
+
var curEdge = tesselationGraph.edges[e];
|
|
89
|
+
if (!curEdge) {
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
var curA = tesselationGraph.vertices[curEdge.i];
|
|
93
|
+
var curB = tesselationGraph.vertices[curEdge.j];
|
|
94
|
+
for (var f = 0; f < tesselationGraph.edges.length; f++) {
|
|
95
|
+
if (e === f) {
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
var otherEdge = tesselationGraph.edges[f];
|
|
99
|
+
if (!otherEdge) {
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
var otherA = tesselationGraph.vertices[otherEdge.i];
|
|
103
|
+
var otherB = tesselationGraph.vertices[otherEdge.j];
|
|
104
|
+
if (this.__isEqualEdge(curA, curB, otherA, otherB)) {
|
|
105
|
+
// Both edges are equal -> remove both
|
|
106
|
+
tesselationGraph.edges[e] = null;
|
|
107
|
+
tesselationGraph.edges[f] = null;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
// return tesselationGraph; // TODO: create clean clone with new mapping
|
|
112
|
+
// Clear null-records.
|
|
113
|
+
return {
|
|
114
|
+
vertices: tesselationGraph.vertices,
|
|
115
|
+
edges: tesselationGraph.edges.filter(function (edge) { return edge != null; })
|
|
116
|
+
}; // TODO: create clean clone with new mapping
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Locate some edge that adjacent to the given vertex index
|
|
120
|
+
*
|
|
121
|
+
* @name __locateEdgeWithVertIndex
|
|
122
|
+
* @private
|
|
123
|
+
* @memberof TesselationGraph
|
|
124
|
+
* @instance
|
|
125
|
+
* @param {number} vertIndex - The vertex index to find an edge for.
|
|
126
|
+
* @param {TesselationGraph} tesselationGraph - The tesselation graph to remove unused vertices from.
|
|
127
|
+
* @return {number} The edge index that's adjacent to the given vertex index.
|
|
128
|
+
* @return -1 if no such edge is found.
|
|
129
|
+
*/
|
|
130
|
+
PolygonTesselationOutlines.prototype.__locateEdgeWithVertIndex = function (vertIndex, tesselationGraph) {
|
|
131
|
+
return tesselationGraph.edges.findIndex(function (edge) { return edge.i == vertIndex || edge.j == vertIndex; });
|
|
132
|
+
};
|
|
133
|
+
/**
|
|
134
|
+
* Removes all unused vertices from the graph and re-matps the edges.
|
|
135
|
+
*
|
|
136
|
+
* @name __removeUnusedVertices
|
|
137
|
+
* @private
|
|
138
|
+
* @memberof TesselationGraph
|
|
139
|
+
* @instance
|
|
140
|
+
* @param {TesselationGraph} tesselationGraph - The tesselation graph to remove unused vertices from.
|
|
141
|
+
* @return {TesselationGraph} A new tesselation graph.
|
|
142
|
+
*/
|
|
143
|
+
PolygonTesselationOutlines.prototype.__removeUnusedVertices = function (tesselationGraph) {
|
|
144
|
+
// First remove un-used vertices and re-map indices.
|
|
145
|
+
var newVertices = [];
|
|
146
|
+
var indexMapping = (0, arrayFill_1.arrayFill)(tesselationGraph.vertices.length, -1);
|
|
147
|
+
for (var j = 0; j < tesselationGraph.vertices.length; j++) {
|
|
148
|
+
var edgeIndex = this.__locateEdgeWithVertIndex(j, tesselationGraph);
|
|
149
|
+
if (edgeIndex === -1) {
|
|
150
|
+
// No adjacent edge found -> vertex is not in use
|
|
151
|
+
// Ignore; index mapping remains to -1
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
// Keep vertex
|
|
155
|
+
var newIndex = newVertices.length;
|
|
156
|
+
newVertices.push(tesselationGraph.vertices[j]);
|
|
157
|
+
indexMapping[j] = newIndex;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
// Now re-map the egdes
|
|
161
|
+
var newEdges = [];
|
|
162
|
+
for (var j = 0; j < tesselationGraph.edges.length; j++) {
|
|
163
|
+
var edge = tesselationGraph.edges[j];
|
|
164
|
+
newEdges.push({ i: indexMapping[edge.i], j: indexMapping[edge.j] });
|
|
165
|
+
}
|
|
166
|
+
return { vertices: newVertices, edges: newEdges };
|
|
167
|
+
};
|
|
168
|
+
/**
|
|
169
|
+
* Creates a tesselation graph and removes all inner edges.
|
|
170
|
+
*
|
|
171
|
+
* @name findAllOutlinesGraph
|
|
172
|
+
* @private
|
|
173
|
+
* @memberof PolygonTesselationOutlines
|
|
174
|
+
* @instance
|
|
175
|
+
* @return {TesselationGraph} A tesselation graph containing the outer hull edges only.
|
|
176
|
+
*/
|
|
177
|
+
PolygonTesselationOutlines.prototype.findAllOutlinesGraph = function () {
|
|
178
|
+
// First build tesselation graph from polygons, containing all edges and vertices.
|
|
179
|
+
var tesselationGraph = (0, exports.polygonTesselationToGraph)(this.polygons);
|
|
180
|
+
// Now eliminate all duplicate edges. By construction only inner edges are duplicates.
|
|
181
|
+
var outerHull = this.__eliminateDuplicateEdges(tesselationGraph);
|
|
182
|
+
// Only of requested remove unused vertices.
|
|
183
|
+
if (this.removeUnusedVertices) {
|
|
184
|
+
var cleanOuterHull = this.__removeUnusedVertices(outerHull);
|
|
185
|
+
return cleanOuterHull;
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
return outerHull;
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
/**
|
|
192
|
+
* Convert any generic path to a polygon. Each path segment (start point and end point)
|
|
193
|
+
* are interpreted as a linear segment here.
|
|
194
|
+
*
|
|
195
|
+
* @name __convertGenericPathToPolygon
|
|
196
|
+
* @private
|
|
197
|
+
* @memberof PolygonTesselationOutlines
|
|
198
|
+
* @instance
|
|
199
|
+
* @param {GenericPath} path - The path to convert.
|
|
200
|
+
*/
|
|
201
|
+
PolygonTesselationOutlines.prototype.__convertGenericPathToPolygon = function (path) {
|
|
202
|
+
var vertices = [];
|
|
203
|
+
var n = path.getSegmentCount();
|
|
204
|
+
var isOpen = false;
|
|
205
|
+
for (var i = 0; i < n; i++) {
|
|
206
|
+
var segment = path.getSegmentAt(i);
|
|
207
|
+
vertices.push(segment.getStartPoint());
|
|
208
|
+
if (i > 0 && i + 1 >= n && !this.__isEqualPoint(segment.getEndPoint(), vertices[0])) {
|
|
209
|
+
isOpen = true;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
return new Polygon_1.Polygon(vertices, isOpen);
|
|
213
|
+
};
|
|
214
|
+
/**
|
|
215
|
+
* Creates a tesselation graph and removes all inner edges.
|
|
216
|
+
*
|
|
217
|
+
* @name findAllOutlinesPolygons
|
|
218
|
+
* @private
|
|
219
|
+
* @memberof PolygonTesselationOutlines
|
|
220
|
+
* @instance
|
|
221
|
+
* @param {TesselationGraph} tesselationGraph - Find all outlines on the tesselation graph.
|
|
222
|
+
*/
|
|
223
|
+
PolygonTesselationOutlines.prototype.findAllOutlinesPolygons = function (tesselationGraph) {
|
|
224
|
+
var _this = this;
|
|
225
|
+
// Convert to real line segments:
|
|
226
|
+
var lineSegments = tesselationGraph.edges.map(function (edge) { return new Line_1.Line(tesselationGraph.vertices[edge.i], tesselationGraph.vertices[edge.j]); });
|
|
227
|
+
// Now run the path detection.
|
|
228
|
+
var paths = (0, detectPaths_1.detectPaths)(lineSegments, this.tolerance);
|
|
229
|
+
// And now convert the generic paths back to polygons
|
|
230
|
+
// (we have put in line segments, so line segments must have returned)
|
|
231
|
+
return paths.map(function (path) { return _this.__convertGenericPathToPolygon(path); });
|
|
232
|
+
};
|
|
233
|
+
/**
|
|
234
|
+
* Checks if two vertices are equal – regarding to the current tolerance setting.
|
|
235
|
+
*
|
|
236
|
+
* @name __isEqualPoint
|
|
237
|
+
* @private
|
|
238
|
+
* @memberof PolygonTesselationOutlines
|
|
239
|
+
* @instance
|
|
240
|
+
* @param {boolean} vertA - The first point.
|
|
241
|
+
* @param {boolean} vertB - The second point.
|
|
242
|
+
* @return True if the vertices are equal.
|
|
243
|
+
*/
|
|
244
|
+
PolygonTesselationOutlines.prototype.__isEqualPoint = function (vertA, vertB) {
|
|
245
|
+
return vertA.distance(vertB) < this.tolerance;
|
|
246
|
+
};
|
|
247
|
+
/**
|
|
248
|
+
* Checks if two edges (identified as two pairs of vertices) are equal – regarding to the
|
|
249
|
+
* current tolerance setting.
|
|
250
|
+
*
|
|
251
|
+
* @name __isEqualEdge
|
|
252
|
+
* @private
|
|
253
|
+
* @memberof PolygonTesselationOutlines
|
|
254
|
+
* @instance
|
|
255
|
+
* @param {boolean} edgeAvertA - The first edge's point A.
|
|
256
|
+
* @param {boolean} edgeAvertB - The first edge's point B.
|
|
257
|
+
* @param {boolean} edgeBvertA - The second edge's point A.
|
|
258
|
+
* @param {boolean} edgeBvertB - The second edge's point B.
|
|
259
|
+
* @return True if the edges are equal.
|
|
260
|
+
*/
|
|
261
|
+
PolygonTesselationOutlines.prototype.__isEqualEdge = function (edgeAvertA, edgeAvertB, edgeBvertA, edgeBvertB) {
|
|
262
|
+
return ((this.__isEqualPoint(edgeAvertA, edgeBvertA) && this.__isEqualPoint(edgeAvertB, edgeBvertB)) ||
|
|
263
|
+
(this.__isEqualPoint(edgeAvertA, edgeBvertB) && this.__isEqualPoint(edgeAvertB, edgeBvertA)));
|
|
264
|
+
};
|
|
265
|
+
PolygonTesselationOutlines.DEFAULT_TOLERANCE = 0.01;
|
|
266
|
+
return PolygonTesselationOutlines;
|
|
267
|
+
}());
|
|
268
|
+
exports.PolygonTesselationOutlines = PolygonTesselationOutlines;
|
|
269
|
+
//# sourceMappingURL=PolygonTesselationOutlines.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PolygonTesselationOutlines.js","sourceRoot":"","sources":["../../../ts/utils/algorithms/PolygonTesselationOutlines.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,mCAAkC;AAClC,yCAAwC;AAKxC,yCAAwC;AACxC,6CAA4C;AAY5C;;;;;;GAMG;AACI,IAAM,yBAAyB,GAAG,UAAC,QAAmB;IAC3D,IAAM,QAAQ,GAAkB,EAAE,CAAC;IACnC,IAAM,KAAK,GAAqB,EAAE,CAAC;IACnC,4FAA4F;IAC5F,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACzC,IAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;QAC5B,IAAM,cAAc,GAAkB,EAAE,CAAC;QACzC,6CAA6C;QAC7C,eAAe;QACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACjD,IAAM,cAAc,GAAG,QAAQ,CAAC,MAAM,CAAC;YACvC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;YACnC,cAAc,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACtC,CAAC;QACD,gBAAgB;QAChB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACjD,IAAM,cAAc,GAAG,CAAC,CAAC;YACzB,IAAM,cAAc,GAAG,CAAC,CAAC,GAAG,CAAC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|
|
|
312
312
|
Color.Converter.HSLToRGB(this);
|
|
313
313
|
return this;
|
|
314
314
|
};
|
|
315
|
-
// lighten(v: string | number): Color {
|
|
316
|
-
// if ("string" == typeof v && v.indexOf("%") > -1 && (v = parseInt(v)) != NaN) {
|
|
317
|
-
// this.l += v / 100;
|
|
318
|
-
// } else if ("number" == typeof v) {
|
|
319
|
-
// if (v >= -1.0 && v <= 1.0) {
|
|
320
|
-
// // range 0.0...1.0
|
|
321
|
-
// this.l += v;
|
|
322
|
-
// } else {
|
|
323
|
-
// // range 255
|
|
324
|
-
// this.l += v / 255;
|
|
325
|
-
// }
|
|
326
|
-
// } else {
|
|
327
|
-
// throw new Error("error: bad modifier format (percent or number)");
|
|
328
|
-
// }
|
|
329
|
-
// if (this.l > 1) this.l = 1;
|
|
330
|
-
// else if (this.l < 0) this.l = 0;
|
|
331
|
-
// Color.Converter.HSLToRGB(this);
|
|
332
|
-
// return this;
|
|
333
|
-
// }
|
|
334
315
|
Color.prototype.lighten = function (v) {
|
|
335
316
|
// if ("string" == typeof v && v.indexOf("%") > -1 && (v = parseInt(v)) != NaN) {
|
|
336
317
|
if ("string" == typeof v && v.indexOf("%") > -1 && !Number.isNaN((v = parseInt(v)))) {
|