@pie-element/graphing-solution-set 6.1.2-next.1 → 6.1.2

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 (88) hide show
  1. package/CHANGELOG.json +1 -0
  2. package/CHANGELOG.md +856 -0
  3. package/LICENSE.md +5 -0
  4. package/README.md +20 -0
  5. package/configure/CHANGELOG.json +1 -0
  6. package/configure/CHANGELOG.md +816 -0
  7. package/configure/lib/configure.js +312 -0
  8. package/configure/lib/configure.js.map +1 -0
  9. package/configure/lib/correct-response.js +435 -0
  10. package/configure/lib/correct-response.js.map +1 -0
  11. package/configure/lib/defaults.js +357 -0
  12. package/configure/lib/defaults.js.map +1 -0
  13. package/configure/lib/graphing-config.js +408 -0
  14. package/configure/lib/graphing-config.js.map +1 -0
  15. package/configure/lib/index.js +163 -0
  16. package/configure/lib/index.js.map +1 -0
  17. package/configure/lib/utils.js +630 -0
  18. package/configure/lib/utils.js.map +1 -0
  19. package/configure/package.json +29 -0
  20. package/controller/CHANGELOG.json +1 -0
  21. package/controller/CHANGELOG.md +675 -0
  22. package/controller/lib/defaults.js +69 -0
  23. package/controller/lib/defaults.js.map +1 -0
  24. package/controller/lib/index.js +351 -0
  25. package/controller/lib/index.js.map +1 -0
  26. package/controller/lib/utils.js +212 -0
  27. package/controller/lib/utils.js.map +1 -0
  28. package/controller/package.json +22 -0
  29. package/demo-gss.gif +0 -0
  30. package/docs/config-schema.json +1560 -0
  31. package/docs/config-schema.json.md +1114 -0
  32. package/docs/demo/config.js +8 -0
  33. package/docs/demo/generate.js +54 -0
  34. package/docs/demo/index.html +1 -0
  35. package/docs/demo/session.js +6 -0
  36. package/docs/pie-schema.json +1800 -0
  37. package/docs/pie-schema.json.md +952 -0
  38. package/lib/index.js +164 -0
  39. package/lib/index.js.map +1 -0
  40. package/lib/main.js +355 -0
  41. package/lib/main.js.map +1 -0
  42. package/lib/utils.js +515 -0
  43. package/lib/utils.js.map +1 -0
  44. package/package.json +23 -86
  45. package/configure.js +0 -2
  46. package/controller.js +0 -1
  47. package/dist/author/configure.d.ts +0 -26
  48. package/dist/author/configure.js +0 -190
  49. package/dist/author/correct-response.d.ts +0 -33
  50. package/dist/author/correct-response.js +0 -206
  51. package/dist/author/defaults.d.ts +0 -238
  52. package/dist/author/defaults.js +0 -339
  53. package/dist/author/graphing-config.d.ts +0 -33
  54. package/dist/author/graphing-config.js +0 -237
  55. package/dist/author/index.d.ts +0 -62
  56. package/dist/author/index.js +0 -87
  57. package/dist/author/utils.d.ts +0 -46
  58. package/dist/author/utils.js +0 -474
  59. package/dist/browser/author/index.js +0 -1942
  60. package/dist/browser/author/index.js.map +0 -1
  61. package/dist/browser/browser-pUycHh7Y.js +0 -348
  62. package/dist/browser/browser-pUycHh7Y.js.map +0 -1
  63. package/dist/browser/controller/index.js +0 -193
  64. package/dist/browser/controller/index.js.map +0 -1
  65. package/dist/browser/delivery/index.js +0 -782
  66. package/dist/browser/delivery/index.js.map +0 -1
  67. package/dist/browser/dist-BxTk7Laj.js +0 -57671
  68. package/dist/browser/dist-BxTk7Laj.js.map +0 -1
  69. package/dist/browser/graphing-solution-set.css +0 -2
  70. package/dist/controller/defaults.d.ts +0 -64
  71. package/dist/controller/defaults.js +0 -54
  72. package/dist/controller/index.d.ts +0 -24
  73. package/dist/controller/index.js +0 -110
  74. package/dist/controller/utils.d.ts +0 -20
  75. package/dist/controller/utils.js +0 -39
  76. package/dist/delivery/index.d.ts +0 -22
  77. package/dist/delivery/index.js +0 -62
  78. package/dist/delivery/main.d.ts +0 -31
  79. package/dist/delivery/main.js +0 -198
  80. package/dist/delivery/utils.d.ts +0 -12
  81. package/dist/delivery/utils.js +0 -220
  82. package/dist/graphing-solution-set.css +0 -2
  83. package/dist/index.d.ts +0 -1
  84. package/dist/index.iife.d.ts +0 -8
  85. package/dist/index.iife.js +0 -405
  86. package/dist/index.js +0 -2
  87. package/dist/runtime-support.d.ts +0 -12
  88. package/dist/runtime-support.js +0 -12
