plotboilerplate 1.18.0 → 1.19.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/dist/index.esm.js +166 -39
- 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 +164 -37
- package/dist/plotboilerplate.min.js +1 -1
- package/package.json +1 -1
- package/src/cjs/Bounds.d.ts +11 -1
- package/src/cjs/Bounds.js +13 -1
- package/src/cjs/Bounds.js.map +1 -1
- package/src/cjs/CubicBezierCurve.d.ts +20 -3
- package/src/cjs/CubicBezierCurve.js +25 -2
- package/src/cjs/CubicBezierCurve.js.map +1 -1
- package/src/cjs/Line.d.ts +46 -4
- package/src/cjs/Line.js +60 -3
- package/src/cjs/Line.js.map +1 -1
- package/src/cjs/PlotBoilerplate.d.ts +4 -2
- package/src/cjs/PlotBoilerplate.js +44 -28
- package/src/cjs/PlotBoilerplate.js.map +1 -1
- package/src/cjs/Polygon.js +1 -1
- package/src/cjs/Polygon.js.map +1 -1
- package/src/cjs/Vector.d.ts +14 -3
- package/src/cjs/Vector.js +21 -2
- package/src/cjs/Vector.js.map +1 -1
- package/src/cjs/interfaces/additionals.d.ts +95 -0
- package/src/cjs/interfaces/additionals.js +3 -0
- package/src/cjs/interfaces/additionals.js.map +1 -0
- package/src/cjs/interfaces/core.d.ts +4 -0
- package/src/cjs/interfaces/core.js +1 -0
- package/src/cjs/interfaces/core.js.map +1 -1
- package/src/cjs/interfaces/index.d.ts +1 -0
- package/src/cjs/interfaces/index.js +1 -0
- package/src/cjs/interfaces/index.js.map +1 -1
- package/src/cjs/utils/algorithms/arrayShuffle.d.ts +8 -0
- package/src/cjs/utils/algorithms/arrayShuffle.js +15 -0
- package/src/cjs/utils/algorithms/arrayShuffle.js.map +1 -0
- package/src/cjs/utils/algorithms/detectPaths.d.ts +20 -0
- package/src/cjs/utils/algorithms/detectPaths.js +169 -0
- package/src/cjs/utils/algorithms/detectPaths.js.map +1 -0
- package/src/cjs/utils/datastructures/GenericPath.d.ts +75 -0
- package/src/cjs/utils/datastructures/GenericPath.js +105 -0
- package/src/cjs/utils/datastructures/GenericPath.js.map +1 -0
- package/src/cjs/utils/datastructures/GirihTile.d.ts +1 -1
- package/src/esm/Bounds.d.ts +11 -1
- package/src/esm/Bounds.js +13 -1
- package/src/esm/Bounds.js.map +1 -1
- package/src/esm/CubicBezierCurve.d.ts +20 -3
- package/src/esm/CubicBezierCurve.js +25 -2
- package/src/esm/CubicBezierCurve.js.map +1 -1
- package/src/esm/Line.d.ts +46 -4
- package/src/esm/Line.js +60 -3
- package/src/esm/Line.js.map +1 -1
- package/src/esm/PlotBoilerplate.d.ts +4 -2
- package/src/esm/PlotBoilerplate.js +44 -28
- package/src/esm/PlotBoilerplate.js.map +1 -1
- package/src/esm/Polygon.js +1 -1
- package/src/esm/Polygon.js.map +1 -1
- package/src/esm/Vector.d.ts +13 -2
- package/src/esm/Vector.js +23 -4
- package/src/esm/Vector.js.map +1 -1
- package/src/esm/interfaces/additionals.d.ts +95 -0
- package/src/esm/interfaces/additionals.js +2 -0
- package/src/esm/interfaces/additionals.js.map +1 -0
- package/src/esm/interfaces/core.d.ts +4 -0
- package/src/esm/interfaces/core.js +1 -0
- package/src/esm/interfaces/core.js.map +1 -1
- package/src/esm/interfaces/index.d.ts +1 -0
- package/src/esm/interfaces/index.js +1 -0
- package/src/esm/interfaces/index.js.map +1 -1
- package/src/esm/utils/algorithms/arrayShuffle.d.ts +8 -0
- package/src/esm/utils/algorithms/arrayShuffle.js +11 -0
- package/src/esm/utils/algorithms/arrayShuffle.js.map +1 -0
- package/src/esm/utils/algorithms/detectPaths.d.ts +20 -0
- package/src/esm/utils/algorithms/detectPaths.js +165 -0
- package/src/esm/utils/algorithms/detectPaths.js.map +1 -0
- package/src/esm/utils/datastructures/GenericPath.d.ts +75 -0
- package/src/esm/utils/datastructures/GenericPath.js +100 -0
- package/src/esm/utils/datastructures/GenericPath.js.map +1 -0
- package/src/esm/utils/datastructures/GirihTile.d.ts +1 -1
- package/src/ts/Bounds.ts +14 -1
- package/src/ts/CubicBezierCurve.ts +29 -4
- package/src/ts/Line.ts +70 -6
- package/src/ts/PlotBoilerplate.ts +47 -32
- package/src/ts/Polygon.ts +1 -1
- package/src/ts/Vector.ts +24 -4
- package/src/ts/interfaces/additionals.ts +105 -0
- package/src/ts/interfaces/core.ts +2 -0
- package/src/ts/interfaces/index.ts +1 -0
- package/src/ts/utils/algorithms/arrayShuffle.ts +11 -0
- package/src/ts/utils/algorithms/detectPaths.ts +195 -0
- package/src/ts/utils/datastructures/GenericPath.ts +113 -0
- package/src/ts/utils/datastructures/GirihTile.ts +1 -1
- package/changelog.md +0 -731
|
@@ -13,4 +13,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
13
13
|
__exportStar(require("./core"), exports);
|
|
14
14
|
__exportStar(require("./DrawLib"), exports);
|
|
15
15
|
__exportStar(require("./externals"), exports);
|
|
16
|
+
__exportStar(require("./additionals"), exports);
|
|
16
17
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/interfaces/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAuB;AACvB,4CAA0B;AAC1B,8CAA4B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/interfaces/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAuB;AACvB,4CAA0B;AAC1B,8CAA4B;AAC5B,gDAA8B"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Randomize a given array in-place.
|
|
4
|
+
*
|
|
5
|
+
* @author Ikaros Kappler
|
|
6
|
+
* @date 2022-10-09
|
|
7
|
+
* @version 1.0.0
|
|
8
|
+
**/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.arrayShuffle = void 0;
|
|
11
|
+
var arrayShuffle = function (arr) {
|
|
12
|
+
arr.sort(function () { return Math.random() - 0.5; });
|
|
13
|
+
};
|
|
14
|
+
exports.arrayShuffle = arrayShuffle;
|
|
15
|
+
//# sourceMappingURL=arrayShuffle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arrayShuffle.js","sourceRoot":"","sources":["../../../ts/utils/algorithms/arrayShuffle.ts"],"names":[],"mappings":";AAAA;;;;;;IAMI;;;AAEG,IAAM,YAAY,GAAG,UAAC,GAAe;IAC1C,GAAG,CAAC,IAAI,CAAC,cAAM,OAAA,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,EAAnB,CAAmB,CAAC,CAAC;AACtC,CAAC,CAAC;AAFW,QAAA,YAAY,gBAEvB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A function to detect connected paths on the plane given by a random set of segments.
|
|
3
|
+
*
|
|
4
|
+
* Note that is algorithm operates IN PLACE and will ALTER your INPUT array.
|
|
5
|
+
*
|
|
6
|
+
* @author Ikaros Kappler
|
|
7
|
+
* @version 1.0.0
|
|
8
|
+
* @date 2022-10-17
|
|
9
|
+
*/
|
|
10
|
+
import { Path, PathSegment } from "../../interfaces";
|
|
11
|
+
/**
|
|
12
|
+
* Run a path detection on the given set of path segments.
|
|
13
|
+
*
|
|
14
|
+
* Note that the array and some path segments may be altered (like reversal) IN PLACE.
|
|
15
|
+
*
|
|
16
|
+
* @param {Array<PathSegment>} segments - The total set (array) of available path segments.
|
|
17
|
+
* @param {number=1.0} epsilon - (optional) An epsilon to use to tell if two plane points should be considered 'equal'.
|
|
18
|
+
* @returns {Array<GenericPath>} An array containing all detected path (consisting of adjacent path segments of the original set).
|
|
19
|
+
*/
|
|
20
|
+
export declare const detectPaths: (segments: Array<PathSegment>, epsilon?: number) => Array<Path>;
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* A function to detect connected paths on the plane given by a random set of segments.
|
|
4
|
+
*
|
|
5
|
+
* Note that is algorithm operates IN PLACE and will ALTER your INPUT array.
|
|
6
|
+
*
|
|
7
|
+
* @author Ikaros Kappler
|
|
8
|
+
* @version 1.0.0
|
|
9
|
+
* @date 2022-10-17
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.detectPaths = void 0;
|
|
13
|
+
var GenericPath_1 = require("../datastructures/GenericPath");
|
|
14
|
+
/**
|
|
15
|
+
* A private helper function that initializes the visitation tracking and reverses
|
|
16
|
+
* dangling path ends to connect them with preceding paths.
|
|
17
|
+
*
|
|
18
|
+
* Note that this function alters those dangling path segments IN PLACE!
|
|
19
|
+
*
|
|
20
|
+
* @param segments
|
|
21
|
+
* @param epsilon
|
|
22
|
+
* @returns
|
|
23
|
+
*/
|
|
24
|
+
var initVisitationArray = function (segments, epsilon) {
|
|
25
|
+
var result = []; // { visited: false, hasPredecessor: false }
|
|
26
|
+
for (var i = 0; i < segments.length; i++) {
|
|
27
|
+
result.push({ visited: false, hasPredecessor: false, hasSuccessor: false });
|
|
28
|
+
for (var j = 0; j < segments.length; j++) {
|
|
29
|
+
if (i === j) {
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
if (segments[i].getStartPoint().distance(segments[j].getEndPoint()) < epsilon ||
|
|
33
|
+
segments[i].getStartPoint().distance(segments[j].getStartPoint()) < epsilon) {
|
|
34
|
+
result[i].hasPredecessor = true;
|
|
35
|
+
}
|
|
36
|
+
if (segments[i].getEndPoint().distance(segments[j].getEndPoint()) < epsilon ||
|
|
37
|
+
segments[i].getEndPoint().distance(segments[j].getStartPoint()) < epsilon) {
|
|
38
|
+
result[i].hasSuccessor = true;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
// After first initialization make sure that no loose path ends are dangling around
|
|
43
|
+
// if the affected path segment has a predecessor (but nu successor).
|
|
44
|
+
//
|
|
45
|
+
// Revert those segments. This makes the actual detection algorithm much easier.
|
|
46
|
+
for (var i = 0; i < segments.length; i++) {
|
|
47
|
+
if (!result[i].hasSuccessor && result[i].hasPredecessor) {
|
|
48
|
+
segments[i] = segments[i].reverse();
|
|
49
|
+
result[i].hasPredecessor = false;
|
|
50
|
+
result[i].hasSuccessor = true;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return result;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Find the next unvisited path segment (private helper function).
|
|
57
|
+
*
|
|
58
|
+
* There is a special order: starting path segments (those without any predecessor)
|
|
59
|
+
* will be preferred. If no more open paths are available (no starting path segments),
|
|
60
|
+
* then no more unvisited paths are available or all remaining paths are loops (without
|
|
61
|
+
* determined start/end).
|
|
62
|
+
*
|
|
63
|
+
* Doing this keeps us from the need to run a final loop to connect detected sub paths.
|
|
64
|
+
*
|
|
65
|
+
* @param {Array<PathSegment>} segments - The path segments to search in.
|
|
66
|
+
* @param { Array<Visitation>} isSegmentVisited
|
|
67
|
+
* @returns {number} The index of the next unvisited path segment or -1 if no more are available.
|
|
68
|
+
*/
|
|
69
|
+
var locateUnvisitedSegment = function (segments, isSegmentVisited) {
|
|
70
|
+
// First run: detect beginnings
|
|
71
|
+
for (var i = 0; i < segments.length; i++) {
|
|
72
|
+
if (!isSegmentVisited[i].hasPredecessor && !isSegmentVisited[i].visited) {
|
|
73
|
+
return i;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
// Second run: if no beginnings exist -> use inner path segment
|
|
77
|
+
for (var i = 0; i < segments.length; i++) {
|
|
78
|
+
if (!isSegmentVisited[i].visited) {
|
|
79
|
+
return i;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return -1;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Get the next adjacent path segment to the given (current) segment. This is a private
|
|
86
|
+
* helper function.
|
|
87
|
+
*
|
|
88
|
+
* Note that the function will revert the adjacent path segment if required, so the next
|
|
89
|
+
* starting point 'equals' the current ending point.
|
|
90
|
+
*
|
|
91
|
+
* The visitation tracker will be updated if the adjacent segment was found.
|
|
92
|
+
*
|
|
93
|
+
* @param {Array<PathSegment>} segments - The total set of available path segments (visited and invisited).
|
|
94
|
+
* @param {Array<Visitation>} isSegmentVisited - A tracker of visited path segments so far.
|
|
95
|
+
* @param {PathSegment} currentSegment - The current path segment to find the adjacent segment for.
|
|
96
|
+
* @param {number} epsilon - The epsilon to use to detect 'equal' start/end points. Must be >= 0.
|
|
97
|
+
* @returns {PathSegment | null} The next adjacent path segment of null if no such exists.
|
|
98
|
+
*/
|
|
99
|
+
var getAdjacentSegment = function (segments, isSegmentVisited, currentSegment, epsilon) {
|
|
100
|
+
for (var j = 0; j < segments.length; j++) {
|
|
101
|
+
if (isSegmentVisited[j].visited) {
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
var nextSegment = segments[j];
|
|
105
|
+
// [start]---[end] [start]---[end]
|
|
106
|
+
if (currentSegment.getEndPoint().distance(nextSegment.getStartPoint()) < epsilon) {
|
|
107
|
+
isSegmentVisited[j].visited = true;
|
|
108
|
+
return nextSegment;
|
|
109
|
+
}
|
|
110
|
+
// [start]---[end] [end]---[start]
|
|
111
|
+
else if (currentSegment.getEndPoint().distance(nextSegment.getEndPoint()) < epsilon) {
|
|
112
|
+
isSegmentVisited[j].visited = true;
|
|
113
|
+
return nextSegment.reverse();
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return null;
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* A private helper function to find the adjacent full path for the given path segment,
|
|
120
|
+
* considering the current path segment is a starting segment (or one inside a loop).
|
|
121
|
+
*
|
|
122
|
+
* @param {Array<PathSegment>} segments - The total set of available path segments.
|
|
123
|
+
* @param { Array<Visitation>} isSegmentVisited - A tracker to determine which segments have already been visited.
|
|
124
|
+
* @param {number} currentSegmentIndex - The index of the current segments to find the containing path for.
|
|
125
|
+
* @param {number} epsilon - The epsilon to use to determine 'equal' path points. Must be >= 0.
|
|
126
|
+
* @returns {GenericPath} The dected path which consists at least of the current path segment.
|
|
127
|
+
*/
|
|
128
|
+
var detectAdjacentPath = function (segments, isSegmentVisited, currentSegmentIndex, epsilon) {
|
|
129
|
+
var currentSegment = segments[currentSegmentIndex];
|
|
130
|
+
isSegmentVisited[currentSegmentIndex].visited = true;
|
|
131
|
+
var path = new GenericPath_1.GenericPath(currentSegment); // { segments: [currentSegment], reverse };
|
|
132
|
+
var i = 0;
|
|
133
|
+
// A safety break if something goes wrong
|
|
134
|
+
while (i < segments.length && currentSegment) {
|
|
135
|
+
currentSegment = getAdjacentSegment(segments, isSegmentVisited, currentSegment, epsilon);
|
|
136
|
+
if (currentSegment) {
|
|
137
|
+
path.segments.push(currentSegment);
|
|
138
|
+
}
|
|
139
|
+
i++;
|
|
140
|
+
}
|
|
141
|
+
return path;
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* Run a path detection on the given set of path segments.
|
|
145
|
+
*
|
|
146
|
+
* Note that the array and some path segments may be altered (like reversal) IN PLACE.
|
|
147
|
+
*
|
|
148
|
+
* @param {Array<PathSegment>} segments - The total set (array) of available path segments.
|
|
149
|
+
* @param {number=1.0} epsilon - (optional) An epsilon to use to tell if two plane points should be considered 'equal'.
|
|
150
|
+
* @returns {Array<GenericPath>} An array containing all detected path (consisting of adjacent path segments of the original set).
|
|
151
|
+
*/
|
|
152
|
+
var detectPaths = function (segments, epsilon) {
|
|
153
|
+
var eps = typeof epsilon === "undefined" || epsilon < 0 ? 1.0 : epsilon;
|
|
154
|
+
var isSegmentVisited = initVisitationArray(segments, eps);
|
|
155
|
+
var resultPaths = [];
|
|
156
|
+
var nextSegmentIndex = -1;
|
|
157
|
+
var i = 0;
|
|
158
|
+
while ((nextSegmentIndex = locateUnvisitedSegment(segments, isSegmentVisited)) !== -1 && i < segments.length) {
|
|
159
|
+
isSegmentVisited[nextSegmentIndex].visited = true;
|
|
160
|
+
// A safety break (to avoid infinited loops during development).
|
|
161
|
+
i++;
|
|
162
|
+
var path = detectAdjacentPath(segments, isSegmentVisited, nextSegmentIndex, eps);
|
|
163
|
+
i += path.getSegmentCount() - 1;
|
|
164
|
+
resultPaths.push(path);
|
|
165
|
+
}
|
|
166
|
+
return resultPaths;
|
|
167
|
+
};
|
|
168
|
+
exports.detectPaths = detectPaths;
|
|
169
|
+
//# sourceMappingURL=detectPaths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detectPaths.js","sourceRoot":"","sources":["../../../ts/utils/algorithms/detectPaths.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAGH,6DAA4D;AAW5D;;;;;;;;;GASG;AACH,IAAM,mBAAmB,GAAG,UAAC,QAA4B,EAAE,OAAe;IACxE,IAAM,MAAM,GAAsB,EAAE,CAAC,CAAC,4CAA4C;IAClF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACxC,MAAM,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,CAAC;QAC5E,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACxC,IAAI,CAAC,KAAK,CAAC,EAAE;gBACX,SAAS;aACV;YACD,IACE,QAAQ,CAAC,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,GAAG,OAAO;gBACzE,QAAQ,CAAC,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC,QAAQ,C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ChE,CAAC,EAAE,CAAC;QACJ,IAAM,IAAI,GAAG,kBAAkB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,GAAG,CAAC,CAAC;QACnF,CAAC,IAAI,IAAI,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC;QAChC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;KACxB;IACD,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC;AAfW,QAAA,WAAW,eAetB"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author Ikaros Kappler
|
|
3
|
+
* @version 1.0.0
|
|
4
|
+
* @date 2022-10-17
|
|
5
|
+
*/
|
|
6
|
+
import { Path, PathSegment } from "../../interfaces/additionals";
|
|
7
|
+
import { Vertex } from "../../Vertex";
|
|
8
|
+
export declare class GenericPath implements Path {
|
|
9
|
+
segments: Array<PathSegment>;
|
|
10
|
+
constructor(startSegment: PathSegment);
|
|
11
|
+
/**
|
|
12
|
+
* Get the number of segments in this path.
|
|
13
|
+
*
|
|
14
|
+
* @method getSegmentCount
|
|
15
|
+
* @memberof Path
|
|
16
|
+
* @return {number} The number (integer) of path segments.
|
|
17
|
+
*/
|
|
18
|
+
getSegmentCount(): number;
|
|
19
|
+
/**
|
|
20
|
+
* Get the path segment at the given index.
|
|
21
|
+
*
|
|
22
|
+
* @method getSegmentAt
|
|
23
|
+
* @memberof Path
|
|
24
|
+
* @return {PathSegment} The paths segment at the given index.
|
|
25
|
+
*/
|
|
26
|
+
getSegmentAt(index: number): PathSegment;
|
|
27
|
+
/**
|
|
28
|
+
* Create a deep clone of this path.
|
|
29
|
+
*
|
|
30
|
+
* @method clone
|
|
31
|
+
* @memberof Path
|
|
32
|
+
* @return {Path} A deep clone/copy of this path.
|
|
33
|
+
*/
|
|
34
|
+
clone(): GenericPath;
|
|
35
|
+
/**
|
|
36
|
+
* Reverse this path (swap start and end and thus – the direction) in-place.
|
|
37
|
+
*
|
|
38
|
+
* @method reverse
|
|
39
|
+
* @memberof Path
|
|
40
|
+
* @return {PathSegment} This path instance.
|
|
41
|
+
*/
|
|
42
|
+
reverse(): this;
|
|
43
|
+
/**
|
|
44
|
+
* Get the start point of this path segment.
|
|
45
|
+
*
|
|
46
|
+
* @method getStartPoint
|
|
47
|
+
* @memberof PathSegment
|
|
48
|
+
* @return {Vertex} The start point of this path segment.
|
|
49
|
+
*/
|
|
50
|
+
getStartPoint(): Vertex;
|
|
51
|
+
/**
|
|
52
|
+
* Get the end point of this path segment.
|
|
53
|
+
*
|
|
54
|
+
* @method getEndPoint
|
|
55
|
+
* @memberof PathSegment
|
|
56
|
+
* @return {Vertex} The end point of this path segment.
|
|
57
|
+
*/
|
|
58
|
+
getEndPoint(): Vertex;
|
|
59
|
+
/**
|
|
60
|
+
* Get the tangent's end point at the start point of this segment.
|
|
61
|
+
*
|
|
62
|
+
* @method getStartTangent
|
|
63
|
+
* @memberof PathSegment
|
|
64
|
+
* @return {Vertex} The end point of the starting point's tangent.
|
|
65
|
+
*/
|
|
66
|
+
getStartTangent(): Vertex;
|
|
67
|
+
/**
|
|
68
|
+
* Get the tangent's end point at the end point of this segment.
|
|
69
|
+
*
|
|
70
|
+
* @method getEndTangent
|
|
71
|
+
* @memberof PathSegment
|
|
72
|
+
* @return {Vertex} The end point of the ending point's tangent.
|
|
73
|
+
*/
|
|
74
|
+
getEndTangent(): Vertex;
|
|
75
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @author Ikaros Kappler
|
|
4
|
+
* @version 1.0.0
|
|
5
|
+
* @date 2022-10-17
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.GenericPath = void 0;
|
|
9
|
+
var GenericPath = /** @class */ (function () {
|
|
10
|
+
function GenericPath(startSegment) {
|
|
11
|
+
this.segments = [startSegment];
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Get the number of segments in this path.
|
|
15
|
+
*
|
|
16
|
+
* @method getSegmentCount
|
|
17
|
+
* @memberof Path
|
|
18
|
+
* @return {number} The number (integer) of path segments.
|
|
19
|
+
*/
|
|
20
|
+
GenericPath.prototype.getSegmentCount = function () {
|
|
21
|
+
return this.segments.length;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Get the path segment at the given index.
|
|
25
|
+
*
|
|
26
|
+
* @method getSegmentAt
|
|
27
|
+
* @memberof Path
|
|
28
|
+
* @return {PathSegment} The paths segment at the given index.
|
|
29
|
+
*/
|
|
30
|
+
GenericPath.prototype.getSegmentAt = function (index) {
|
|
31
|
+
return this.segments[index];
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Create a deep clone of this path.
|
|
35
|
+
*
|
|
36
|
+
* @method clone
|
|
37
|
+
* @memberof Path
|
|
38
|
+
* @return {Path} A deep clone/copy of this path.
|
|
39
|
+
*/
|
|
40
|
+
GenericPath.prototype.clone = function () {
|
|
41
|
+
var newPath = new GenericPath(this.segments[this.segments.length - 1].clone().reverse());
|
|
42
|
+
for (var i = this.segments.length - 2; i >= 0; i--) {
|
|
43
|
+
newPath.segments.push(this.segments[i].clone().reverse());
|
|
44
|
+
}
|
|
45
|
+
return newPath;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Reverse this path (swap start and end and thus – the direction) in-place.
|
|
49
|
+
*
|
|
50
|
+
* @method reverse
|
|
51
|
+
* @memberof Path
|
|
52
|
+
* @return {PathSegment} This path instance.
|
|
53
|
+
*/
|
|
54
|
+
GenericPath.prototype.reverse = function () {
|
|
55
|
+
var newSegments = [];
|
|
56
|
+
for (var i = this.segments.length - 1; i >= 0; i--) {
|
|
57
|
+
newSegments.push(this.segments[i].reverse());
|
|
58
|
+
}
|
|
59
|
+
this.segments = newSegments;
|
|
60
|
+
return this;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Get the start point of this path segment.
|
|
64
|
+
*
|
|
65
|
+
* @method getStartPoint
|
|
66
|
+
* @memberof PathSegment
|
|
67
|
+
* @return {Vertex} The start point of this path segment.
|
|
68
|
+
*/
|
|
69
|
+
GenericPath.prototype.getStartPoint = function () {
|
|
70
|
+
return this.segments[0].getStartPoint();
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Get the end point of this path segment.
|
|
74
|
+
*
|
|
75
|
+
* @method getEndPoint
|
|
76
|
+
* @memberof PathSegment
|
|
77
|
+
* @return {Vertex} The end point of this path segment.
|
|
78
|
+
*/
|
|
79
|
+
GenericPath.prototype.getEndPoint = function () {
|
|
80
|
+
return this.segments[this.segments.length - 1].getEndPoint();
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Get the tangent's end point at the start point of this segment.
|
|
84
|
+
*
|
|
85
|
+
* @method getStartTangent
|
|
86
|
+
* @memberof PathSegment
|
|
87
|
+
* @return {Vertex} The end point of the starting point's tangent.
|
|
88
|
+
*/
|
|
89
|
+
GenericPath.prototype.getStartTangent = function () {
|
|
90
|
+
return this.segments[0].getStartTangent();
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* Get the tangent's end point at the end point of this segment.
|
|
94
|
+
*
|
|
95
|
+
* @method getEndTangent
|
|
96
|
+
* @memberof PathSegment
|
|
97
|
+
* @return {Vertex} The end point of the ending point's tangent.
|
|
98
|
+
*/
|
|
99
|
+
GenericPath.prototype.getEndTangent = function () {
|
|
100
|
+
return this.segments[this.segments.length - 1].getEndTangent();
|
|
101
|
+
};
|
|
102
|
+
return GenericPath;
|
|
103
|
+
}());
|
|
104
|
+
exports.GenericPath = GenericPath;
|
|
105
|
+
//# sourceMappingURL=GenericPath.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GenericPath.js","sourceRoot":"","sources":["../../../ts/utils/datastructures/GenericPath.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAKH;IAGE,qBAAY,YAAyB;QAC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AC,aAAa,EAAE,CAAC;IAC1C,CAAC;IAED;;;;;;OAMG;IACH,iCAAW,GAAX;QACE,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IAC/D,CAAC;IAED;;;;;;OAMG;IACH,qCAAe,GAAf;QACE,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC;IAC5C,CAAC;IAED;;;;;;OAMG;IACH,mCAAa,GAAb;QACE,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;IACjE,CAAC;IACH,kBAAC;AAAD,CAAC,AAvGD,IAuGC;AAvGY,kCAAW"}
|
|
@@ -225,7 +225,7 @@ export declare abstract class GirihTile extends Polygon {
|
|
|
225
225
|
* @param {Polygon} neighbourTile - The polygon (or tile) you want to find adjacency for at the specified edge.
|
|
226
226
|
* @return {Polygon|null} the passed tile itself if adjacency was found, null otherwise.
|
|
227
227
|
*/
|
|
228
|
-
transformTilePositionToAdjacency<P extends Polygon>(baseEdgeIndex: number, neighbourTile: P): P;
|
|
228
|
+
transformTilePositionToAdjacency<P extends Polygon>(baseEdgeIndex: number, neighbourTile: P): P | null;
|
|
229
229
|
/**
|
|
230
230
|
* Get the inner tile polygon at the given index.
|
|
231
231
|
* This function applies MOD to the index.
|
package/src/esm/Bounds.d.ts
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
* @modified 2021-02-02 Added the `toPolygon` method.
|
|
7
7
|
* @modified 2021-06-21 (mid-summer) Added `getCenter` method.
|
|
8
8
|
* @modified 2022-02-01 Added the `toString` function.
|
|
9
|
-
* @
|
|
9
|
+
* @modified 2022-10-09 Added the `fromDimension` function.
|
|
10
|
+
* @version 1.5.0
|
|
10
11
|
**/
|
|
11
12
|
import { Polygon } from "./Polygon";
|
|
12
13
|
import { XYCoords, IBounds, XYDimension } from "./interfaces";
|
|
@@ -109,4 +110,13 @@ export declare class Bounds implements IBounds, XYDimension {
|
|
|
109
110
|
* @return The minimal Bounds for the given vertices.
|
|
110
111
|
**/
|
|
111
112
|
static computeFromVertices(vertices: Array<Vertex>): Bounds;
|
|
113
|
+
/**
|
|
114
|
+
* Create a new `Bounds` instance just from `width` and `height`, located at (0,0) or the optionally given origin.
|
|
115
|
+
*
|
|
116
|
+
* @param {number} width - The width of the bounds
|
|
117
|
+
* @param {number} height - The height of the bounds
|
|
118
|
+
* @param {XYCoords={x:0,y:0}} origin - [optional] A origin to locate the new Bounds object at.
|
|
119
|
+
* @returns {Bounds} A new `Bounds` instance width given width and height, located at (0,0) or the given origin..
|
|
120
|
+
*/
|
|
121
|
+
static fromDimension(width: number, height: number, origin?: XYCoords): Bounds;
|
|
112
122
|
}
|
package/src/esm/Bounds.js
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
* @modified 2021-02-02 Added the `toPolygon` method.
|
|
7
7
|
* @modified 2021-06-21 (mid-summer) Added `getCenter` method.
|
|
8
8
|
* @modified 2022-02-01 Added the `toString` function.
|
|
9
|
-
* @
|
|
9
|
+
* @modified 2022-10-09 Added the `fromDimension` function.
|
|
10
|
+
* @version 1.5.0
|
|
10
11
|
**/
|
|
11
12
|
import { Polygon } from "./Polygon";
|
|
12
13
|
import { Vertex } from "./Vertex";
|
|
@@ -110,5 +111,16 @@ export class Bounds {
|
|
|
110
111
|
}
|
|
111
112
|
return new Bounds(new Vertex(xMin, yMin), new Vertex(xMax, yMax));
|
|
112
113
|
}
|
|
114
|
+
/**
|
|
115
|
+
* Create a new `Bounds` instance just from `width` and `height`, located at (0,0) or the optionally given origin.
|
|
116
|
+
*
|
|
117
|
+
* @param {number} width - The width of the bounds
|
|
118
|
+
* @param {number} height - The height of the bounds
|
|
119
|
+
* @param {XYCoords={x:0,y:0}} origin - [optional] A origin to locate the new Bounds object at.
|
|
120
|
+
* @returns {Bounds} A new `Bounds` instance width given width and height, located at (0,0) or the given origin..
|
|
121
|
+
*/
|
|
122
|
+
static fromDimension(width, height, origin) {
|
|
123
|
+
return new Bounds(origin !== null && origin !== void 0 ? origin : { x: 0, y: 0 }, { x: (origin ? origin.x : 0) + width, y: (origin ? origin.y : 0) + height });
|
|
124
|
+
}
|
|
113
125
|
} // END class bounds
|
|
114
126
|
//# sourceMappingURL=Bounds.js.map
|
package/src/esm/Bounds.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Bounds.js","sourceRoot":"","sources":["../ts/Bounds.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"Bounds.js","sourceRoot":"","sources":["../ts/Bounds.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;IAUI;AAEJ,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC;;;;;;IAMI;AACJ,MAAM,OAAO,MAAM;IAiCjB;;;;;;;QAOI;IACJ,YAAY,GAAa,EAAE,GAAa;QACtC,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;QAC3B,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;IAC9B,CAAC;IAED;;;;;;;OAOG;IACH,SAAS;QACP,OAAO,IAAI,OAAO,CAChB,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,MAAM,CAAC,IAAI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AAI,IAAY,CAAC;QACjB,KAAK,IAAI,CAAC,IAAI,QAAQ,EAAE;YACtB,IAAI,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;YACnB,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;YAC9B,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;YAC9B,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;YAC9B,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;SAC/B;QACD,OAAO,IAAI,MAAM,CAAC,IAAI,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,IAAI,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;IACpE,CAAC;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,aAAa,CAAC,KAAa,EAAE,MAAc,EAAE,MAAiB;QACnE,OAAO,IAAI,MAAM,CAAC,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,EAAE,CAAC,CAAC;IAC3H,CAAC;CACF,CAAC,mBAAmB"}
|
|
@@ -20,14 +20,15 @@
|
|
|
20
20
|
* @modified 2021-01-20 Added UID.
|
|
21
21
|
* @modified 2022-02-02 Added the `destroy` method.
|
|
22
22
|
* @modified 2022-02-02 Cleared the `toSVGPathData` function (deprecated). Use `drawutilssvg` instead.
|
|
23
|
-
* @
|
|
23
|
+
* @modified 2022-10-17 The `CubicBezierCurve` class now implements the new `PathSegment` interface.
|
|
24
|
+
* @version 2.7.1
|
|
24
25
|
*
|
|
25
26
|
* @file CubicBezierCurve
|
|
26
27
|
* @public
|
|
27
28
|
**/
|
|
28
29
|
import { Bounds } from "./Bounds";
|
|
29
30
|
import { Vertex } from "./Vertex";
|
|
30
|
-
import { XYCoords, UID } from "./interfaces";
|
|
31
|
+
import { XYCoords, UID, PathSegment } from "./interfaces";
|
|
31
32
|
/**
|
|
32
33
|
* @classdesc A refactored cubic bezier curve class.
|
|
33
34
|
*
|
|
@@ -38,7 +39,7 @@ import { XYCoords, UID } from "./interfaces";
|
|
|
38
39
|
* @requires UID
|
|
39
40
|
* @requires UIDGenerator
|
|
40
41
|
*/
|
|
41
|
-
export declare class CubicBezierCurve {
|
|
42
|
+
export declare class CubicBezierCurve implements PathSegment {
|
|
42
43
|
/** @constant {number} */
|
|
43
44
|
static readonly START_POINT: number;
|
|
44
45
|
/** @constant {number} */
|
|
@@ -388,6 +389,22 @@ export declare class CubicBezierCurve {
|
|
|
388
389
|
* @return {CubicBezierCurve}
|
|
389
390
|
**/
|
|
390
391
|
clone(): CubicBezierCurve;
|
|
392
|
+
/**
|
|
393
|
+
* Get the tangent's end point at the start point of this segment.
|
|
394
|
+
*
|
|
395
|
+
* @method getStartTangent
|
|
396
|
+
* @memberof PathSegment
|
|
397
|
+
* @return {Vertex} The end point of the starting point's tangent.
|
|
398
|
+
*/
|
|
399
|
+
getStartTangent(): Vertex;
|
|
400
|
+
/**
|
|
401
|
+
* Get the tangent's end point at the end point of this segment.
|
|
402
|
+
*
|
|
403
|
+
* @method getEndTangent
|
|
404
|
+
* @memberof PathSegment
|
|
405
|
+
* @return {Vertex} The end point of the ending point's tangent.
|
|
406
|
+
*/
|
|
407
|
+
getEndTangent(): Vertex;
|
|
391
408
|
/**
|
|
392
409
|
* Check if this and the specified curve are equal.<br>
|
|
393
410
|
* <br>
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
* @modified 2021-01-20 Added UID.
|
|
21
21
|
* @modified 2022-02-02 Added the `destroy` method.
|
|
22
22
|
* @modified 2022-02-02 Cleared the `toSVGPathData` function (deprecated). Use `drawutilssvg` instead.
|
|
23
|
-
* @
|
|
23
|
+
* @modified 2022-10-17 The `CubicBezierCurve` class now implements the new `PathSegment` interface.
|
|
24
|
+
* @version 2.7.1
|
|
24
25
|
*
|
|
25
26
|
* @file CubicBezierCurve
|
|
26
27
|
* @public
|
|
@@ -70,7 +71,7 @@ export class CubicBezierCurve {
|
|
|
70
71
|
// An array of floats
|
|
71
72
|
this.segmentLengths = [];
|
|
72
73
|
// float
|
|
73
|
-
this.arcLength = null;
|
|
74
|
+
// this.arcLength = null;
|
|
74
75
|
this.updateArcLengths();
|
|
75
76
|
}
|
|
76
77
|
/**
|
|
@@ -502,6 +503,28 @@ export class CubicBezierCurve {
|
|
|
502
503
|
clone() {
|
|
503
504
|
return new CubicBezierCurve(this.getStartPoint().clone(), this.getEndPoint().clone(), this.getStartControlPoint().clone(), this.getEndControlPoint().clone());
|
|
504
505
|
}
|
|
506
|
+
//---BEGIN PathSegment-------------------------
|
|
507
|
+
/**
|
|
508
|
+
* Get the tangent's end point at the start point of this segment.
|
|
509
|
+
*
|
|
510
|
+
* @method getStartTangent
|
|
511
|
+
* @memberof PathSegment
|
|
512
|
+
* @return {Vertex} The end point of the starting point's tangent.
|
|
513
|
+
*/
|
|
514
|
+
getStartTangent() {
|
|
515
|
+
return this.startControlPoint;
|
|
516
|
+
}
|
|
517
|
+
/**
|
|
518
|
+
* Get the tangent's end point at the end point of this segment.
|
|
519
|
+
*
|
|
520
|
+
* @method getEndTangent
|
|
521
|
+
* @memberof PathSegment
|
|
522
|
+
* @return {Vertex} The end point of the ending point's tangent.
|
|
523
|
+
*/
|
|
524
|
+
getEndTangent() {
|
|
525
|
+
return this.endControlPoint;
|
|
526
|
+
}
|
|
527
|
+
//---END PathSegment-------------------------
|
|
505
528
|
/**
|
|
506
529
|
* Check if this and the specified curve are equal.<br>
|
|
507
530
|
* <br>
|