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.
Files changed (95) hide show
  1. package/dist/index.esm.js +166 -39
  2. package/dist/index.esm.js.map +1 -1
  3. package/dist/index.esm.min.js +1 -1
  4. package/dist/index.esm.min.js.map +1 -1
  5. package/dist/plotboilerplate.browser.min.js +1 -1
  6. package/dist/plotboilerplate.browser.min.js.map +1 -1
  7. package/dist/plotboilerplate.js +164 -37
  8. package/dist/plotboilerplate.min.js +1 -1
  9. package/package.json +1 -1
  10. package/src/cjs/Bounds.d.ts +11 -1
  11. package/src/cjs/Bounds.js +13 -1
  12. package/src/cjs/Bounds.js.map +1 -1
  13. package/src/cjs/CubicBezierCurve.d.ts +20 -3
  14. package/src/cjs/CubicBezierCurve.js +25 -2
  15. package/src/cjs/CubicBezierCurve.js.map +1 -1
  16. package/src/cjs/Line.d.ts +46 -4
  17. package/src/cjs/Line.js +60 -3
  18. package/src/cjs/Line.js.map +1 -1
  19. package/src/cjs/PlotBoilerplate.d.ts +4 -2
  20. package/src/cjs/PlotBoilerplate.js +44 -28
  21. package/src/cjs/PlotBoilerplate.js.map +1 -1
  22. package/src/cjs/Polygon.js +1 -1
  23. package/src/cjs/Polygon.js.map +1 -1
  24. package/src/cjs/Vector.d.ts +14 -3
  25. package/src/cjs/Vector.js +21 -2
  26. package/src/cjs/Vector.js.map +1 -1
  27. package/src/cjs/interfaces/additionals.d.ts +95 -0
  28. package/src/cjs/interfaces/additionals.js +3 -0
  29. package/src/cjs/interfaces/additionals.js.map +1 -0
  30. package/src/cjs/interfaces/core.d.ts +4 -0
  31. package/src/cjs/interfaces/core.js +1 -0
  32. package/src/cjs/interfaces/core.js.map +1 -1
  33. package/src/cjs/interfaces/index.d.ts +1 -0
  34. package/src/cjs/interfaces/index.js +1 -0
  35. package/src/cjs/interfaces/index.js.map +1 -1
  36. package/src/cjs/utils/algorithms/arrayShuffle.d.ts +8 -0
  37. package/src/cjs/utils/algorithms/arrayShuffle.js +15 -0
  38. package/src/cjs/utils/algorithms/arrayShuffle.js.map +1 -0
  39. package/src/cjs/utils/algorithms/detectPaths.d.ts +20 -0
  40. package/src/cjs/utils/algorithms/detectPaths.js +169 -0
  41. package/src/cjs/utils/algorithms/detectPaths.js.map +1 -0
  42. package/src/cjs/utils/datastructures/GenericPath.d.ts +75 -0
  43. package/src/cjs/utils/datastructures/GenericPath.js +105 -0
  44. package/src/cjs/utils/datastructures/GenericPath.js.map +1 -0
  45. package/src/cjs/utils/datastructures/GirihTile.d.ts +1 -1
  46. package/src/esm/Bounds.d.ts +11 -1
  47. package/src/esm/Bounds.js +13 -1
  48. package/src/esm/Bounds.js.map +1 -1
  49. package/src/esm/CubicBezierCurve.d.ts +20 -3
  50. package/src/esm/CubicBezierCurve.js +25 -2
  51. package/src/esm/CubicBezierCurve.js.map +1 -1
  52. package/src/esm/Line.d.ts +46 -4
  53. package/src/esm/Line.js +60 -3
  54. package/src/esm/Line.js.map +1 -1
  55. package/src/esm/PlotBoilerplate.d.ts +4 -2
  56. package/src/esm/PlotBoilerplate.js +44 -28
  57. package/src/esm/PlotBoilerplate.js.map +1 -1
  58. package/src/esm/Polygon.js +1 -1
  59. package/src/esm/Polygon.js.map +1 -1
  60. package/src/esm/Vector.d.ts +13 -2
  61. package/src/esm/Vector.js +23 -4
  62. package/src/esm/Vector.js.map +1 -1
  63. package/src/esm/interfaces/additionals.d.ts +95 -0
  64. package/src/esm/interfaces/additionals.js +2 -0
  65. package/src/esm/interfaces/additionals.js.map +1 -0
  66. package/src/esm/interfaces/core.d.ts +4 -0
  67. package/src/esm/interfaces/core.js +1 -0
  68. package/src/esm/interfaces/core.js.map +1 -1
  69. package/src/esm/interfaces/index.d.ts +1 -0
  70. package/src/esm/interfaces/index.js +1 -0
  71. package/src/esm/interfaces/index.js.map +1 -1
  72. package/src/esm/utils/algorithms/arrayShuffle.d.ts +8 -0
  73. package/src/esm/utils/algorithms/arrayShuffle.js +11 -0
  74. package/src/esm/utils/algorithms/arrayShuffle.js.map +1 -0
  75. package/src/esm/utils/algorithms/detectPaths.d.ts +20 -0
  76. package/src/esm/utils/algorithms/detectPaths.js +165 -0
  77. package/src/esm/utils/algorithms/detectPaths.js.map +1 -0
  78. package/src/esm/utils/datastructures/GenericPath.d.ts +75 -0
  79. package/src/esm/utils/datastructures/GenericPath.js +100 -0
  80. package/src/esm/utils/datastructures/GenericPath.js.map +1 -0
  81. package/src/esm/utils/datastructures/GirihTile.d.ts +1 -1
  82. package/src/ts/Bounds.ts +14 -1
  83. package/src/ts/CubicBezierCurve.ts +29 -4
  84. package/src/ts/Line.ts +70 -6
  85. package/src/ts/PlotBoilerplate.ts +47 -32
  86. package/src/ts/Polygon.ts +1 -1
  87. package/src/ts/Vector.ts +24 -4
  88. package/src/ts/interfaces/additionals.ts +105 -0
  89. package/src/ts/interfaces/core.ts +2 -0
  90. package/src/ts/interfaces/index.ts +1 -0
  91. package/src/ts/utils/algorithms/arrayShuffle.ts +11 -0
  92. package/src/ts/utils/algorithms/detectPaths.ts +195 -0
  93. package/src/ts/utils/datastructures/GenericPath.ts +113 -0
  94. package/src/ts/utils/datastructures/GirihTile.ts +1 -1
  95. 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);