plotboilerplate 1.17.1 → 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 (117) hide show
  1. package/README.md +63 -6
  2. package/dist/index.esm.js +278 -60
  3. package/dist/index.esm.js.map +1 -1
  4. package/dist/index.esm.min.js +1 -1
  5. package/dist/index.esm.min.js.map +1 -1
  6. package/dist/plotboilerplate.browser.min.js +1 -1
  7. package/dist/plotboilerplate.browser.min.js.map +1 -1
  8. package/dist/plotboilerplate.js +276 -58
  9. package/dist/plotboilerplate.min.js +1 -1
  10. package/package.json +1 -1
  11. package/src/cjs/Bounds.d.ts +11 -1
  12. package/src/cjs/Bounds.js +13 -1
  13. package/src/cjs/Bounds.js.map +1 -1
  14. package/src/cjs/Circle.d.ts +36 -2
  15. package/src/cjs/Circle.js +81 -1
  16. package/src/cjs/Circle.js.map +1 -1
  17. package/src/cjs/CubicBezierCurve.d.ts +20 -3
  18. package/src/cjs/CubicBezierCurve.js +25 -2
  19. package/src/cjs/CubicBezierCurve.js.map +1 -1
  20. package/src/cjs/Line.d.ts +46 -4
  21. package/src/cjs/Line.js +60 -3
  22. package/src/cjs/Line.js.map +1 -1
  23. package/src/cjs/MouseHandler.d.ts +3 -2
  24. package/src/cjs/MouseHandler.js +16 -14
  25. package/src/cjs/MouseHandler.js.map +1 -1
  26. package/src/cjs/PlotBoilerplate.d.ts +4 -2
  27. package/src/cjs/PlotBoilerplate.js +44 -28
  28. package/src/cjs/PlotBoilerplate.js.map +1 -1
  29. package/src/cjs/Polygon.js +1 -1
  30. package/src/cjs/Polygon.js.map +1 -1
  31. package/src/cjs/Vector.d.ts +14 -3
  32. package/src/cjs/Vector.js +21 -2
  33. package/src/cjs/Vector.js.map +1 -1
  34. package/src/cjs/draw.d.ts +4 -1
  35. package/src/cjs/draw.js +15 -6
  36. package/src/cjs/draw.js.map +1 -1
  37. package/src/cjs/interfaces/additionals.d.ts +95 -0
  38. package/src/cjs/interfaces/additionals.js +3 -0
  39. package/src/cjs/interfaces/additionals.js.map +1 -0
  40. package/src/cjs/interfaces/core.d.ts +4 -0
  41. package/src/cjs/interfaces/core.js +1 -0
  42. package/src/cjs/interfaces/core.js.map +1 -1
  43. package/src/cjs/interfaces/index.d.ts +1 -0
  44. package/src/cjs/interfaces/index.js +1 -0
  45. package/src/cjs/interfaces/index.js.map +1 -1
  46. package/src/cjs/utils/algorithms/arrayShuffle.d.ts +8 -0
  47. package/src/cjs/utils/algorithms/arrayShuffle.js +15 -0
  48. package/src/cjs/utils/algorithms/arrayShuffle.js.map +1 -0
  49. package/src/cjs/utils/algorithms/detectPaths.d.ts +20 -0
  50. package/src/cjs/utils/algorithms/detectPaths.js +169 -0
  51. package/src/cjs/utils/algorithms/detectPaths.js.map +1 -0
  52. package/src/cjs/utils/datastructures/GenericPath.d.ts +75 -0
  53. package/src/cjs/utils/datastructures/GenericPath.js +105 -0
  54. package/src/cjs/utils/datastructures/GenericPath.js.map +1 -0
  55. package/src/cjs/utils/datastructures/GirihTile.d.ts +1 -1
  56. package/src/esm/Bounds.d.ts +11 -1
  57. package/src/esm/Bounds.js +13 -1
  58. package/src/esm/Bounds.js.map +1 -1
  59. package/src/esm/Circle.d.ts +36 -2
  60. package/src/esm/Circle.js +81 -1
  61. package/src/esm/Circle.js.map +1 -1
  62. package/src/esm/CubicBezierCurve.d.ts +20 -3
  63. package/src/esm/CubicBezierCurve.js +25 -2
  64. package/src/esm/CubicBezierCurve.js.map +1 -1
  65. package/src/esm/Line.d.ts +46 -4
  66. package/src/esm/Line.js +60 -3
  67. package/src/esm/Line.js.map +1 -1
  68. package/src/esm/MouseHandler.d.ts +3 -2
  69. package/src/esm/MouseHandler.js +16 -14
  70. package/src/esm/MouseHandler.js.map +1 -1
  71. package/src/esm/PlotBoilerplate.d.ts +4 -2
  72. package/src/esm/PlotBoilerplate.js +44 -28
  73. package/src/esm/PlotBoilerplate.js.map +1 -1
  74. package/src/esm/Polygon.js +1 -1
  75. package/src/esm/Polygon.js.map +1 -1
  76. package/src/esm/Vector.d.ts +13 -2
  77. package/src/esm/Vector.js +23 -4
  78. package/src/esm/Vector.js.map +1 -1
  79. package/src/esm/draw.d.ts +4 -1
  80. package/src/esm/draw.js +15 -6
  81. package/src/esm/draw.js.map +1 -1
  82. package/src/esm/interfaces/additionals.d.ts +95 -0
  83. package/src/esm/interfaces/additionals.js +2 -0
  84. package/src/esm/interfaces/additionals.js.map +1 -0
  85. package/src/esm/interfaces/core.d.ts +4 -0
  86. package/src/esm/interfaces/core.js +1 -0
  87. package/src/esm/interfaces/core.js.map +1 -1
  88. package/src/esm/interfaces/index.d.ts +1 -0
  89. package/src/esm/interfaces/index.js +1 -0
  90. package/src/esm/interfaces/index.js.map +1 -1
  91. package/src/esm/utils/algorithms/arrayShuffle.d.ts +8 -0
  92. package/src/esm/utils/algorithms/arrayShuffle.js +11 -0
  93. package/src/esm/utils/algorithms/arrayShuffle.js.map +1 -0
  94. package/src/esm/utils/algorithms/detectPaths.d.ts +20 -0
  95. package/src/esm/utils/algorithms/detectPaths.js +165 -0
  96. package/src/esm/utils/algorithms/detectPaths.js.map +1 -0
  97. package/src/esm/utils/datastructures/GenericPath.d.ts +75 -0
  98. package/src/esm/utils/datastructures/GenericPath.js +100 -0
  99. package/src/esm/utils/datastructures/GenericPath.js.map +1 -0
  100. package/src/esm/utils/datastructures/GirihTile.d.ts +1 -1
  101. package/src/ts/Bounds.ts +14 -1
  102. package/src/ts/Circle.ts +92 -2
  103. package/src/ts/CubicBezierCurve.ts +29 -4
  104. package/src/ts/Line.ts +70 -6
  105. package/src/ts/MouseHandler.ts +16 -15
  106. package/src/ts/PlotBoilerplate.ts +47 -32
  107. package/src/ts/Polygon.ts +1 -1
  108. package/src/ts/Vector.ts +24 -4
  109. package/src/ts/draw.ts +15 -6
  110. package/src/ts/interfaces/additionals.ts +105 -0
  111. package/src/ts/interfaces/core.ts +2 -0
  112. package/src/ts/interfaces/index.ts +1 -0
  113. package/src/ts/utils/algorithms/arrayShuffle.ts +11 -0
  114. package/src/ts/utils/algorithms/detectPaths.ts +195 -0
  115. package/src/ts/utils/datastructures/GenericPath.ts +113 -0
  116. package/src/ts/utils/datastructures/GirihTile.ts +1 -1
  117. package/changelog.md +0 -722