package/lib/utils.js ADDED
@@ -0,0 +1,515 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.removeInvalidAnswers = exports.pointInsidePolygon = exports.findSectionsInSolutionSet = exports.checkIfLinesAreAdded = void 0;
7
+ /*
8
+ * Check if a line is complete
9
+ * @param {Object} item - mark object
10
+ * */
11
+ const completeFromTo = item => item && completeMark.point(item.from) && completeMark.point(item.to);
12
+
13
+ /*
14
+ * Check if a point is correct and complete
15
+ * @param {Object} point - point object
16
+ * */
17
+ const completePoint = point => point && Number.isFinite(point.x) && Number.isFinite(point.y);
18
+
19
+ /*
20
+ * Complete mark object for line and point
21
+ * */
22
+ const completeMark = {
23
+ line: completeFromTo,
24
+ point: completePoint
25
+ };
26
+
27
+ //////////////////////////////////////////////////////////////////////////////////
28
+ // BELOW FUNCTIONS ARE USED IN configure/src/utils as well
29
+ //////////////////////////////////////////////////////////////////////////////////
30
+
31
+ /*
32
+ * Function to calculate the distance between two points
33
+ * @param {Object} a - point a
34
+ * @param {Object} b - point b
35
+ * */
36
+ const distance = (a, b) => {
37
+ return Number(Math.sqrt((a.x - b.x) ** 2 + (a.y - b.y) ** 2).toFixed(3));
38
+ };
39
+
40
+ /*
41
+ * Function to check if a point lies on edges of a polygon
42
+ * @param {Object} point - point object
43
+ * @param {Array} polygon - polygon points array
44
+ * */
45
+ const pointInPolygon = (point, polygon) => {
46
+ let c = point;
47
+ let inside = false;
48
+ let clonePolygon = [...polygon];
49
+ clonePolygon.push(polygon[0]);
50
+ for (let i = 0; i < clonePolygon.length - 1; i++) {
51
+ let a = clonePolygon[i];
52
+ let b = clonePolygon[i + 1];
53
+ // check if point is on the edge
54
+ if (distance(a, c) + distance(c, b) === distance(a, b)) {
55
+ inside = true;
56
+ break;
57
+ }
58
+ }
59
+ return inside;
60
+ };
61
+
62
+ /*
63
+ * Function to get the intersection point of two lines
64
+ * @param {Number} x1 - x coordinate of point 1 of line 1
65
+ * @param {Number} y1 - y coordinate of point 1 of line 1
66
+ * @param {Number} x2 - x coordinate of point 2 of line 1
67
+ * @param {Number} y2 - y coordinate of point 2 of line 1
68
+ * @param {Number} x3 - x coordinate of point 1 of line 2
69
+ * @param {Number} y3 - y coordinate of point 1 of line 2
70
+ * @param {Number} x4 - x coordinate of point 2 of line 2
71
+ * @param {Number} y4 - y coordinate of point 2 of line 2
72
+ * */
73
+ const lineIntersect = (x1, y1, x2, y2, x3, y3, x4, y4) => {
74
+ let ua,
75
+ denominator = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1);
76
+ if (denominator === 0) {
77
+ return null;
78
+ }
79
+ ua = ((x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3)) / denominator;
80
+ return {
81
+ x: Number((x1 + ua * (x2 - x1)).toFixed(3)),
82
+ y: Number((y1 + ua * (y2 - y1)).toFixed(3))
83
+ };
84
+ };
85
+
86
+ /*
87
+ * Check if a point is inside the graph
88
+ * @param {Object} point - point object
89
+ * @param {Object} domain - domain object
90
+ * @param {Object} range - range object
91
+ * */
92
+ const isPointInsideGraph = (point, domain, range) => {
93
+ return point.x > domain.min && point.x < domain.max && point.y > range.min && point.y < range.max;
94
+ };
95
+
96
+ /*
97
+ * Check if a point is on or inside the graph
98
+ * @param {Object} point - point object
99
+ * @param {Object} domain - domain object
100
+ * @param {Object} range - range object
101
+ * */
102
+ const isPointOnOrInsideGraph = (point, domain, range) => {
103
+ return point.x >= domain.min && point.x <= domain.max && point.y >= range.min && point.y <= range.max;
104
+ };
105
+
106
+ /*
107
+ * Find the intersection point of a mark with the graph
108
+ * @param {Object} mark - mark object
109
+ * @param {Object} domain - domain object
110
+ * @param {Object} range - range object
111
+ * */
112
+ const findIntersectionPointForMark = (mark, domain, range) => {
113
+ let intersectionPoint = [];
114
+ let tempData = [[domain.max, range.max, domain.max, range.min], [domain.min, range.max, domain.min, range.min], [domain.min, range.max, domain.max, range.max], [domain.min, range.min, domain.max, range.min]];
115
+ for (let i = 0; i < tempData.length; i++) {
116
+ let intersection = lineIntersect(mark.from.x, mark.from.y, mark.to.x, mark.to.y, tempData[i][0], tempData[i][1], tempData[i][2], tempData[i][3]);
117
+ if (intersection && isPointOnOrInsideGraph(intersection, domain, range)) {
118
+ intersectionPoint.push(intersection);
119
+ }
120
+ }
121
+ return intersectionPoint;
122
+ };
123
+
124
+ /*
125
+ * Sort points in clockwise direction for a polygon
126
+ * @param {Array} points - points array
127
+ * */
128
+ const sortPointsClockWise = points => {
129
+ // Find min max to get center and Sort from top to bottom
130
+ points.sort((a, b) => a.y - b.y);
131
+ // Get center y
132
+ const cy = (points[0].y + points[points.length - 1].y) / 2;
133
+ // Sort from right to left
134
+ points.sort((a, b) => b.x - a.x);
135
+ // Get center x
136
+ const cx = (points[0].x + points[points.length - 1].x) / 2;
137
+ // Center point
138
+ const center = {
139
+ x: cx,
140
+ y: cy
141
+ };
142
+ // As the points are sorted from right to left the first point is the rightmost Starting angle used to reference other angles
143
+ let startAng;
144
+ points.forEach(point => {
145
+ let ang = Math.atan2(point.y - center.y, point.x - center.x);
146
+ if (!startAng) {
147
+ startAng = ang;
148
+ } else {
149
+ if (ang < startAng) {
150
+ // ensure that all points are clockwise of the start point
151
+ ang += Math.PI * 2;
152
+ }
153
+ }
154
+ point.angle = ang; // add the angle to the point
155
+ });
156
+ // first sort clockwise
157
+ points.sort((a, b) => a.angle - b.angle);
158
+ // then reverse the order
159
+ const ccwPoints = points.reverse();
160
+ // move the last point back to the start
161
+ ccwPoints.unshift(ccwPoints.pop());
162
+ return ccwPoints.map(({
163
+ angle,
164
+ ...attr
165
+ }) => attr);
166
+ };
167
+
168
+ /*
169
+ * Function to calculate the dot product of two vectors
170
+ * @param {Object} v1 - point 1
171
+ * @param {Object} v2 - point 2
172
+ * */
173
+ const dotProduct = (v1, v2) => {
174
+ return v1.x * v2.x + v1.y * v2.y;
175
+ };
176
+
177
+ /*
178
+ * Function to calculate the magnitude of a vector
179
+ * @param {Object} v - point object
180
+ * */
181
+ const magnitude = v => {
182
+ return Math.sqrt(v.x * v.x + v.y * v.y);
183
+ };
184
+
185
+ /*
186
+ * Function to calculate the angle between two vectors in radians
187
+ * @param {Object} v1 - point 1
188
+ * @param {Object} v2 - point 2
189
+ * */
190
+ const angleBetweenVectors = (v1, v2) => {
191
+ const dot = dotProduct(v1, v2);
192
+ const magV1 = magnitude(v1);
193
+ const magV2 = magnitude(v2);
194
+ // Ensure the dot product is within the domain of the acos function
195
+ return Math.acos(dot / (magV1 * magV2));
196
+ };
197
+
198
+ /*
199
+ * Function to check if a point lies between the angle formed by two lines
200
+ * @param {Object} commonPoint - common point of the two lines
201
+ * @param {Object} point1 - point 1 of cone
202
+ * @param {Object} point2 - point 2 of cone
203
+ * @param {Object} testPoint - point to be tested
204
+ * */
205
+ const pointInAngle = (commonPoint, point1, point2, testPoint) => {
206
+ const vector1 = {
207
+ x: point1.x - commonPoint.x,
208
+ y: point1.y - commonPoint.y
209
+ };
210
+ const vector2 = {
211
+ x: point2.x - commonPoint.x,
212
+ y: point2.y - commonPoint.y
213
+ };
214
+ const testVector = {
215
+ x: testPoint.x - commonPoint.x,
216
+ y: testPoint.y - commonPoint.y
217
+ };
218
+ const angle1 = angleBetweenVectors(vector1, testVector);
219
+ const angle2 = angleBetweenVectors(vector2, testVector);
220
+ const angleSum = angle1 + angle2;
221
+ // Check if the sum of angles is approximately equal to the angle between the two lines
222
+ // You may need to adjust the tolerance (e.g., 0.0001) based on your specific requirements
223
+ const tolerance = 0.0001;
224
+ return Math.abs(angleSum - angleBetweenVectors(vector1, vector2)) < tolerance;
225
+ };
226
+
227
+ /*
228
+ * Function to remove duplicate points from an array
229
+ * @param {Array} array - array of points
230
+ * */
231
+ const removeDuplicatesFromArray = array => {
232
+ return array.filter((obj, index) => {
233
+ return index === array.findIndex(o => obj.x === o.x && obj.y === o.y);
234
+ });
235
+ };
236
+
237
+ /*
238
+ * Function to remove duplicate points and filter sections
239
+ * @param {Array} sections - array of sections
240
+ * */
241
+ const removeDuplicateAndFilterSections = sections => {
242
+ //removing duplicate points.
243
+ for (let i = 0; i < sections.length; i++) {
244
+ sections[i] = sections[i].filter((obj, index) => {
245
+ return index === sections[i].findIndex(o => obj.x === o.x && obj.y === o.y);
246
+ });
247
+ }
248
+ //removing arrays with two points
249
+ sections = sections.filter(section => section.length > 2);
250
+ //sorting the points in clockwise direction
251
+ for (let i = 0; i < sections.length; i++) {
252
+ sections[i] = sortPointsClockWise(sections[i]);
253
+ }
254
+ return sections;
255
+ };
256
+
257
+ /*
258
+ * Function to find sections in solution set for one line
259
+ * @param {Array} intersectionPoint - intersection point
260
+ * @param {Object} domain - domain object
261
+ * @param {Object} range - range object
262
+ * */
263
+ const findSectionsInSolutionSetForOneLine = (intersectionPoint, domain, range) => {
264
+ let sections = [];
265
+ sections.push([].concat(intersectionPoint));
266
+ sections.push([].concat(intersectionPoint));
267
+ if (intersectionPoint[0].x === domain.max && intersectionPoint[1].y === range.max || intersectionPoint[1].x === domain.max && intersectionPoint[0].y === range.max) {
268
+ sections[0].push({
269
+ x: domain.max,
270
+ y: range.max
271
+ });
272
+ sections[1].push({
273
+ x: domain.min,
274
+ y: range.max
275
+ }, {
276
+ x: domain.min,
277
+ y: range.min
278
+ }, {
279
+ x: domain.max,
280
+ y: range.min
281
+ });
282
+ } else if (intersectionPoint[0].x === domain.min && intersectionPoint[1].y === range.max || intersectionPoint[1].x === domain.min && intersectionPoint[0].y === range.max) {
283
+ sections[0].push({
284
+ x: domain.min,
285
+ y: range.max
286
+ });
287
+ sections[1].push({
288
+ x: domain.max,
289
+ y: range.max
290
+ }, {
291
+ x: domain.max,
292
+ y: range.min
293
+ }, {
294
+ x: domain.min,
295
+ y: range.min
296
+ });
297
+ } else if (intersectionPoint[0].x === domain.min && intersectionPoint[1].y === range.min || intersectionPoint[1].x === domain.min && intersectionPoint[0].y === range.min) {
298
+ sections[0].push({
299
+ x: domain.min,
300
+ y: range.min
301
+ });
302
+ sections[1].push({
303
+ x: domain.max,
304
+ y: range.min
305
+ }, {
306
+ x: domain.max,
307
+ y: range.max
308
+ }, {
309
+ x: domain.min,
310
+ y: range.max
311
+ });
312
+ } else if (intersectionPoint[0].x === domain.max && intersectionPoint[1].y === range.min || intersectionPoint[1].x === domain.max && intersectionPoint[0].y === range.min) {
313
+ sections[0].push({
314
+ x: domain.max,
315
+ y: range.min
316
+ });
317
+ sections[1].push({
318
+ x: domain.min,
319
+ y: range.min
320
+ }, {
321
+ x: domain.min,
322
+ y: range.max
323
+ }, {
324
+ x: domain.max,
325
+ y: range.max
326
+ });
327
+ } else if (intersectionPoint[0].x === domain.min && intersectionPoint[1].x === domain.max || intersectionPoint[0].x === domain.max && intersectionPoint[1].x === domain.min) {
328
+ sections[0].push({
329
+ x: domain.min,
330
+ y: range.max
331
+ }, {
332
+ x: domain.max,
333
+ y: range.max
334
+ });
335
+ sections[1].push({
336
+ x: domain.min,
337
+ y: range.min
338
+ }, {
339
+ x: domain.max,
340
+ y: range.min
341
+ });
342
+ } else if (intersectionPoint[0].y === range.min && intersectionPoint[1].y === range.max || intersectionPoint[0].y === range.max && intersectionPoint[1].y === range.min) {
343
+ sections[0].push({
344
+ x: domain.min,
345
+ y: range.min
346
+ }, {
347
+ x: domain.min,
348
+ y: range.max
349
+ });
350
+ sections[1].push({
351
+ x: domain.max,
352
+ y: range.min
353
+ }, {
354
+ x: domain.max,
355
+ y: range.max
356
+ });
357
+ }
358
+ return removeDuplicateAndFilterSections(sections);
359
+ };
360
+
361
+ /*
362
+ * Function to find sections in solution set for two lines
363
+ * @param {Object} gssLineData - graphing solution set line data
364
+ * @param {Array} answers - answers array
365
+ * @param {Object} domain - domain object
366
+ * @param {Object} range - range object
367
+ * */
368
+ const findSectionsInSolutionSetForTwoLines = (gssLineData, answers, domain, range) => {
369
+ let mark1 = answers[0];
370
+ let mark2 = answers[1];
371
+ let cornerPoints = [{
372
+ x: domain.min,
373
+ y: range.min
374
+ }, {
375
+ x: domain.min,
376
+ y: range.max
377
+ }, {
378
+ x: domain.max,
379
+ y: range.min
380
+ }, {
381
+ x: domain.max,
382
+ y: range.max
383
+ }];
384
+ let intersectPoint = lineIntersect(mark1.from.x, mark1.from.y, mark1.to.x, mark1.to.y, mark2.from.x, mark2.from.y, mark2.to.x, mark2.to.y);
385
+ let sections = [];
386
+ let intersectionPoint1 = findIntersectionPointForMark(mark1, domain, range);
387
+ intersectionPoint1 = removeDuplicatesFromArray(intersectionPoint1);
388
+ let intersectionPoint2 = findIntersectionPointForMark(mark2, domain, range);
389
+ intersectionPoint2 = removeDuplicatesFromArray(intersectionPoint2);
390
+ if (intersectPoint && isPointInsideGraph(intersectPoint, domain, range)) {
391
+ for (let i = 0; i < intersectionPoint1.length; i++) {
392
+ for (let j = 0; j < intersectionPoint2.length; j++) {
393
+ let bucket = [];
394
+ let newCornerPoints = [];
395
+ bucket.push(intersectPoint);
396
+ bucket.push(intersectionPoint1[i]);
397
+ bucket.push(intersectionPoint2[j]);
398
+ for (let k = 0; k < cornerPoints.length; k++) {
399
+ if (pointInAngle(intersectPoint, intersectionPoint1[i], intersectionPoint2[j], cornerPoints[k])) {
400
+ bucket.push(cornerPoints[k]);
401
+ } else {
402
+ newCornerPoints.push(cornerPoints[k]);
403
+ }
404
+ }
405
+ cornerPoints = newCornerPoints;
406
+ sections.push(bucket);
407
+ }
408
+ }
409
+ } else {
410
+ let sections1 = findSectionsInSolutionSetForOneLine(intersectionPoint1, domain, range);
411
+ let sections2 = findSectionsInSolutionSetForOneLine(intersectionPoint2, domain, range);
412
+ for (let i = 0; i < sections1.length; i++) {
413
+ if (!(pointInPolygon(intersectionPoint2[0], sections1[i]) && pointInPolygon(intersectionPoint2[1], sections1[i]))) {
414
+ sections.push(sections1[i]);
415
+ }
416
+ }
417
+ for (let i = 0; i < sections2.length; i++) {
418
+ if (!(pointInPolygon(intersectionPoint1[0], sections2[i]) && pointInPolygon(intersectionPoint1[1], sections2[i]))) {
419
+ sections.push(sections2[i]);
420
+ }
421
+ }
422
+ for (let i = 0; i < sections.length; i++) {
423
+ cornerPoints = cornerPoints.filter(function (o1) {
424
+ return !sections[i].some(function (o2) {
425
+ return o1.x === o2.x && o1.y === o2.y;
426
+ });
427
+ });
428
+ }
429
+ let sections3 = cornerPoints.concat(intersectionPoint1, intersectionPoint2);
430
+ sections.push(sections3);
431
+ }
432
+ return removeDuplicateAndFilterSections(sections);
433
+ };
434
+
435
+ /*
436
+ * Function to find sections in solution set
437
+ * @param {Object} gssLineData - graphing solution set line data
438
+ * @param {Array} answers - answers array
439
+ * @param {Object} domain - domain object
440
+ * @param {Object} range - range object
441
+ * */
442
+ const findSectionsInSolutionSet = (gssLineData, answers, domain, range) => {
443
+ if (gssLineData.numberOfLines === 1) {
444
+ const intersectionPoint = findIntersectionPointForMark(answers[0], domain, range);
445
+ gssLineData.sections = findSectionsInSolutionSetForOneLine(intersectionPoint, domain, range);
446
+ } else {
447
+ gssLineData.sections = findSectionsInSolutionSetForTwoLines(gssLineData, answers, domain, range);
448
+ }
449
+ return gssLineData;
450
+ };
451
+
452
+ /*
453
+ * Function to check if a point is inside a polygon
454
+ * @param {Object} point - point to be checked
455
+ * @param {Array} polygon - polygon points array
456
+ * */
457
+ exports.findSectionsInSolutionSet = findSectionsInSolutionSet;
458
+ const pointInsidePolygon = (point, polygon) => {
459
+ const num_vertices = polygon.length;
460
+ const x = point.x;
461
+ const y = point.y;
462
+ let inside = false;
463
+ let p1 = polygon[0];
464
+ let p2;
465
+ for (let i = 1; i <= num_vertices; i++) {
466
+ p2 = polygon[i % num_vertices];
467
+ if (y > Math.min(p1.y, p2.y)) {
468
+ if (y <= Math.max(p1.y, p2.y)) {
469
+ if (x <= Math.max(p1.x, p2.x)) {
470
+ const x_intersection = (y - p1.y) * (p2.x - p1.x) / (p2.y - p1.y) + p1.x;
471
+ if (p1.x === p2.x || x <= x_intersection) {
472
+ inside = !inside;
473
+ }
474
+ }
475
+ }
476
+ }
477
+ p1 = p2;
478
+ }
479
+ return inside;
480
+ };
481
+
482
+ /*
483
+ * Function to check if lines are added in the graph
484
+ * @param {Object} gssLineData - graphing solution set line data
485
+ * @param {Array} answer - answer array
486
+ * */
487
+ exports.pointInsidePolygon = pointInsidePolygon;
488
+ const checkIfLinesAreAdded = (gssLineData, answer) => {
489
+ if (answer.length === 0) {
490
+ return false;
491
+ }
492
+ if (gssLineData.numberOfLines === 1) {
493
+ if (answer.length === 1) {
494
+ return !answer[0].building;
495
+ }
496
+ } else {
497
+ if (answer.length !== 2) {
498
+ return false;
499
+ } else {
500
+ return !answer[1].building;
501
+ }
502
+ }
503
+ };
504
+
505
+ /*
506
+ * Function to remove invalid answers
507
+ * @param {Array} answers - answers array
508
+ * */
509
+ exports.checkIfLinesAreAdded = checkIfLinesAreAdded;
510
+ const removeInvalidAnswers = answers => answers ? (answers || []).filter(({
511
+ type,
512
+ ...answer
513
+ }) => completeMark[type] ? completeMark[type](answer) : false) : [];
514
+ exports.removeInvalidAnswers = removeInvalidAnswers;
515
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","names":["completeFromTo","item","completeMark","point","from","to","completePoint","Number","isFinite","x","y","line","distance","a","b","Math","sqrt","toFixed","pointInPolygon","polygon","c","inside","clonePolygon","push","i","length","lineIntersect","x1","y1","x2","y2","x3","y3","x4","y4","ua","denominator","isPointInsideGraph","domain","range","min","max","isPointOnOrInsideGraph","findIntersectionPointForMark","mark","intersectionPoint","tempData","intersection","sortPointsClockWise","points","sort","cy","cx","center","startAng","forEach","ang","atan2","PI","angle","ccwPoints","reverse","unshift","pop","map","attr","dotProduct","v1","v2","magnitude","v","angleBetweenVectors","dot","magV1","magV2","acos","pointInAngle","commonPoint","point1","point2","testPoint","vector1","vector2","testVector","angle1","angle2","angleSum","tolerance","abs","removeDuplicatesFromArray","array","filter","obj","index","findIndex","o","removeDuplicateAndFilterSections","sections","section","findSectionsInSolutionSetForOneLine","concat","findSectionsInSolutionSetForTwoLines","gssLineData","answers","mark1","mark2","cornerPoints","intersectPoint","intersectionPoint1","intersectionPoint2","j","bucket","newCornerPoints","k","sections1","sections2","o1","some","o2","sections3","findSectionsInSolutionSet","numberOfLines","exports","pointInsidePolygon","num_vertices","p1","p2","x_intersection","checkIfLinesAreAdded","answer","building","removeInvalidAnswers","type"],"sources":["../src/utils.js"],"sourcesContent":["/*\n * Check if a line is complete\n * @param {Object} item - mark object\n * */\nconst completeFromTo = (item) => item && completeMark.point(item.from) && completeMark.point(item.to);\n\n/*\n * Check if a point is correct and complete\n * @param {Object} point - point object\n * */\nconst completePoint = (point) => point && Number.isFinite(point.x) && Number.isFinite(point.y);\n\n/*\n * Complete mark object for line and point\n * */\nconst completeMark = {\n line: completeFromTo,\n point: completePoint,\n};\n\n//////////////////////////////////////////////////////////////////////////////////\n// BELOW FUNCTIONS ARE USED IN configure/src/utils as well\n//////////////////////////////////////////////////////////////////////////////////\n\n/*\n * Function to calculate the distance between two points\n * @param {Object} a - point a\n * @param {Object} b - point b\n * */\nconst distance = (a, b) => {\n return Number(Math.sqrt((a.x - b.x) ** 2 + (a.y - b.y) ** 2).toFixed(3));\n};\n\n/*\n * Function to check if a point lies on edges of a polygon\n * @param {Object} point - point object\n * @param {Array} polygon - polygon points array\n * */\nconst pointInPolygon = (point, polygon) => {\n let c = point;\n let inside = false;\n let clonePolygon = [...polygon];\n clonePolygon.push(polygon[0]);\n for (let i = 0; i < clonePolygon.length - 1; i++) {\n let a = clonePolygon[i];\n let b = clonePolygon[i + 1];\n // check if point is on the edge\n if (distance(a, c) + distance(c, b) === distance(a, b)) {\n inside = true;\n break;\n }\n }\n return inside;\n};\n\n/*\n * Function to get the intersection point of two lines\n * @param {Number} x1 - x coordinate of point 1 of line 1\n * @param {Number} y1 - y coordinate of point 1 of line 1\n * @param {Number} x2 - x coordinate of point 2 of line 1\n * @param {Number} y2 - y coordinate of point 2 of line 1\n * @param {Number} x3 - x coordinate of point 1 of line 2\n * @param {Number} y3 - y coordinate of point 1 of line 2\n * @param {Number} x4 - x coordinate of point 2 of line 2\n * @param {Number} y4 - y coordinate of point 2 of line 2\n * */\nconst lineIntersect = (x1, y1, x2, y2, x3, y3, x4, y4) => {\n let ua,\n denominator = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1);\n if (denominator === 0) {\n return null;\n }\n ua = ((x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3)) / denominator;\n return {\n x: Number((x1 + ua * (x2 - x1)).toFixed(3)),\n y: Number((y1 + ua * (y2 - y1)).toFixed(3)),\n };\n};\n\n/*\n * Check if a point is inside the graph\n * @param {Object} point - point object\n * @param {Object} domain - domain object\n * @param {Object} range - range object\n * */\nconst isPointInsideGraph = (point, domain, range) => {\n return point.x > domain.min && point.x < domain.max && point.y > range.min && point.y < range.max;\n};\n\n/*\n * Check if a point is on or inside the graph\n * @param {Object} point - point object\n * @param {Object} domain - domain object\n * @param {Object} range - range object\n * */\nconst isPointOnOrInsideGraph = (point, domain, range) => {\n return point.x >= domain.min && point.x <= domain.max && point.y >= range.min && point.y <= range.max;\n};\n\n/*\n * Find the intersection point of a mark with the graph\n * @param {Object} mark - mark object\n * @param {Object} domain - domain object\n * @param {Object} range - range object\n * */\nconst findIntersectionPointForMark = (mark, domain, range) => {\n let intersectionPoint = [];\n let tempData = [\n [domain.max, range.max, domain.max, range.min],\n [domain.min, range.max, domain.min, range.min],\n [domain.min, range.max, domain.max, range.max],\n [domain.min, range.min, domain.max, range.min],\n ];\n for (let i = 0; i < tempData.length; i++) {\n let intersection = lineIntersect(\n mark.from.x,\n mark.from.y,\n mark.to.x,\n mark.to.y,\n tempData[i][0],\n tempData[i][1],\n tempData[i][2],\n tempData[i][3],\n );\n if (intersection && isPointOnOrInsideGraph(intersection, domain, range)) {\n intersectionPoint.push(intersection);\n }\n }\n return intersectionPoint;\n};\n\n/*\n * Sort points in clockwise direction for a polygon\n * @param {Array} points - points array\n * */\nconst sortPointsClockWise = (points) => {\n // Find min max to get center and Sort from top to bottom\n points.sort((a, b) => a.y - b.y);\n // Get center y\n const cy = (points[0].y + points[points.length - 1].y) / 2;\n // Sort from right to left\n points.sort((a, b) => b.x - a.x);\n // Get center x\n const cx = (points[0].x + points[points.length - 1].x) / 2;\n // Center point\n const center = { x: cx, y: cy };\n // As the points are sorted from right to left the first point is the rightmost Starting angle used to reference other angles\n let startAng;\n points.forEach((point) => {\n let ang = Math.atan2(point.y - center.y, point.x - center.x);\n if (!startAng) {\n startAng = ang;\n } else {\n if (ang < startAng) {\n // ensure that all points are clockwise of the start point\n ang += Math.PI * 2;\n }\n }\n point.angle = ang; // add the angle to the point\n });\n // first sort clockwise\n points.sort((a, b) => a.angle - b.angle);\n // then reverse the order\n const ccwPoints = points.reverse();\n // move the last point back to the start\n ccwPoints.unshift(ccwPoints.pop());\n return ccwPoints.map(({ angle, ...attr }) => attr);\n};\n\n/*\n * Function to calculate the dot product of two vectors\n * @param {Object} v1 - point 1\n * @param {Object} v2 - point 2\n * */\nconst dotProduct = (v1, v2) => {\n return v1.x * v2.x + v1.y * v2.y;\n};\n\n/*\n * Function to calculate the magnitude of a vector\n * @param {Object} v - point object\n * */\nconst magnitude = (v) => {\n return Math.sqrt(v.x * v.x + v.y * v.y);\n};\n\n/*\n * Function to calculate the angle between two vectors in radians\n * @param {Object} v1 - point 1\n * @param {Object} v2 - point 2\n * */\nconst angleBetweenVectors = (v1, v2) => {\n const dot = dotProduct(v1, v2);\n const magV1 = magnitude(v1);\n const magV2 = magnitude(v2);\n // Ensure the dot product is within the domain of the acos function\n return Math.acos(dot / (magV1 * magV2));\n};\n\n/*\n * Function to check if a point lies between the angle formed by two lines\n * @param {Object} commonPoint - common point of the two lines\n * @param {Object} point1 - point 1 of cone\n * @param {Object} point2 - point 2 of cone\n * @param {Object} testPoint - point to be tested\n * */\nconst pointInAngle = (commonPoint, point1, point2, testPoint) => {\n const vector1 = { x: point1.x - commonPoint.x, y: point1.y - commonPoint.y };\n const vector2 = { x: point2.x - commonPoint.x, y: point2.y - commonPoint.y };\n const testVector = { x: testPoint.x - commonPoint.x, y: testPoint.y - commonPoint.y };\n const angle1 = angleBetweenVectors(vector1, testVector);\n const angle2 = angleBetweenVectors(vector2, testVector);\n const angleSum = angle1 + angle2;\n // Check if the sum of angles is approximately equal to the angle between the two lines\n // You may need to adjust the tolerance (e.g., 0.0001) based on your specific requirements\n const tolerance = 0.0001;\n return Math.abs(angleSum - angleBetweenVectors(vector1, vector2)) < tolerance;\n};\n\n/*\n * Function to remove duplicate points from an array\n * @param {Array} array - array of points\n * */\nconst removeDuplicatesFromArray = (array) => {\n return array.filter((obj, index) => {\n return index === array.findIndex((o) => obj.x === o.x && obj.y === o.y);\n });\n};\n\n/*\n * Function to remove duplicate points and filter sections\n * @param {Array} sections - array of sections\n * */\nconst removeDuplicateAndFilterSections = (sections) => {\n //removing duplicate points.\n for (let i = 0; i < sections.length; i++) {\n sections[i] = sections[i].filter((obj, index) => {\n return index === sections[i].findIndex((o) => obj.x === o.x && obj.y === o.y);\n });\n }\n //removing arrays with two points\n sections = sections.filter((section) => section.length > 2);\n //sorting the points in clockwise direction\n for (let i = 0; i < sections.length; i++) {\n sections[i] = sortPointsClockWise(sections[i]);\n }\n return sections;\n};\n\n/*\n * Function to find sections in solution set for one line\n * @param {Array} intersectionPoint - intersection point\n * @param {Object} domain - domain object\n * @param {Object} range - range object\n * */\nconst findSectionsInSolutionSetForOneLine = (intersectionPoint, domain, range) => {\n let sections = [];\n sections.push([].concat(intersectionPoint));\n sections.push([].concat(intersectionPoint));\n if (\n (intersectionPoint[0].x === domain.max && intersectionPoint[1].y === range.max) ||\n (intersectionPoint[1].x === domain.max && intersectionPoint[0].y === range.max)\n ) {\n sections[0].push({ x: domain.max, y: range.max });\n sections[1].push({ x: domain.min, y: range.max }, { x: domain.min, y: range.min }, { x: domain.max, y: range.min });\n } else if (\n (intersectionPoint[0].x === domain.min && intersectionPoint[1].y === range.max) ||\n (intersectionPoint[1].x === domain.min && intersectionPoint[0].y === range.max)\n ) {\n sections[0].push({ x: domain.min, y: range.max });\n sections[1].push({ x: domain.max, y: range.max }, { x: domain.max, y: range.min }, { x: domain.min, y: range.min });\n } else if (\n (intersectionPoint[0].x === domain.min && intersectionPoint[1].y === range.min) ||\n (intersectionPoint[1].x === domain.min && intersectionPoint[0].y === range.min)\n ) {\n sections[0].push({ x: domain.min, y: range.min });\n sections[1].push({ x: domain.max, y: range.min }, { x: domain.max, y: range.max }, { x: domain.min, y: range.max });\n } else if (\n (intersectionPoint[0].x === domain.max && intersectionPoint[1].y === range.min) ||\n (intersectionPoint[1].x === domain.max && intersectionPoint[0].y === range.min)\n ) {\n sections[0].push({ x: domain.max, y: range.min });\n sections[1].push({ x: domain.min, y: range.min }, { x: domain.min, y: range.max }, { x: domain.max, y: range.max });\n } else if (\n (intersectionPoint[0].x === domain.min && intersectionPoint[1].x === domain.max) ||\n (intersectionPoint[0].x === domain.max && intersectionPoint[1].x === domain.min)\n ) {\n sections[0].push({ x: domain.min, y: range.max }, { x: domain.max, y: range.max });\n sections[1].push({ x: domain.min, y: range.min }, { x: domain.max, y: range.min });\n } else if (\n (intersectionPoint[0].y === range.min && intersectionPoint[1].y === range.max) ||\n (intersectionPoint[0].y === range.max && intersectionPoint[1].y === range.min)\n ) {\n sections[0].push({ x: domain.min, y: range.min }, { x: domain.min, y: range.max });\n sections[1].push({ x: domain.max, y: range.min }, { x: domain.max, y: range.max });\n }\n return removeDuplicateAndFilterSections(sections);\n};\n\n/*\n * Function to find sections in solution set for two lines\n * @param {Object} gssLineData - graphing solution set line data\n * @param {Array} answers - answers array\n * @param {Object} domain - domain object\n * @param {Object} range - range object\n * */\nconst findSectionsInSolutionSetForTwoLines = (gssLineData, answers, domain, range) => {\n let mark1 = answers[0];\n let mark2 = answers[1];\n let cornerPoints = [\n { x: domain.min, y: range.min },\n { x: domain.min, y: range.max },\n { x: domain.max, y: range.min },\n { x: domain.max, y: range.max },\n ];\n let intersectPoint = lineIntersect(\n mark1.from.x,\n mark1.from.y,\n mark1.to.x,\n mark1.to.y,\n mark2.from.x,\n mark2.from.y,\n mark2.to.x,\n mark2.to.y,\n );\n let sections = [];\n let intersectionPoint1 = findIntersectionPointForMark(mark1, domain, range);\n intersectionPoint1 = removeDuplicatesFromArray(intersectionPoint1);\n let intersectionPoint2 = findIntersectionPointForMark(mark2, domain, range);\n intersectionPoint2 = removeDuplicatesFromArray(intersectionPoint2);\n if (intersectPoint && isPointInsideGraph(intersectPoint, domain, range)) {\n for (let i = 0; i < intersectionPoint1.length; i++) {\n for (let j = 0; j < intersectionPoint2.length; j++) {\n let bucket = [];\n let newCornerPoints = [];\n bucket.push(intersectPoint);\n bucket.push(intersectionPoint1[i]);\n bucket.push(intersectionPoint2[j]);\n for (let k = 0; k < cornerPoints.length; k++) {\n if (pointInAngle(intersectPoint, intersectionPoint1[i], intersectionPoint2[j], cornerPoints[k])) {\n bucket.push(cornerPoints[k]);\n } else {\n newCornerPoints.push(cornerPoints[k]);\n }\n }\n cornerPoints = newCornerPoints;\n sections.push(bucket);\n }\n }\n } else {\n let sections1 = findSectionsInSolutionSetForOneLine(intersectionPoint1, domain, range);\n let sections2 = findSectionsInSolutionSetForOneLine(intersectionPoint2, domain, range);\n for (let i = 0; i < sections1.length; i++) {\n if (\n !(pointInPolygon(intersectionPoint2[0], sections1[i]) && pointInPolygon(intersectionPoint2[1], sections1[i]))\n ) {\n sections.push(sections1[i]);\n }\n }\n for (let i = 0; i < sections2.length; i++) {\n if (\n !(pointInPolygon(intersectionPoint1[0], sections2[i]) && pointInPolygon(intersectionPoint1[1], sections2[i]))\n ) {\n sections.push(sections2[i]);\n }\n }\n for (let i = 0; i < sections.length; i++) {\n cornerPoints = cornerPoints.filter(function (o1) {\n return !sections[i].some(function (o2) {\n return o1.x === o2.x && o1.y === o2.y;\n });\n });\n }\n let sections3 = cornerPoints.concat(intersectionPoint1, intersectionPoint2);\n sections.push(sections3);\n }\n return removeDuplicateAndFilterSections(sections);\n};\n\n/*\n * Function to find sections in solution set\n * @param {Object} gssLineData - graphing solution set line data\n * @param {Array} answers - answers array\n * @param {Object} domain - domain object\n * @param {Object} range - range object\n * */\nexport const findSectionsInSolutionSet = (gssLineData, answers, domain, range) => {\n if (gssLineData.numberOfLines === 1) {\n const intersectionPoint = findIntersectionPointForMark(answers[0], domain, range);\n gssLineData.sections = findSectionsInSolutionSetForOneLine(intersectionPoint, domain, range);\n } else {\n gssLineData.sections = findSectionsInSolutionSetForTwoLines(gssLineData, answers, domain, range);\n }\n return gssLineData;\n};\n\n/*\n * Function to check if a point is inside a polygon\n * @param {Object} point - point to be checked\n * @param {Array} polygon - polygon points array\n * */\nexport const pointInsidePolygon = (point, polygon) => {\n const num_vertices = polygon.length;\n const x = point.x;\n const y = point.y;\n let inside = false;\n let p1 = polygon[0];\n let p2;\n for (let i = 1; i <= num_vertices; i++) {\n p2 = polygon[i % num_vertices];\n if (y > Math.min(p1.y, p2.y)) {\n if (y <= Math.max(p1.y, p2.y)) {\n if (x <= Math.max(p1.x, p2.x)) {\n const x_intersection = ((y - p1.y) * (p2.x - p1.x)) / (p2.y - p1.y) + p1.x;\n if (p1.x === p2.x || x <= x_intersection) {\n inside = !inside;\n }\n }\n }\n }\n p1 = p2;\n }\n return inside;\n};\n\n/*\n * Function to check if lines are added in the graph\n * @param {Object} gssLineData - graphing solution set line data\n * @param {Array} answer - answer array\n * */\nexport const checkIfLinesAreAdded = (gssLineData, answer) => {\n if (answer.length === 0) {\n return false;\n }\n if (gssLineData.numberOfLines === 1) {\n if (answer.length === 1) {\n return !answer[0].building;\n }\n } else {\n if (answer.length !== 2) {\n return false;\n } else {\n return !answer[1].building;\n }\n }\n};\n\n/*\n * Function to remove invalid answers\n * @param {Array} answers - answers array\n * */\nexport const removeInvalidAnswers = (answers) =>\n answers\n ? (answers || []).filter(({ type, ...answer }) => (completeMark[type] ? completeMark[type](answer) : false))\n : [];\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA,MAAMA,cAAc,GAAIC,IAAI,IAAKA,IAAI,IAAIC,YAAY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