@pie-element/graphing-solution-set 0.1.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 (217) hide show
  1. package/dist/author/configure.d.ts +27 -0
  2. package/dist/author/configure.d.ts.map +1 -0
  3. package/dist/author/configure.js +190 -0
  4. package/dist/author/correct-response.d.ts +34 -0
  5. package/dist/author/correct-response.d.ts.map +1 -0
  6. package/dist/author/correct-response.js +206 -0
  7. package/dist/author/defaults.d.ts +239 -0
  8. package/dist/author/defaults.d.ts.map +1 -0
  9. package/dist/author/defaults.js +339 -0
  10. package/dist/author/graphing-config.d.ts +34 -0
  11. package/dist/author/graphing-config.d.ts.map +1 -0
  12. package/dist/author/graphing-config.js +238 -0
  13. package/dist/author/index.d.ts +63 -0
  14. package/dist/author/index.d.ts.map +1 -0
  15. package/dist/author/index.js +87 -0
  16. package/dist/author/utils.d.ts +47 -0
  17. package/dist/author/utils.d.ts.map +1 -0
  18. package/dist/author/utils.js +474 -0
  19. package/dist/controller/defaults.d.ts +65 -0
  20. package/dist/controller/defaults.d.ts.map +1 -0
  21. package/dist/controller/defaults.js +54 -0
  22. package/dist/controller/index.d.ts +25 -0
  23. package/dist/controller/index.d.ts.map +1 -0
  24. package/dist/controller/index.js +112 -0
  25. package/dist/controller/utils.d.ts +21 -0
  26. package/dist/controller/utils.d.ts.map +1 -0
  27. package/dist/controller/utils.js +42 -0
  28. package/dist/delivery/index.d.ts +23 -0
  29. package/dist/delivery/index.d.ts.map +1 -0
  30. package/dist/delivery/index.js +62 -0
  31. package/dist/delivery/main.d.ts +32 -0
  32. package/dist/delivery/main.d.ts.map +1 -0
  33. package/dist/delivery/main.js +198 -0
  34. package/dist/delivery/utils.d.ts +13 -0
  35. package/dist/delivery/utils.d.ts.map +1 -0
  36. package/dist/delivery/utils.js +220 -0
  37. package/dist/graphing-solution-set.css +2 -0
  38. package/dist/index.d.ts +2 -0
  39. package/dist/index.d.ts.map +1 -0
  40. package/dist/index.iife.d.ts +9 -0
  41. package/dist/index.iife.d.ts.map +1 -0
  42. package/dist/index.iife.js +373 -0
  43. package/dist/index.js +2 -0
  44. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_DataView.js +6 -0
  45. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Hash.js +16 -0
  46. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_ListCache.js +16 -0
  47. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Map.js +6 -0
  48. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_MapCache.js +16 -0
  49. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Promise.js +6 -0
  50. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Set.js +6 -0
  51. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_SetCache.js +11 -0
  52. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Stack.js +13 -0
  53. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Symbol.js +5 -0
  54. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Uint8Array.js +5 -0
  55. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_WeakMap.js +6 -0
  56. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_apply.js +12 -0
  57. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayEach.js +7 -0
  58. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayFilter.js +10 -0
  59. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayIncludes.js +7 -0
  60. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayIncludesWith.js +7 -0
  61. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayLikeKeys.js +15 -0
  62. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayMap.js +7 -0
  63. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayPush.js +7 -0
  64. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arraySome.js +7 -0
  65. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_assignValue.js +10 -0
  66. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_assocIndexOf.js +8 -0
  67. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseAssign.js +8 -0
  68. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseAssignIn.js +8 -0
  69. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseAssignValue.js +12 -0
  70. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseClone.js +57 -0
  71. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseCreate.js +14 -0
  72. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseDifference.js +23 -0
  73. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseFindIndex.js +7 -0
  74. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseFlatten.js +13 -0
  75. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseGetAllKeys.js +9 -0
  76. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseGetTag.js +10 -0
  77. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIndexOf.js +9 -0
  78. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsArguments.js +9 -0
  79. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsEqual.js +8 -0
  80. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsEqualDeep.js +30 -0
  81. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsMap.js +9 -0
  82. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsNaN.js +6 -0
  83. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsNative.js +11 -0
  84. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsSet.js +9 -0
  85. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsTypedArray.js +11 -0
  86. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseKeys.js +12 -0
  87. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseKeysIn.js +13 -0
  88. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseRest.js +9 -0
  89. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseSet.js +22 -0
  90. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseSetToString.js +14 -0
  91. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseTimes.js +7 -0
  92. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseToString.js +15 -0
  93. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseUnary.js +8 -0
  94. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseUniq.js +27 -0
  95. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cacheHas.js +6 -0
  96. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_castPath.js +10 -0
  97. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneArrayBuffer.js +8 -0
  98. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneBuffer.js +10 -0
  99. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneDataView.js +8 -0
  100. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneRegExp.js +8 -0
  101. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneSymbol.js +8 -0
  102. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneTypedArray.js +8 -0
  103. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copyArray.js +8 -0
  104. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copyObject.js +14 -0
  105. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copySymbols.js +8 -0
  106. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copySymbolsIn.js +8 -0
  107. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_coreJsData.js +5 -0
  108. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_createSet.js +9 -0
  109. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_defineProperty.js +10 -0
  110. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_equalArrays.js +35 -0
  111. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_equalByTag.js +35 -0
  112. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_equalObjects.js +32 -0
  113. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_freeGlobal.js +4 -0
  114. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getAllKeys.js +9 -0
  115. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getAllKeysIn.js +9 -0
  116. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getMapData.js +8 -0
  117. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getNative.js +9 -0
  118. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getPrototype.js +5 -0
  119. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getRawTag.js +14 -0
  120. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getSymbols.js +10 -0
  121. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getSymbolsIn.js +11 -0
  122. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getTag.js +23 -0
  123. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getValue.js +6 -0
  124. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashClear.js +7 -0
  125. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashDelete.js +7 -0
  126. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashGet.js +13 -0
  127. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashHas.js +9 -0
  128. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashSet.js +9 -0
  129. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_initCloneArray.js +8 -0
  130. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_initCloneByTag.js +33 -0
  131. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_initCloneObject.js +9 -0
  132. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isFlattenable.js +10 -0
  133. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isIndex.js +8 -0
  134. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isKey.js +11 -0
  135. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isKeyable.js +7 -0
  136. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isMasked.js +11 -0
  137. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isPrototype.js +8 -0
  138. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheClear.js +6 -0
  139. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheDelete.js +9 -0
  140. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheGet.js +8 -0
  141. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheHas.js +7 -0
  142. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheSet.js +8 -0
  143. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheClear.js +13 -0
  144. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheDelete.js +8 -0
  145. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheGet.js +7 -0
  146. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheHas.js +7 -0
  147. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheSet.js +8 -0
  148. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapToArray.js +9 -0
  149. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_memoizeCapped.js +11 -0
  150. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeCreate.js +5 -0
  151. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeKeys.js +5 -0
  152. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeKeysIn.js +8 -0
  153. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nodeUtil.js +9 -0
  154. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_objectToString.js +7 -0
  155. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_overArg.js +8 -0
  156. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_overRest.js +13 -0
  157. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_root.js +5 -0
  158. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setCacheAdd.js +7 -0
  159. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setCacheHas.js +6 -0
  160. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setToArray.js +9 -0
  161. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setToString.js +6 -0
  162. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_shortOut.js +14 -0
  163. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackClear.js +7 -0
  164. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackDelete.js +7 -0
  165. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackGet.js +6 -0
  166. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackHas.js +6 -0
  167. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackSet.js +16 -0
  168. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_strictIndexOf.js +7 -0
  169. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stringToPath.js +10 -0
  170. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_toKey.js +10 -0
  171. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_toSource.js +15 -0
  172. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/cloneDeep.js +8 -0
  173. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/constant.js +8 -0
  174. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/differenceWith.js +12 -0
  175. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/eq.js +6 -0
  176. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/identity.js +6 -0
  177. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArguments.js +10 -0
  178. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArray.js +4 -0
  179. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArrayLike.js +8 -0
  180. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArrayLikeObject.js +8 -0
  181. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isBuffer.js +6 -0
  182. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isEmpty.js +21 -0
  183. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isEqual.js +7 -0
  184. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isFunction.js +11 -0
  185. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isLength.js +7 -0
  186. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isMap.js +7 -0
  187. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isObject.js +7 -0
  188. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isObjectLike.js +6 -0
  189. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isSet.js +7 -0
  190. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isSymbol.js +9 -0
  191. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isTypedArray.js +7 -0
  192. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/keys.js +9 -0
  193. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/keysIn.js +9 -0
  194. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/last.js +7 -0
  195. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/memoize.js +16 -0
  196. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/noop.js +4 -0
  197. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/set.js +7 -0
  198. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/stubArray.js +6 -0
  199. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/stubFalse.js +6 -0
  200. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/toString.js +7 -0
  201. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/uniq.js +7 -0
  202. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/uniqWith.js +7 -0
  203. package/package.json +70 -0
  204. package/src/author/configure.tsx +266 -0
  205. package/src/author/correct-response.tsx +408 -0
  206. package/src/author/defaults.tsx +366 -0
  207. package/src/author/graphing-config.tsx +318 -0
  208. package/src/author/index.ts +176 -0
  209. package/src/author/utils.ts +577 -0
  210. package/src/controller/defaults.ts +72 -0
  211. package/src/controller/index.ts +313 -0
  212. package/src/controller/utils.ts +195 -0
  213. package/src/delivery/index.ts +159 -0
  214. package/src/delivery/main.tsx +361 -0
  215. package/src/delivery/utils.ts +465 -0
  216. package/src/index.iife.ts +16 -0
  217. package/src/index.ts +1 -0