@@ -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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GAAG,QAAQ,CAAC,MAAM,EAAE;QAC5G,gBAAgB,CAAC,gBAAgB,CAAC,CAAC,OAAO,GAAG,IAAI,CAAC;QAClD,gEAAgE;QAChE,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;QACnC,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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.
@@ -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
- * @version 1.4.0
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
- * @version 1.4.0
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
@@ -1 +1 @@
1
- {"version":3,"file":"Bounds.js","sourceRoot":"","sources":["../ts/Bounds.ts"],"names":[],"mappings":"AAAA;;;;;;;;;IASI;AAEJ,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,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C,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"}
@@ -9,13 +9,16 @@
9
9
  * @modified 2021-01-20 Added UID.
10
10
  * @modified 2022-02-02 Added the `destroy` method.
11
11
  * @modified 2022-02-02 Cleared the `toSVGString` function (deprecated). Use `drawutilssvg` instead.
12
- * @version 1.3.0
12
+ * @modified 2022-08-15 Added the `containsPoint` function.
13
+ * @modified 2022-08-23 Added the `lineIntersection` function.
14
+ * @modified 2022-08-23 Added the `closestPoint` function.
15
+ * @version 1.4.0
13
16
  **/
14
17
  import { Line } from "./Line";
15
18
  import { Vector } from "./Vector";
