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
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author Ikaros Kappler
|
|
3
|
+
* @version 1.0.0
|
|
4
|
+
* @date 2022-10-17
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { Path, PathSegment } from "../../interfaces/additionals";
|
|
8
|
+
import { Vertex } from "../../Vertex";
|
|
9
|
+
|
|
10
|
+
export class GenericPath implements Path {
|
|
11
|
+
segments: Array<PathSegment>;
|
|
12
|
+
|
|
13
|
+
constructor(startSegment: PathSegment) {
|
|
14
|
+
this.segments = [startSegment];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Get the number of segments in this path.
|
|
19
|
+
*
|
|
20
|
+
* @method getSegmentCount
|
|
21
|
+
* @memberof Path
|
|
22
|
+
* @return {number} The number (integer) of path segments.
|
|
23
|
+
*/
|
|
24
|
+
getSegmentCount(): number {
|
|
25
|
+
return this.segments.length;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Get the path segment at the given index.
|
|
30
|
+
*
|
|
31
|
+
* @method getSegmentAt
|
|
32
|
+
* @memberof Path
|
|
33
|
+
* @return {PathSegment} The paths segment at the given index.
|
|
34
|
+
*/
|
|
35
|
+
getSegmentAt(index: number): PathSegment {
|
|
36
|
+
return this.segments[index];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Create a deep clone of this path.
|
|
41
|
+
*
|
|
42
|
+
* @method clone
|
|
43
|
+
* @memberof Path
|
|
44
|
+
* @return {Path} A deep clone/copy of this path.
|
|
45
|
+
*/
|
|
46
|
+
clone(): GenericPath {
|
|
47
|
+
const newPath = new GenericPath(this.segments[this.segments.length - 1].clone().reverse());
|
|
48
|
+
for (var i = this.segments.length - 2; i >= 0; i--) {
|
|
49
|
+
newPath.segments.push(this.segments[i].clone().reverse());
|
|
50
|
+
}
|
|
51
|
+
return newPath;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Reverse this path (swap start and end and thus – the direction) in-place.
|
|
56
|
+
*
|
|
57
|
+
* @method reverse
|
|
58
|
+
* @memberof Path
|
|
59
|
+
* @return {PathSegment} This path instance.
|
|
60
|
+
*/
|
|
61
|
+
reverse() {
|
|
62
|
+
const newSegments: Array<PathSegment> = [];
|
|
63
|
+
for (var i = this.segments.length - 1; i >= 0; i--) {
|
|
64
|
+
newSegments.push(this.segments[i].reverse());
|
|
65
|
+
}
|
|
66
|
+
this.segments = newSegments;
|
|
67
|
+
return this;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Get the start point of this path segment.
|
|
72
|
+
*
|
|
73
|
+
* @method getStartPoint
|
|
74
|
+
* @memberof PathSegment
|
|
75
|
+
* @return {Vertex} The start point of this path segment.
|
|
76
|
+
*/
|
|
77
|
+
getStartPoint(): Vertex {
|
|
78
|
+
return this.segments[0].getStartPoint();
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Get the end point of this path segment.
|
|
83
|
+
*
|
|
84
|
+
* @method getEndPoint
|
|
85
|
+
* @memberof PathSegment
|
|
86
|
+
* @return {Vertex} The end point of this path segment.
|
|
87
|
+
*/
|
|
88
|
+
getEndPoint(): Vertex {
|
|
89
|
+
return this.segments[this.segments.length - 1].getEndPoint();
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Get the tangent's end point at the start point of this segment.
|
|
94
|
+
*
|
|
95
|
+
* @method getStartTangent
|
|
96
|
+
* @memberof PathSegment
|
|
97
|
+
* @return {Vertex} The end point of the starting point's tangent.
|
|
98
|
+
*/
|
|
99
|
+
getStartTangent(): Vertex {
|
|
100
|
+
return this.segments[0].getStartTangent();
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Get the tangent's end point at the end point of this segment.
|
|
105
|
+
*
|
|
106
|
+
* @method getEndTangent
|
|
107
|
+
* @memberof PathSegment
|
|
108
|
+
* @return {Vertex} The end point of the ending point's tangent.
|
|
109
|
+
*/
|
|
110
|
+
getEndTangent(): Vertex {
|
|
111
|
+
return this.segments[this.segments.length - 1].getEndTangent();
|
|
112
|
+
}
|
|
113
|
+
}
|
|
@@ -319,7 +319,7 @@ export abstract class GirihTile extends Polygon {
|
|
|
319
319
|
* @param {Polygon} neighbourTile - The polygon (or tile) you want to find adjacency for at the specified edge.
|
|
320
320
|
* @return {Polygon|null} the passed tile itself if adjacency was found, null otherwise.
|
|
321
321
|
*/
|
|
322
|
-
transformTilePositionToAdjacency<P extends Polygon>(baseEdgeIndex: number, neighbourTile: P): P {
|
|
322
|
+
transformTilePositionToAdjacency<P extends Polygon>(baseEdgeIndex: number, neighbourTile: P): P | null {
|
|
323
323
|
// Find the position for that tile to match (might not exist)
|
|
324
324
|
// { edgeIndex:number, offset:XYCoords }
|
|
325
325
|
var adjacency = this.findAdjacentTilePosition(baseEdgeIndex, neighbourTile);
|