@@ -0,0 +1,577 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * @synced-from pie-elements/packages/graphing-solution-set/configure/src/utils.js
4
+ * @auto-generated
5
+ *
6
+ * This file is automatically synced from pie-elements and converted to TypeScript.
7
+ * Manual edits will be overwritten on next sync.
8
+ * To make changes, edit the upstream JavaScript file and run sync again.
9
+ */
10
+
11
+ import { isEqual } from 'lodash-es';
12
+
13
+ /*Valid grid values*/
14
+ const VALID_GRID_VALUES = [
15
+ 0.01, 0.02, 0.04, 0.05, 0.0625, 0.1, 0.125, 0.2, 0.25, 0.5, 1, 2, 3, 4, 5, 8, 10, 12, 15, 20, 40, 50, 64, 100, 500,
16
+ 1000,
17
+ ];
18
+
19
+ // same as VALID_GRID_VALUES but next values are excluded: 0.04, 0.0625, 0.125, 3, 4, 8, 12, 15, 40, 64
20
+ const PREFERRED_VALID_GRID_VALUES = [0.01, 0.02, 0.05, 0.1, 0.2, 0.25, 0.5, 1, 2, 5, 10, 20, 50, 100, 500, 1000];
21
+
22
+ /*Valid label values*/
23
+ export const VALID_LABEL_VALUES = {
24
+ 0.01: [0, 0.01, 0.02, 0.04, 0.05, 0.1],
25
+ 0.02: [0, 0.02, 0.04, 0.1],
26
+ 0.04: [0, 0.04, 0.08, 0.16, 0.2],
27
+ 0.05: [0, 0.05, 0.1, 0.2, 0.25],
28
+ 0.0625: [0, 0.0625, 0.125, 0.25, 0.5],
29
+ 0.1: [0, 0.1, 0.2, 0.4, 0.5, 1],
30
+ 0.125: [0, 0.125, 0.25, 0.5, 1],
31
+ 0.2: [0, 0.2, 0.5, 0.1],
32
+ 0.25: [0, 0.25, 0.5, 1, 2],
33
+ 0.5: [0, 0.5, 1, 2],
34
+ 1: [0, 1, 2, 4, 5, 10],
35
+ 2: [0, 2, 4, 8, 10],
36
+ 3: [0, 3, 6, 12, 15],
37
+ 4: [0, 4, 8, 16, 20],
38
+ 5: [0, 5, 10, 20, 25],
39
+ 8: [0, 8, 16, 32, 40, 64],
40
+ 10: [0, 10, 20, 40, 50, 100],
41
+ 12: [0, 12, 24],
42
+ 15: [0, 15, 30, 60],
43
+ 20: [0, 20, 40, 80, 100],
44
+ 40: [0, 40, 80, 160, 200],
45
+ 50: [0, 50, 100, 200, 250],
46
+ 64: [0, 64, 128],
47
+ 100: [0, 100, 200, 400, 500],
48
+ 500: [0, 500, 1000, 2500],
49
+ 1000: [0, 1000, 2000, 4000, 5000],
50
+ };
51
+
52
+ /*
53
+ * Function to get grid values
54
+ * @param {Object} axis - axis object
55
+ * @param {Number} size - size of the axis
56
+ * @param {Boolean} prefferedValues - flag to get preffered values
57
+ * */
58
+ export const getGridValues = (axis, size, prefferedValues = false) => {
59
+ const minValue = (10 * (axis.max - axis.min)) / size;
60
+ const maxValue = minValue * 10;
61
+ const values = prefferedValues ? PREFERRED_VALID_GRID_VALUES : VALID_GRID_VALUES;
62
+ return values.filter((value) => value >= minValue && value <= maxValue);
63
+ };
64
+
65
+ /*
66
+ * Function to get label values
67
+ * @param {Number} value - value of the axis step
68
+ * */
69
+ export const getLabelValues = (value) => VALID_LABEL_VALUES[value] || [];
70
+
71
+ /*
72
+ * Function to apply constraints
73
+ * @param {Object} axis - axis object
74
+ * @param {Number} size - size of the axis
75
+ * @param {Array} oldGridValues - old grid values
76
+ * @param {Array} oldLabelValues - old label values
77
+ * */
78
+ export const applyConstraints = (axis, size, oldGridValues, oldLabelValues) => {
79
+ const gridValues = getGridValues(axis, size);
80
+ let labelValues = getLabelValues(axis.step);
81
+ if (!isEqual(oldGridValues, gridValues) && !gridValues.includes(axis.step)) {
82
+ const preferredValues = getGridValues(axis, size, true);
83
+ const lowestValue = preferredValues[0] || 1;
84
+ axis.step = lowestValue;
85
+ labelValues = getLabelValues(lowestValue);
86
+ if (!labelValues.includes(axis.labelStep)) {
87
+ axis.labelStep = lowestValue;
88
+ }
89
+ return { gridValues, labelValues };
90
+ }
91
+ if (!isEqual(oldLabelValues, labelValues) && !labelValues.includes(axis.labelStep)) {
92
+ axis.labelStep = axis.step;
93
+ }
94
+ return { gridValues, labelValues };
95
+ };
96
+
97
+ // also used in pie-lib/graphing/utils as 'getTickValues'
98
+ /*
99
+ * Function to get plotable points
100
+ * @param {Object} prop - axis object
101
+ * */
102
+ const getPlotablePoints = (prop) => {
103
+ const tickValues = [];
104
+ let tickVal = 0;
105
+ while (tickVal >= prop.min && tickValues.indexOf(tickVal) < 0) {
106
+ tickValues.push(tickVal);
107
+ tickVal = Math.round((tickVal - prop.step) * 10000) / 10000;
108
+ }
109
+ tickVal = Math.round(prop.step * 10000) / 10000;
110
+ while (tickVal <= prop.max && tickValues.indexOf(tickVal) < 0) {
111
+ tickValues.push(tickVal);
112
+ tickVal = Math.round((tickVal + prop.step) * 10000) / 10000;
113
+ }
114
+ // return only ticks that are inside the min-max interval
115
+ if (tickValues) {
116
+ return tickValues.filter((tV) => tV >= prop.min && tV <= prop.max);
117
+ }
118
+ return [];
119
+ };
120
+
121
+ /*
122
+ * Function to get plotable marks
123
+ * @param {Object} domain - domain object
124
+ * @param {Object} range - range object
125
+ * @param {Object} answers - answers object
126
+ * */
127
+ export const filterPlotableMarks = (domain, range, answers) => {
128
+ const domainValues = getPlotablePoints(domain);
129
+ const rangeValues = getPlotablePoints(range);
130
+ const isPointPlotable = (x, y) => domainValues.includes(x) && rangeValues.includes(y);
131
+ return Object.entries(answers || {}).reduce((newAnswers, [key, answer]) => {
132
+ newAnswers[key] = {
133
+ ...answer,
134
+ marks: (answer.marks || []).filter((mark) => {
135
+ if (mark.type === 'point') {
136
+ return isPointPlotable(mark.x, mark.y);
137
+ }
138
+ if (mark.type === 'polygon') {
139
+ return !mark.points.find((point) => !isPointPlotable(point.x, point.y));
140
+ }
141
+ const from = mark.from || mark.root;
142
+ const to = mark.to || mark.edge;
143
+ return mark.building
144
+ ? isPointPlotable(from.x, from.y)
145
+ : isPointPlotable(from.x, from.y) && isPointPlotable(to.x, to.y);
146
+ }),
147
+ };
148
+ return newAnswers;
149
+ }, {});
150
+ };
151
+
152
+ //////////////////////////////////////////////////////////////////////////////////
153
+ // BELOW FUNCTIONS ARE USED IN src/utils as well
154
+ //////////////////////////////////////////////////////////////////////////////////
155
+
156
+ /*
157
+ * Function to calculate the distance between two points
158
+ * @param {Object} a - point a
159
+ * @param {Object} b - point b
160
+ * */
161
+ const distance = (a, b) => {
162
+ return Number(Math.sqrt((a.x - b.x) ** 2 + (a.y - b.y) ** 2).toFixed(3));
163
+ };
164
+
165
+ /*
166
+ * Function to check if a point lies on edges of a polygon
167
+ * @param {Object} point - point object
168
+ * @param {Array} polygon - polygon points array
169
+ * */
170
+ const pointInPolygon = (point, polygon) => {
171
+ let c = point;
172
+ let inside = false;
173
+ let clonePolygon = [...polygon];
174
+ clonePolygon.push(polygon[0]);
175
+ for (let i = 0; i < clonePolygon.length - 1; i++) {
176
+ let a = clonePolygon[i];
177
+ let b = clonePolygon[i + 1];
178
+ // check if point is on the edge
179
+ if (distance(a, c) + distance(c, b) === distance(a, b)) {
180
+ inside = true;
181
+ break;
182
+ }
183
+ }
184
+ return inside;
185
+ };
186
+
187
+ /*
188
+ * Function to get the intersection point of two lines
189
+ * @param {Number} x1 - x coordinate of point 1 of line 1
190
+ * @param {Number} y1 - y coordinate of point 1 of line 1
191
+ * @param {Number} x2 - x coordinate of point 2 of line 1
192
+ * @param {Number} y2 - y coordinate of point 2 of line 1
193
+ * @param {Number} x3 - x coordinate of point 1 of line 2
194
+ * @param {Number} y3 - y coordinate of point 1 of line 2
195
+ * @param {Number} x4 - x coordinate of point 2 of line 2
196
+ * @param {Number} y4 - y coordinate of point 2 of line 2
197
+ * */
198
+ const lineIntersect = (x1, y1, x2, y2, x3, y3, x4, y4) => {
199
+ let ua,
200
+ denominator = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1);
201
+ if (denominator === 0) {
202
+ return null;
203
+ }
204
+ ua = ((x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3)) / denominator;
205
+ return {
206
+ x: Number((x1 + ua * (x2 - x1)).toFixed(3)),
207
+ y: Number((y1 + ua * (y2 - y1)).toFixed(3)),
208
+ };
209
+ };
210
+
211
+ /*
212
+ * Check if a point is inside the graph
213
+ * @param {Object} point - point object
214
+ * @param {Object} domain - domain object
215
+ * @param {Object} range - range object
216
+ * */
217
+ const isPointInsideGraph = (point, domain, range) => {
218
+ return point.x > domain.min && point.x < domain.max && point.y > range.min && point.y < range.max;
219
+ };
220
+
221
+ /*
222
+ * Check if a point is on or inside the graph
223
+ * @param {Object} point - point object
224
+ * @param {Object} domain - domain object
225
+ * @param {Object} range - range object
226
+ * */
227
+ const isPointOnOrInsideGraph = (point, domain, range) => {
228
+ return point.x >= domain.min && point.x <= domain.max && point.y >= range.min && point.y <= range.max;
229
+ };
230
+
231
+ /*
232
+ * Find the intersection point of a mark with the graph
233
+ * @param {Object} mark - mark object
234
+ * @param {Object} domain - domain object
235
+ * @param {Object} range - range object
236
+ * */
237
+ const findIntersectionPointForMark = (mark, domain, range) => {
238
+ let intersectionPoint = [];
239
+ let tempData = [
240
+ [domain.max, range.max, domain.max, range.min],
241
+ [domain.min, range.max, domain.min, range.min],
242
+ [domain.min, range.max, domain.max, range.max],
243
+ [domain.min, range.min, domain.max, range.min],
244
+ ];
245
+ for (let i = 0; i < tempData.length; i++) {
246
+ let intersection = lineIntersect(
247
+ mark.from.x,
248
+ mark.from.y,
249
+ mark.to.x,
250
+ mark.to.y,
251
+ tempData[i][0],
252
+ tempData[i][1],
253
+ tempData[i][2],
254
+ tempData[i][3],
255
+ );
256
+ if (intersection && isPointOnOrInsideGraph(intersection, domain, range)) {
257
+ intersectionPoint.push(intersection);
258
+ }
259
+ }
260
+ return intersectionPoint;
261
+ };
262
+
263
+ /*
264
+ * Sort points in clockwise direction for a polygon
265
+ * @param {Array} points - points array
266
+ * */
267
+ const sortPointsClockWise = (points) => {
268
+ // Find min max to get center and Sort from top to bottom
269
+ points.sort((a, b) => a.y - b.y);
270
+ // Get center y
271
+ const cy = (points[0].y + points[points.length - 1].y) / 2;
272
+ // Sort from right to left
273
+ points.sort((a, b) => b.x - a.x);
274
+ // Get center x
275
+ const cx = (points[0].x + points[points.length - 1].x) / 2;
276
+ // Center point
277
+ const center = { x: cx, y: cy };
278
+ // As the points are sorted from right to left the first point is the rightmost Starting angle used to reference other angles
279
+ let startAng;
280
+ points.forEach((point) => {
281
+ let ang = Math.atan2(point.y - center.y, point.x - center.x);
282
+ if (!startAng) {
283
+ startAng = ang;
284
+ } else {
285
+ if (ang < startAng) {
286
+ // ensure that all points are clockwise of the start point
287
+ ang += Math.PI * 2;
288
+ }
289
+ }
290
+ point.angle = ang; // add the angle to the point
291
+ });
292
+ // first sort clockwise
293
+ points.sort((a, b) => a.angle - b.angle);
294
+ // then reverse the order
295
+ const ccwPoints = points.reverse();
296
+ // move the last point back to the start
297
+ ccwPoints.unshift(ccwPoints.pop());
298
+ return ccwPoints.map(({ angle, ...attr }) => attr);
299
+ };
300
+
301
+ /*
302
+ * Function to calculate the dot product of two vectors
303
+ * @param {Object} v1 - point 1
304
+ * @param {Object} v2 - point 2
305
+ * */
306
+ const dotProduct = (v1, v2) => {
307
+ return v1.x * v2.x + v1.y * v2.y;
308
+ };
309
+
310
+ /*
311
+ * Function to calculate the magnitude of a vector
312
+ * @param {Object} v - point object
313
+ * */
314
+ const magnitude = (v) => {
315
+ return Math.sqrt(v.x * v.x + v.y * v.y);
316
+ };
317
+
318
+ /*
319
+ * Function to calculate the angle between two vectors in radians
320
+ * @param {Object} v1 - point 1
321
+ * @param {Object} v2 - point 2
322
+ * */
323
+ const angleBetweenVectors = (v1, v2) => {
324
+ const dot = dotProduct(v1, v2);
325
+ const magV1 = magnitude(v1);
326
+ const magV2 = magnitude(v2);
327
+ // Ensure the dot product is within the domain of the acos function
328
+ return Math.acos(dot / (magV1 * magV2));
329
+ };
330
+
331
+ /*
332
+ * Function to check if a point lies between the angle formed by two lines
333
+ * @param {Object} commonPoint - common point of the two lines
334
+ * @param {Object} point1 - point 1 of cone
335
+ * @param {Object} point2 - point 2 of cone
336
+ * @param {Object} testPoint - point to be tested
337
+ * */
338
+ const pointInAngle = (commonPoint, point1, point2, testPoint) => {
339
+ const vector1 = { x: point1.x - commonPoint.x, y: point1.y - commonPoint.y };
340
+ const vector2 = { x: point2.x - commonPoint.x, y: point2.y - commonPoint.y };
341
+ const testVector = { x: testPoint.x - commonPoint.x, y: testPoint.y - commonPoint.y };
342
+ const angle1 = angleBetweenVectors(vector1, testVector);
343
+ const angle2 = angleBetweenVectors(vector2, testVector);
344
+ const angleSum = angle1 + angle2;
345
+ // Check if the sum of angles is approximately equal to the angle between the two lines
346
+ // You may need to adjust the tolerance (e.g., 0.0001) based on your specific requirements
347
+ const tolerance = 0.0001;
348
+ return Math.abs(angleSum - angleBetweenVectors(vector1, vector2)) < tolerance;
349
+ };
350
+
351
+ /*
352
+ * Function to remove duplicate points from an array
353
+ * @param {Array} array - array of points
354
+ * */
355
+ const removeDuplicatesFromArray = (array) => {
356
+ return array.filter((obj, index) => {
357
+ return index === array.findIndex((o) => obj.x === o.x && obj.y === o.y);
358
+ });
359
+ };
360
+
361
+ /*
362
+ * Function to remove duplicate points and filter sections
363
+ * @param {Array} sections - array of sections
364
+ * */
365
+ const removeDuplicateAndFilterSections = (sections) => {
366
+ //removing duplicate points.
367
+ for (let i = 0; i < sections.length; i++) {
368
+ sections[i] = sections[i].filter((obj, index) => {
369
+ return index === sections[i].findIndex((o) => obj.x === o.x && obj.y === o.y);
370
+ });
371
+ }
372
+ //removing arrays with two points
373
+ sections = sections.filter((section) => section.length > 2);
374
+ //sorting the points in clockwise direction
375
+ for (let i = 0; i < sections.length; i++) {
376
+ sections[i] = sortPointsClockWise(sections[i]);
377
+ }
378
+ return sections;
379
+ };
380
+
381
+ /*
382
+ * Function to find sections in solution set for one line
383
+ * @param {Array} intersectionPoint - intersection point
384
+ * @param {Object} domain - domain object
385
+ * @param {Object} range - range object
386
+ * */
387
+ const findSectionsInSolutionSetForOneLine = (intersectionPoint, domain, range) => {
388
+ let sections = [];
389
+ sections.push([].concat(intersectionPoint));
390
+ sections.push([].concat(intersectionPoint));
391
+ if (
392
+ (intersectionPoint[0].x === domain.max && intersectionPoint[1].y === range.max) ||
393
+ (intersectionPoint[1].x === domain.max && intersectionPoint[0].y === range.max)
394
+ ) {
395
+ sections[0].push({ x: domain.max, y: range.max });
396
+ sections[1].push({ x: domain.min, y: range.max }, { x: domain.min, y: range.min }, { x: domain.max, y: range.min });
397
+ } else if (
398
+ (intersectionPoint[0].x === domain.min && intersectionPoint[1].y === range.max) ||
399
+ (intersectionPoint[1].x === domain.min && intersectionPoint[0].y === range.max)
400
+ ) {
401
+ sections[0].push({ x: domain.min, y: range.max });
402
+ sections[1].push({ x: domain.max, y: range.max }, { x: domain.max, y: range.min }, { x: domain.min, y: range.min });
403
+ } else if (
404
+ (intersectionPoint[0].x === domain.min && intersectionPoint[1].y === range.min) ||
405
+ (intersectionPoint[1].x === domain.min && intersectionPoint[0].y === range.min)
406
+ ) {
407
+ sections[0].push({ x: domain.min, y: range.min });
408
+ sections[1].push({ x: domain.max, y: range.min }, { x: domain.max, y: range.max }, { x: domain.min, y: range.max });
409
+ } else if (
410
+ (intersectionPoint[0].x === domain.max && intersectionPoint[1].y === range.min) ||
411
+ (intersectionPoint[1].x === domain.max && intersectionPoint[0].y === range.min)
412
+ ) {
413
+ sections[0].push({ x: domain.max, y: range.min });
414
+ sections[1].push({ x: domain.min, y: range.min }, { x: domain.min, y: range.max }, { x: domain.max, y: range.max });
415
+ } else if (
416
+ (intersectionPoint[0].x === domain.min && intersectionPoint[1].x === domain.max) ||
417
+ (intersectionPoint[0].x === domain.max && intersectionPoint[1].x === domain.min)
418
+ ) {
419
+ sections[0].push({ x: domain.min, y: range.max }, { x: domain.max, y: range.max });
420
+ sections[1].push({ x: domain.min, y: range.min }, { x: domain.max, y: range.min });
421
+ } else if (
422
+ (intersectionPoint[0].y === range.min && intersectionPoint[1].y === range.max) ||
423
+ (intersectionPoint[0].y === range.max && intersectionPoint[1].y === range.min)
424
+ ) {
425
+ sections[0].push({ x: domain.min, y: range.min }, { x: domain.min, y: range.max });
426
+ sections[1].push({ x: domain.max, y: range.min }, { x: domain.max, y: range.max });
427
+ }
428
+ return removeDuplicateAndFilterSections(sections);
429
+ };
430
+
431
+ /*
432
+ * Function to find sections in solution set for two lines
433
+ * @param {Object} gssLineData - graphing solution set line data
434
+ * @param {Array} answers - answers array
435
+ * @param {Object} domain - domain object
436
+ * @param {Object} range - range object
437
+ * */
438
+ const findSectionsInSolutionSetForTwoLines = (gssLineData, answers, domain, range) => {
439
+ let mark1 = answers[0];
440
+ let mark2 = answers[1];
441
+ let cornerPoints = [
442
+ { x: domain.min, y: range.min },
443
+ { x: domain.min, y: range.max },
444
+ { x: domain.max, y: range.min },
445
+ { x: domain.max, y: range.max },
446
+ ];
447
+ let intersectPoint = lineIntersect(
448
+ mark1.from.x,
449
+ mark1.from.y,
450
+ mark1.to.x,
451
+ mark1.to.y,
452
+ mark2.from.x,
453
+ mark2.from.y,
454
+ mark2.to.x,
455
+ mark2.to.y,
456
+ );
457
+ let sections = [];
458
+ let intersectionPoint1 = findIntersectionPointForMark(mark1, domain, range);
459
+ intersectionPoint1 = removeDuplicatesFromArray(intersectionPoint1);
460
+ let intersectionPoint2 = findIntersectionPointForMark(mark2, domain, range);
461
+ intersectionPoint2 = removeDuplicatesFromArray(intersectionPoint2);
462
+ if (intersectPoint && isPointInsideGraph(intersectPoint, domain, range)) {
463
+ for (let i = 0; i < intersectionPoint1.length; i++) {
464
+ for (let j = 0; j < intersectionPoint2.length; j++) {
465
+ let bucket = [];
466
+ let newCornerPoints = [];
467
+ bucket.push(intersectPoint);
468
+ bucket.push(intersectionPoint1[i]);
469
+ bucket.push(intersectionPoint2[j]);
470
+ for (let k = 0; k < cornerPoints.length; k++) {
471
+ if (pointInAngle(intersectPoint, intersectionPoint1[i], intersectionPoint2[j], cornerPoints[k])) {
472
+ bucket.push(cornerPoints[k]);
473
+ } else {
474
+ newCornerPoints.push(cornerPoints[k]);
475
+ }
476
+ }
477
+ cornerPoints = newCornerPoints;
478
+ sections.push(bucket);
479
+ }
480
+ }
481
+ } else {
482
+ let sections1 = findSectionsInSolutionSetForOneLine(intersectionPoint1, domain, range);
483
+ let sections2 = findSectionsInSolutionSetForOneLine(intersectionPoint2, domain, range);
484
+ for (let i = 0; i < sections1.length; i++) {
485
+ if (
486
+ !(pointInPolygon(intersectionPoint2[0], sections1[i]) && pointInPolygon(intersectionPoint2[1], sections1[i]))
487
+ ) {
488
+ sections.push(sections1[i]);
489
+ }
490
+ }
491
+ for (let i = 0; i < sections2.length; i++) {
492
+ if (
493
+ !(pointInPolygon(intersectionPoint1[0], sections2[i]) && pointInPolygon(intersectionPoint1[1], sections2[i]))
494
+ ) {
495
+ sections.push(sections2[i]);
496
+ }
497
+ }
498
+ for (let i = 0; i < sections.length; i++) {
499
+ cornerPoints = cornerPoints.filter(function (o1) {
500
+ return !sections[i].some(function (o2) {
501
+ return o1.x === o2.x && o1.y === o2.y;
502
+ });
503
+ });
504
+ }
505
+ let sections3 = cornerPoints.concat(intersectionPoint1, intersectionPoint2);
506
+ sections.push(sections3);
507
+ }
508
+ return removeDuplicateAndFilterSections(sections);
509
+ };
510
+
511
+ /*
512
+ * Function to find sections in solution set
513
+ * @param {Object} gssLineData - graphing solution set line data
514
+ * @param {Array} answers - answers array
515
+ * @param {Object} domain - domain object
516
+ * @param {Object} range - range object
517
+ * */
518
+ export const findSectionsInSolutionSet = (gssLineData, answers, domain, range) => {
519
+ if (gssLineData.numberOfLines === 1) {
520
+ const intersectionPoint = findIntersectionPointForMark(answers[0], domain, range);
521
+ gssLineData.sections = findSectionsInSolutionSetForOneLine(intersectionPoint, domain, range);
522
+ } else {
523
+ gssLineData.sections = findSectionsInSolutionSetForTwoLines(gssLineData, answers, domain, range);
524
+ }
525
+ return gssLineData;
526
+ };
527
+
528
+ /*
529
+ * Function to check if a point is inside a polygon
530
+ * @param {Object} point - point to be checked
531
+ * @param {Array} polygon - polygon points array
532
+ * */
533
+ export const pointInsidePolygon = (point, polygon) => {
534
+ const num_vertices = polygon.length;
535
+ const x = point.x;
536
+ const y = point.y;
537
+ let inside = false;
538
+ let p1 = polygon[0];
539
+ let p2;
540
+ for (let i = 1; i <= num_vertices; i++) {
541
+ p2 = polygon[i % num_vertices];
542
+ if (y > Math.min(p1.y, p2.y)) {
543
+ if (y <= Math.max(p1.y, p2.y)) {
544
+ if (x <= Math.max(p1.x, p2.x)) {
545
+ const x_intersection = ((y - p1.y) * (p2.x - p1.x)) / (p2.y - p1.y) + p1.x;
546
+ if (p1.x === p2.x || x <= x_intersection) {
547
+ inside = !inside;
548
+ }
549
+ }
550
+ }
551
+ }
552
+ p1 = p2;
553
+ }
554
+ return inside;
555
+ };
556
+
557
+ /*
558
+ * Function to check if lines are added in the graph
559
+ * @param {Object} gssLineData - graphing solution set line data
560
+ * @param {Array} answer - answer array
561
+ * */
562
+ export const checkIfLinesAreAdded = (gssLineData, answer) => {
563
+ if (answer.length === 0) {
564
+ return false;
565
+ }
566
+ if (gssLineData.numberOfLines === 1) {
567
+ if (answer.length === 1) {
568
+ return !answer[0].building;
569
+ }
570
+ } else {
571
+ if (answer.length !== 2) {
572
+ return false;
573
+ } else {
574
+ return !answer[1].building;
575
+ }
576
+ }
577
+ };
@@ -0,0 +1,72 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * @synced-from pie-elements/packages/graphing-solution-set/controller/src/defaults.js
4
+ * @auto-generated
5
+ *
6
+ * This file is automatically synced from pie-elements and converted to TypeScript.
7
+ * Manual edits will be overwritten on next sync.
8
+ * To make changes, edit the upstream JavaScript file and run sync again.
9
+ */
10
+
11
+ /*
12
+ * This file contains the default configuration for the Graphing Solution Set Item Type.
13
+ * Model is similar to the one used in graphing item type except for the gssLineData object which handles
14
+ * the configuration for the lines and the solution set.
15
+ *
16
+ * Same model is used in configure/src default.js
17
+ * */
18
+ export default {
19
+ answers: {
20
+ correctAnswer: {
21
+ name: 'Correct Answer',
22
+ marks: [],
23
+ },
24
+ },
25
+ arrows: {
26
+ left: true,
27
+ right: true,
28
+ up: true,
29
+ down: true,
30
+ },
31
+ marks: [],
32
+ defaultGridConfiguration: 0,
33
+ domain: {
34
+ min: -5,
35
+ max: 5,
36
+ step: 1,
37
+ labelStep: 1,
38
+ axisLabel: 'x',
39
+ },
40
+ graph: {
41
+ width: 500,
42
+ height: 500,
43
+ },
44
+ gssLineData: {
45
+ numberOfLines: 1,
46
+ selectedTool: 'lineA',
47
+ sections: [],
48
+ lineA: {
49
+ lineType: 'Solid',
50
+ },
51
+ },
52
+ includeAxes: true,
53
+ labels: {},
54
+ labelsEnabled: true,
55
+ padding: true,
56
+ prompt: '',
57
+ range: {
58
+ min: -5,
59
+ max: 5,
60
+ step: 1,
61
+ labelStep: 1,
62
+ axisLabel: 'y',
63
+ },
64
+ rationale: '',
65
+ standardGrid: false,
66
+ title: '',
67
+ coordinatesOnHover: false,
68
+ promptEnabled: true,
69
+ rationaleEnabled: true,
70
+ teacherInstructionsEnabled: true,
71
+ studentInstructionsEnabled: true,
72
+ };