16
19
  import { VertTuple } from "./VertTuple";
17
20
  import { Vertex } from "./Vertex";
18
- import { SVGSerializable, UID } from "./interfaces";
21
+ import { SVGSerializable, UID, XYCoords } from "./interfaces";
19
22
  /**
20
23
  * @classdesc A simple circle: center point and radius.
21
24
  *
@@ -69,6 +72,16 @@ export declare class Circle implements SVGSerializable {
69
72
  * @param {number} radius - The radius of the circle.
70
73
  */
71
74
  constructor(center: Vertex, radius: number);
75
+ /**
76
+ * Check if the given circle is fully contained inside this circle.
77
+ *
78
+ * @method containsPoint
79
+ * @param {XYCoords} point - The point to check if it is contained in this circle.
80
+ * @instance
81
+ * @memberof Circle
82
+ * @return {boolean} `true` if the given point is inside this circle.
83
+ */
84
+ containsPoint(point: XYCoords): boolean;
72
85
  /**
73
86
  * Check if the given circle is fully contained inside this circle.
74
87
  *
@@ -126,6 +139,27 @@ export declare class Circle implements SVGSerializable {
126
139
  * @return {Line|null} The intersection points (as a line) or null if the two circles do not intersect.
127
140
  **/
128
141
  circleIntersection(circle: Circle): Line | null;
142
+ /**
143
+ * Calculate the intersection points (if exists) with the given infinite line (defined by two points).
144
+ *
145
+ * @method lineIntersection
146
+ * @instance
147
+ * @memberof Circle
148
+ * @param {Vertex} a- The first of the two points defining the line.
149
+ * @param {Vertex} b - The second of the two points defining the line.
150
+ * @return {Line|null} The intersection points (as a line) or null if this circle does not intersect the line given.
151
+ **/
152
+ lineIntersection(a: Vertex, b: XYCoords): Line | null;
153
+ /**
154
+ * Calculate the closest point on the outline of this circle to the given point.
155
+ *
156
+ * @method closestPoint
157
+ * @instance
158
+ * @memberof Circle
159
+ * @param {XYCoords} vert - The point to find the closest circle point for.
160
+ * @return {Vertex} The closest point on this circle.
161
+ **/
162
+ closestPoint(vert: XYCoords): Vertex;
129
163
  /**
130
164
  * This function should invalidate any installed listeners and invalidate this object.
131
165
  * After calling this function the object might not hold valid data any more and
package/src/esm/Circle.js CHANGED
@@ -9,7 +9,10 @@
9
9
  * @modified 2021-01-20 Added UID.
10
10
  * @modified 2022-02-02 Added the `destroy` method.
11
11
  * @modified 2022-02-02 Cleared the `toSVGString` function (deprecated). Use `drawutilssvg` instead.
12
- * @version 1.3.0
12
+ * @modified 2022-08-15 Added the `containsPoint` function.
13
+ * @modified 2022-08-23 Added the `lineIntersection` function.
14
+ * @modified 2022-08-23 Added the `closestPoint` function.
15
+ * @version 1.4.0
13
16
  **/
14
17
  import { Line } from "./Line";
15
18
  import { UIDGenerator } from "./UIDGenerator";
@@ -44,6 +47,18 @@ export class Circle {
44
47
  this.center = center;
45
48
  this.radius = radius;
46
49
  }
50
+ /**
51
+ * Check if the given circle is fully contained inside this circle.
52
+ *
53
+ * @method containsPoint
54
+ * @param {XYCoords} point - The point to check if it is contained in this circle.
55
+ * @instance
56
+ * @memberof Circle
57
+ * @return {boolean} `true` if the given point is inside this circle.
58
+ */
59
+ containsPoint(point) {
60
+ return this.center.distance(point) < this.radius;
61
+ }
47
62
  /**
48
63
  * Check if the given circle is fully contained inside this circle.
49
64
  *
@@ -155,6 +170,71 @@ export class Circle {
155
170
  var y4 = p2.y + (h * (p1.x - p0.x)) / d;
156
171
  return new Line(new Vertex(x3, y3), new Vertex(x4, y4));
157
172
  }
173
+ /**
174
+ * Calculate the intersection points (if exists) with the given infinite line (defined by two points).
175
+ *
176
+ * @method lineIntersection
177
+ * @instance
178
+ * @memberof Circle
179
+ * @param {Vertex} a- The first of the two points defining the line.
180
+ * @param {Vertex} b - The second of the two points defining the line.
181
+ * @return {Line|null} The intersection points (as a line) or null if this circle does not intersect the line given.
182
+ **/
183
+ lineIntersection(a, b) {
184
+ // Based on the math from
185
+ // https://mathworld.wolfram.com/Circle-LineIntersection.html
186
+ const interA = new Vertex();
187
+ const interB = new Vertex();
188
+ // First do a transformation, because the calculation is based on a cicle at (0,0)
189
+ const transA = new Vertex(a).sub(this.center);
190
+ const transB = new Vertex(b).sub(this.center);
191
+ const diff = transA.difference(transB);
192
+ // There is a special case if diff.y=0, where the intersection is not calcuatable.
193
+ // Use an non-zero epsilon here to approximate this case.
194
+ // TODO for the future: find a better solution
195
+ if (Math.abs(diff.y) === 0) {
196
+ diff.y = 0.000001;
197
+ }
198
+ const dist = transA.distance(transB);
199
+ const det = transA.x * transB.y - transA.y * transB.x;
200
+ const distSquared = dist * dist;
201
+ const radiusSquared = this.radius * this.radius;
202
+ // Check if circle and line have an intersection at all
203
+ if (radiusSquared * distSquared - det * det < 0) {
204
+ return null;
205
+ }
206
+ const belowSqrt = this.radius * this.radius * dist * dist - det * det;
207
+ const sqrt = Math.sqrt(belowSqrt);
208
+ interA.x = (det * diff.y + Math.sign(diff.y) * diff.x * sqrt) / distSquared;
209
+ interB.x = (det * diff.y - Math.sign(diff.y) * diff.x * sqrt) / distSquared;
210
+ interA.y = (-det * diff.x + Math.abs(diff.y) * sqrt) / distSquared;
211
+ interB.y = (-det * diff.x - Math.abs(diff.y) * sqrt) / distSquared;
212
+ return new Line(interA.add(this.center), interB.add(this.center));
213
+ // return new Line(interA, interB);
214
+ }
215
+ /**
216
+ * Calculate the closest point on the outline of this circle to the given point.
217
+ *
218
+ * @method closestPoint
219
+ * @instance
220
+ * @memberof Circle
221
+ * @param {XYCoords} vert - The point to find the closest circle point for.
222
+ * @return {Vertex} The closest point on this circle.
223
+ **/
224
+ closestPoint(vert) {
225
+ const lineIntersection = this.lineIntersection(this.center, vert);
226
+ if (!lineIntersection) {
227
+ // Note: this case should not happen as a radial from the center always intersect this circle.
228
+ return new Vertex();
229
+ }
230
+ // Return closed of both
231
+ if (lineIntersection.a.distance(vert) < lineIntersection.b.distance(vert)) {
232
+ return lineIntersection.a;
233
+ }
234
+ else {
235
+ return lineIntersection.b;
236
+ }
237
+ }
158
238
  /**
159
239
  * This function should invalidate any installed listeners and invalidate this object.
160
240
  * After calling this function the object might not hold valid data any more and
@@ -1 +1 @@
1
- {"version":3,"file":"Circle.js","sourceRoot":"","sources":["../ts/Circle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;IAYI;AAEJ,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,MAAM,EAAE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