math-exercises 3.0.30 → 3.0.32

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 (189) hide show
  1. package/lib/exercises/math/calcul/arithmetics/euclideanDivision.js +2 -2
  2. package/lib/exercises/math/calcul/fractions/fractionsProduct.d.ts.map +1 -1
  3. package/lib/exercises/math/calcul/fractions/fractionsProduct.js +1 -3
  4. package/lib/exercises/math/calcul/fractions/fractionsSubstraction.js +2 -2
  5. package/lib/exercises/math/calcul/fractions/fractionsSumsPrimeDenominators.js +1 -1
  6. package/lib/exercises/math/calcul/fractions/fractionsSumsSameDenominators.js +1 -1
  7. package/lib/exercises/math/calcul/fractions/periodicWritingToFraction.js +1 -1
  8. package/lib/exercises/math/calcul/fractions/simplifyFraction.d.ts.map +1 -1
  9. package/lib/exercises/math/calcul/fractions/simplifyFraction.js +19 -10
  10. package/lib/exercises/math/calculLitteral/distributivity/allIdentities.js +3 -3
  11. package/lib/exercises/math/calculLitteral/distributivity/doubleDistri.d.ts +8 -0
  12. package/lib/exercises/math/calculLitteral/distributivity/doubleDistri.d.ts.map +1 -0
  13. package/lib/exercises/math/calculLitteral/distributivity/doubleDistri.js +155 -0
  14. package/lib/exercises/math/calculLitteral/distributivity/idRmq1.d.ts +11 -0
  15. package/lib/exercises/math/calculLitteral/distributivity/idRmq1.d.ts.map +1 -0
  16. package/lib/exercises/math/calculLitteral/distributivity/idRmq1.js +147 -0
  17. package/lib/exercises/math/calculLitteral/distributivity/idRmq2.d.ts +11 -0
  18. package/lib/exercises/math/calculLitteral/distributivity/idRmq2.d.ts.map +1 -0
  19. package/lib/exercises/math/calculLitteral/distributivity/idRmq2.js +150 -0
  20. package/lib/exercises/math/calculLitteral/distributivity/idRmq3.d.ts +11 -0
  21. package/lib/exercises/math/calculLitteral/distributivity/idRmq3.d.ts.map +1 -0
  22. package/lib/exercises/math/calculLitteral/distributivity/idRmq3.js +143 -0
  23. package/lib/exercises/math/calculLitteral/distributivity/index.d.ts +4 -4
  24. package/lib/exercises/math/calculLitteral/distributivity/index.d.ts.map +1 -1
  25. package/lib/exercises/math/calculLitteral/distributivity/index.js +4 -4
  26. package/lib/exercises/math/calculLitteral/distributivity/simpleDistriXCoeff.d.ts.map +1 -1
  27. package/lib/exercises/math/calculLitteral/distributivity/simpleDistriXCoeff.js +1 -0
  28. package/lib/exercises/math/calculLitteral/equation/equa1.d.ts +11 -0
  29. package/lib/exercises/math/calculLitteral/equation/equa1.d.ts.map +1 -0
  30. package/lib/exercises/math/calculLitteral/equation/equa1.js +111 -0
  31. package/lib/exercises/math/calculLitteral/equation/equa2.d.ts +17 -0
  32. package/lib/exercises/math/calculLitteral/equation/equa2.d.ts.map +1 -0
  33. package/lib/exercises/math/calculLitteral/equation/equa2.js +164 -0
  34. package/lib/exercises/math/calculLitteral/equation/equa3.d.ts +12 -0
  35. package/lib/exercises/math/calculLitteral/equation/equa3.d.ts.map +1 -0
  36. package/lib/exercises/math/calculLitteral/equation/equa3.js +113 -0
  37. package/lib/exercises/math/calculLitteral/equation/equa4.d.ts +13 -0
  38. package/lib/exercises/math/calculLitteral/equation/equa4.d.ts.map +1 -0
  39. package/lib/exercises/math/calculLitteral/equation/equa4.js +106 -0
  40. package/lib/exercises/math/calculLitteral/equation/index.d.ts +4 -4
  41. package/lib/exercises/math/calculLitteral/equation/index.d.ts.map +1 -1
  42. package/lib/exercises/math/calculLitteral/equation/index.js +4 -4
  43. package/lib/exercises/math/derivation/derivative/expDerivativeOne.d.ts.map +1 -1
  44. package/lib/exercises/math/derivation/derivative/expDerivativeOne.js +0 -6
  45. package/lib/exercises/math/derivation/derivative/powerFunctionDerivative.d.ts.map +1 -1
  46. package/lib/exercises/math/derivation/derivative/powerFunctionDerivative.js +30 -0
  47. package/lib/exercises/math/functions/affines/leadingCoefficient.d.ts.map +1 -1
  48. package/lib/exercises/math/functions/affines/leadingCoefficient.js +26 -11
  49. package/lib/exercises/math/functions/basics/inverseImageFunctionGeogebra.d.ts.map +1 -1
  50. package/lib/exercises/math/functions/logarithm/logSimplifiying.js +1 -1
  51. package/lib/exercises/math/functions/sign/affineProductSign.d.ts.map +1 -1
  52. package/lib/exercises/math/functions/sign/affineProductSign.js +3 -0
  53. package/lib/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationByFactorisation.d.ts.map +1 -1
  54. package/lib/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationByFactorisation.js +64 -72
  55. package/lib/exercises/math/functions/trinoms/parabole/paraboleExpressionReading.d.ts.map +1 -1
  56. package/lib/exercises/math/functions/trinoms/parabole/paraboleExpressionReading.js +1 -1
  57. package/lib/exercises/math/functions/trinoms/roots/rootsFromFactorizedForm.d.ts.map +1 -1
  58. package/lib/exercises/math/functions/trinoms/roots/rootsFromFactorizedForm.js +31 -14
  59. package/lib/exercises/math/functions/trinoms/roots/rootsReading.d.ts.map +1 -1
  60. package/lib/exercises/math/functions/trinoms/roots/rootsReading.js +1 -2
  61. package/lib/exercises/math/functions/trinoms/sign/trinomSignFromFacto.d.ts.map +1 -1
  62. package/lib/exercises/math/functions/trinoms/sign/trinomSignFromFacto.js +3 -0
  63. package/lib/exercises/math/functions/trinoms/sign/trinomSignFromRoots.d.ts.map +1 -1
  64. package/lib/exercises/math/functions/trinoms/sign/trinomSignFromRoots.js +3 -0
  65. package/lib/exercises/math/geometry/areas/rightTriangleArea.d.ts +1 -1
  66. package/lib/exercises/math/geometry/areas/rightTriangleArea.d.ts.map +1 -1
  67. package/lib/exercises/math/geometry/areas/rightTriangleArea.js +1 -1
  68. package/lib/exercises/math/geometry/areas/triangleArea.d.ts +1 -1
  69. package/lib/exercises/math/geometry/areas/triangleArea.d.ts.map +1 -1
  70. package/lib/exercises/math/geometry/areas/triangleArea.js +1 -1
  71. package/lib/exercises/math/geometry/cartesian/midpoint.d.ts.map +1 -1
  72. package/lib/exercises/math/geometry/cartesian/midpoint.js +19 -6
  73. package/lib/exercises/math/geometry/cartesian/pointCoordinates.d.ts.map +1 -1
  74. package/lib/exercises/math/geometry/cartesian/pointCoordinatesNoAxisNumbers.d.ts.map +1 -1
  75. package/lib/exercises/math/geometry/cartesian/pointCoordinatesNoOrthonorm.d.ts.map +1 -1
  76. package/lib/exercises/math/geometry/euclidian/pythagoreOrThales.js +2 -2
  77. package/lib/exercises/math/geometry/index.d.ts +1 -0
  78. package/lib/exercises/math/geometry/index.d.ts.map +1 -1
  79. package/lib/exercises/math/geometry/index.js +1 -1
  80. package/lib/exercises/math/geometry/pythagore/pythagore.d.ts +1 -1
  81. package/lib/exercises/math/geometry/pythagore/pythagore.d.ts.map +1 -1
  82. package/lib/exercises/math/geometry/pythagore/pythagore.js +1 -1
  83. package/lib/exercises/math/geometry/pythagore/pythagoreCalcul.d.ts +1 -1
  84. package/lib/exercises/math/geometry/pythagore/pythagoreCalcul.d.ts.map +1 -1
  85. package/lib/exercises/math/geometry/pythagore/pythagoreCalcul.js +1 -1
  86. package/lib/exercises/math/geometry/quadrilaterals/quadrilateralRecognition.d.ts +4 -4
  87. package/lib/exercises/math/geometry/quadrilaterals/quadrilateralRecognition.d.ts.map +1 -1
  88. package/lib/exercises/math/geometry/quadrilaterals/quadrilateralRecognition.js +4 -4
  89. package/lib/exercises/math/geometry/thales/thales.d.ts +1 -1
  90. package/lib/exercises/math/geometry/thales/thales.d.ts.map +1 -1
  91. package/lib/exercises/math/geometry/thales/thales.js +1 -1
  92. package/lib/exercises/math/geometry/thales/thalesCalcul.d.ts +1 -1
  93. package/lib/exercises/math/geometry/thales/thalesCalcul.d.ts.map +1 -1
  94. package/lib/exercises/math/geometry/thales/thalesCalcul.js +1 -1
  95. package/lib/exercises/math/geometry/triangles/index.d.ts +1 -1
  96. package/lib/exercises/math/geometry/triangles/index.d.ts.map +1 -1
  97. package/lib/exercises/math/geometry/triangles/index.js +2 -1
  98. package/lib/exercises/math/geometry/triangles/triangleNature.d.ts +9 -0
  99. package/lib/exercises/math/geometry/triangles/triangleNature.d.ts.map +1 -0
  100. package/lib/exercises/math/geometry/triangles/triangleNature.js +121 -0
  101. package/lib/exercises/math/geometry/triangles/triangleThirdAngleValue.d.ts +9 -0
  102. package/lib/exercises/math/geometry/triangles/triangleThirdAngleValue.d.ts.map +1 -0
  103. package/lib/exercises/math/geometry/triangles/triangleThirdAngleValue.js +134 -0
  104. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductViaNorms.d.ts +1 -1
  105. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductViaNorms.d.ts.map +1 -1
  106. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductViaNorms.js +1 -1
  107. package/lib/exercises/math/percent/percentToDecimal.js +2 -2
  108. package/lib/exercises/math/probaStat/ballsBasicProbas.d.ts.map +1 -1
  109. package/lib/exercises/math/probaStat/ballsBasicProbas.js +29 -16
  110. package/lib/exercises/math/probaStat/cardBasicProbas.d.ts.map +1 -1
  111. package/lib/exercises/math/probaStat/cardBasicProbas.js +44 -32
  112. package/lib/exercises/math/probaStat/stats1var/median.js +2 -2
  113. package/lib/exercises/math/probaStat/stats1var/medianList.d.ts.map +1 -1
  114. package/lib/exercises/math/probaStat/stats1var/medianList.js +28 -12
  115. package/lib/exercises/math/squareRoots/simpifySquareRoot.js +1 -1
  116. package/lib/exercises/math/squareRoots/squareRootsProducts.js +1 -1
  117. package/lib/exercises/math/trigonometry/trigonometry.d.ts +1 -1
  118. package/lib/exercises/math/trigonometry/trigonometry.d.ts.map +1 -1
  119. package/lib/exercises/math/trigonometry/trigonometry.js +1 -1
  120. package/lib/exercises/math/trigonometry/trigonometryAngleCalcul.d.ts +1 -1
  121. package/lib/exercises/math/trigonometry/trigonometryAngleCalcul.d.ts.map +1 -1
  122. package/lib/exercises/math/trigonometry/trigonometryAngleCalcul.js +1 -1
  123. package/lib/exercises/math/trigonometry/trigonometrySideCalcul.d.ts +1 -1
  124. package/lib/exercises/math/trigonometry/trigonometrySideCalcul.d.ts.map +1 -1
  125. package/lib/exercises/math/trigonometry/trigonometrySideCalcul.js +2 -2
  126. package/lib/exercises/pc/index.d.ts +4 -4
  127. package/lib/exercises/pc/index.d.ts.map +1 -1
  128. package/lib/exercises/pc/index.js +4 -4
  129. package/lib/index.d.ts +18 -15
  130. package/lib/index.d.ts.map +1 -1
  131. package/lib/math/geometry/angle.d.ts +6 -0
  132. package/lib/math/geometry/angle.d.ts.map +1 -1
  133. package/lib/math/geometry/angle.js +20 -7
  134. package/lib/math/geometry/quadrilaterals/parallelogram.d.ts +23 -0
  135. package/lib/math/geometry/quadrilaterals/parallelogram.d.ts.map +1 -0
  136. package/lib/math/geometry/quadrilaterals/parallelogram.js +65 -0
  137. package/lib/math/geometry/quadrilaterals/quadrilateral.d.ts +15 -0
  138. package/lib/math/geometry/quadrilaterals/quadrilateral.d.ts.map +1 -0
  139. package/lib/math/geometry/quadrilaterals/quadrilateral.js +38 -0
  140. package/lib/math/geometry/quadrilaterals/rectangle.d.ts +24 -0
  141. package/lib/math/geometry/quadrilaterals/rectangle.d.ts.map +1 -0
  142. package/lib/math/geometry/quadrilaterals/rectangle.js +59 -0
  143. package/lib/math/geometry/quadrilaterals/rhombus.d.ts +19 -0
  144. package/lib/math/geometry/quadrilaterals/rhombus.d.ts.map +1 -0
  145. package/lib/math/geometry/quadrilaterals/rhombus.js +41 -0
  146. package/lib/math/geometry/quadrilaterals/square.d.ts +22 -0
  147. package/lib/math/geometry/quadrilaterals/square.d.ts.map +1 -0
  148. package/lib/math/geometry/quadrilaterals/square.js +38 -0
  149. package/lib/math/geometry/triangles/equilateralTriangle.d.ts +21 -0
  150. package/lib/math/geometry/triangles/equilateralTriangle.d.ts.map +1 -0
  151. package/lib/math/geometry/triangles/equilateralTriangle.js +52 -0
  152. package/lib/math/geometry/triangles/isoceleTriangle.d.ts +23 -0
  153. package/lib/math/geometry/triangles/isoceleTriangle.d.ts.map +1 -0
  154. package/lib/math/geometry/triangles/isoceleTriangle.js +66 -0
  155. package/lib/math/geometry/triangles/rightTriangle.d.ts +31 -0
  156. package/lib/math/geometry/triangles/rightTriangle.d.ts.map +1 -0
  157. package/lib/math/geometry/triangles/rightTriangle.js +108 -0
  158. package/lib/math/geometry/triangles/triangle.d.ts +68 -0
  159. package/lib/math/geometry/triangles/triangle.d.ts.map +1 -0
  160. package/lib/math/geometry/triangles/triangle.js +240 -0
  161. package/lib/math/geometry/vector.d.ts.map +1 -1
  162. package/lib/math/geometry/vector.js +0 -11
  163. package/lib/math/polynomials/trinom.d.ts +1 -1
  164. package/lib/math/polynomials/trinom.d.ts.map +1 -1
  165. package/lib/math/polynomials/trinom.js +7 -17
  166. package/lib/tree/nodes/complex/complexNode.d.ts +9 -3
  167. package/lib/tree/nodes/complex/complexNode.d.ts.map +1 -1
  168. package/lib/tree/nodes/complex/complexNode.js +18 -1
  169. package/lib/tree/nodes/equations/equalNode.d.ts.map +1 -1
  170. package/lib/tree/nodes/node.d.ts +2 -1
  171. package/lib/tree/nodes/node.d.ts.map +1 -1
  172. package/lib/tree/nodes/node.js +1 -0
  173. package/lib/tree/nodes/sets/belongsNode.d.ts +0 -1
  174. package/lib/tree/nodes/sets/belongsNode.d.ts.map +1 -1
  175. package/lib/tree/nodes/sets/belongsNode.js +0 -3
  176. package/lib/tree/nodes/sets/discreteSetNode.d.ts +8 -2
  177. package/lib/tree/nodes/sets/discreteSetNode.d.ts.map +1 -1
  178. package/lib/tree/nodes/sets/discreteSetNode.js +20 -2
  179. package/lib/tree/nodes/sets/intervalNode.d.ts +6 -2
  180. package/lib/tree/nodes/sets/intervalNode.d.ts.map +1 -1
  181. package/lib/tree/nodes/sets/intervalNode.js +15 -1
  182. package/lib/tree/nodes/sets/setNode.d.ts +3 -1
  183. package/lib/tree/nodes/sets/setNode.d.ts.map +1 -1
  184. package/lib/tree/nodes/sets/unionIntervalNode.d.ts +8 -2
  185. package/lib/tree/nodes/sets/unionIntervalNode.d.ts.map +1 -1
  186. package/lib/tree/nodes/sets/unionIntervalNode.js +16 -0
  187. package/lib/tree/parsers/discreteSetParser.d.ts.map +1 -1
  188. package/lib/tree/parsers/discreteSetParser.js +0 -2
  189. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"angle.d.ts","sourceRoot":"","sources":["../../../src/math/geometry/angle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAMlE,OAAO,EAAE,KAAK,EAAoB,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACvE,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAK7C,8BAAsB,gBAAgB;IACpC,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,gBAAgB;CAUrD;AACD,KAAK,UAAU,GAAG;IAChB,eAAe,CAAC,EAAE,aAAa,CAAC;IAChC,eAAe,CAAC,EAAE,aAAa,CAAC;CACjC,CAAC;AAEF,KAAK,qBAAqB,GAAG;IAC3B,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC,CAAC;AACF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,KAAK,CAAC,EAAE,qBAAqB,CAAC;CAC/B,CAAC;AACF,qBAAa,KAAK;IAChB,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,eAAe,CAAC,EAAE,aAAa,CAAC;IAChC,eAAe,CAAC,EAAE,aAAa,CAAC;IAChC,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB;;;OAGG;gBACS,MAAM,EAAE,KAAK,EAAE,EAAE,KAAK,CAAC,EAAE,UAAU;IAkB/C,aAAa,IAAI,gBAAgB;IASjC,WAAW,CAAC,CAAC,EAAE,KAAK;IAIpB,MAAM,CAAC,CAAC,EAAE,KAAK;IAqBf,SAAS,CAAC,CAAC,EAAE,KAAK;IASlB,gBAAgB,CAAC,CAAC,EAAE,KAAK;IAwCzB,MAAM;IAMN,eAAe,CAAC,CAAC,EAAE,KAAK;IAsCxB,gBAAgB,CAAC,CAAC,EAAE,KAAK;IAoBzB,QAAQ,CAAC,QAAQ,UAAQ;IAiBzB,YAAY,CAAC,QAAQ,UAAQ;IAW7B,OAAO;IAIP,KAAK;IAGL,UAAU,CAAC,IAAI,CAAC,EAAE;QAChB,iBAAiB,CAAC,EAAE,OAAO,CAAC;QAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,SAAS,CAAC,EAAE,OAAO,CAAC;QACpB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB;CA0BF"}
1
+ {"version":3,"file":"angle.d.ts","sourceRoot":"","sources":["../../../src/math/geometry/angle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAMlE,OAAO,EAAE,KAAK,EAAoB,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACvE,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAK7C,8BAAsB,gBAAgB;IACpC,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,gBAAgB;CAUrD;AACD,KAAK,UAAU,GAAG;IAChB,eAAe,CAAC,EAAE,aAAa,CAAC;IAChC,eAAe,CAAC,EAAE,aAAa,CAAC;CACjC,CAAC;AAEF,KAAK,qBAAqB,GAAG;IAC3B,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC,CAAC;AACF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,KAAK,CAAC,EAAE,qBAAqB,CAAC;CAC/B,CAAC;AACF,qBAAa,KAAK;IAChB,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,eAAe,CAAC,EAAE,aAAa,CAAC;IAChC,eAAe,CAAC,EAAE,aAAa,CAAC;IAChC,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;gBACS,MAAM,EAAE,KAAK,EAAE,EAAE,KAAK,CAAC,EAAE,UAAU;IAmB/C,aAAa,IAAI,gBAAgB;IASjC,WAAW,CAAC,CAAC,EAAE,KAAK;IAIpB,MAAM,CAAC,CAAC,EAAE,KAAK;IAqBf,SAAS,CAAC,CAAC,EAAE,KAAK;IASlB,gBAAgB,CAAC,CAAC,EAAE,KAAK;IAwCzB,MAAM;IAMN,eAAe,CAAC,CAAC,EAAE,KAAK;IAsCxB,gBAAgB,CAAC,CAAC,EAAE,KAAK;IAoBzB,QAAQ,CAAC,QAAQ,UAAQ;IAiBzB,YAAY,CAAC,QAAQ,UAAQ;IAW7B,OAAO;IAIP,KAAK;IAIL,qBAAqB,CAAC,EACpB,IAAI,EACJ,KAAK,EACL,IAAI,GACL,GAAE;QACD,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,YAAY,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;KAC7C;IAgBN,UAAU,CAAC,IAAI,CAAC,EAAE;QAChB,iBAAiB,CAAC,EAAE,OAAO,CAAC;QAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,SAAS,CAAC,EAAE,OAAO,CAAC;QACpB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB;CA2BF"}
@@ -23,6 +23,7 @@ export class Angle {
23
23
  radianValueNode;
24
24
  degreeValueNode;
25
25
  props;
26
+ name;
26
27
  /**
27
28
  *
28
29
  * @param points [pointA, pointB, pointC] with apex = B
@@ -38,6 +39,7 @@ export class Angle {
38
39
  if (props?.degreeValueNode && !props.radianValueNode) {
39
40
  this.radianValueNode = frac(multiply(props.degreeValueNode, PiNode), (180).toTree());
40
41
  }
42
+ this.name = `angle${this.points[0].name}${this.points[1].name}${this.points[2].name}`;
41
43
  }
42
44
  toIdentifiers() {
43
45
  return {
@@ -194,22 +196,33 @@ export class Angle {
194
196
  toTex() {
195
197
  return `\\widehat{${this.points[0].name}${this.points[1].name}${this.points[2].name}}`;
196
198
  }
199
+ getFitCaptionCommands({ text, color, size, } = {}) {
200
+ const txt = text ?? this.getValueNode(true).toTex();
201
+ // const point = this.getMidpoint().toMathString();
202
+ const cmds = [
203
+ `text_{${this.name}} = Text("${size ? `\\${size}` : ""} ${txt}°", ${this.points[1].name}+2*UnitVector(AngleBisector(${this.points[2].name},${this.points[1].name},${this.points[0].name})), true, true, 0, 0)`,
204
+ // `SetBackgroundColor(text_{${this.name}}, "white")`,
205
+ ];
206
+ if (color) {
207
+ cmds.push(`SetColor(text_{${this.name}}, "${color}")`);
208
+ }
209
+ return cmds;
210
+ }
197
211
  toCommands(opts) {
198
- const name = `angle_{${this.points[0].name}${this.points[1].name}${this.points[2].name}}`;
199
212
  const cmds = [];
200
213
  if (opts?.pointsAreNotBuilt) {
201
- cmds.push(`${name} = Angle(${this.points[0].toMathString()},${this.points[1].toMathString()},${this.points[2].toMathString()}, xAxis)`);
214
+ cmds.push(`${this.name} = Angle(${this.points[0].toMathString()},${this.points[1].toMathString()},${this.points[2].toMathString()}, xAxis)`);
202
215
  }
203
216
  else {
204
- cmds.push(`${name} = Angle(${this.points[0].name},${this.points[1].name},${this.points[2].name}, xAxis)`);
217
+ cmds.push(`${this.name} = Angle(${this.points[0].name},${this.points[1].name},${this.points[2].name}, xAxis)`);
205
218
  }
206
- cmds.push(`ShowLabel(${name}, ${opts?.showValue ? "true" : "false"})`);
207
- cmds.push(`SetCaption(${name}, "$\\footnotesize ${round(this.evaluate(), 1).frenchify() + "°"}$")`);
219
+ cmds.push(`ShowLabel(${this.name}, ${opts?.showValue ? "true" : "false"})`);
220
+ cmds.push(`SetCaption(${this.name}, "$\\footnotesize ${round(this.evaluate(), 1).frenchify() + "°"}$")`);
208
221
  if (opts?.color) {
209
- cmds.push(`SetColor(${name}, "${opts.color}")`);
222
+ cmds.push(`SetColor(${this.name}, "${opts.color}")`);
210
223
  }
211
224
  if (opts?.thickness !== undefined) {
212
- cmds.push(`SetLineThickness(${name}, ${opts?.thickness})`);
225
+ cmds.push(`SetLineThickness(${this.name}, ${opts?.thickness})`);
213
226
  }
214
227
  return cmds;
215
228
  }
@@ -0,0 +1,23 @@
1
+ import { Point, PointIdentifiers } from "../point.js";
2
+ import { Quadrilateral } from "./quadrilateral.js";
3
+ export declare abstract class ParallelogramConstructor {
4
+ static random(): Parallelogram;
5
+ static fromIdentifiers(identifiers: ParallelogramIdentifiers): Parallelogram;
6
+ }
7
+ export type ParallelogramIdentifiers = {
8
+ points: PointIdentifiers[];
9
+ };
10
+ export declare class Parallelogram extends Quadrilateral {
11
+ constructor(points: Point[]);
12
+ toIdentifiers(): ParallelogramIdentifiers;
13
+ drawDiagonals({ drawCenter, drawDecorations, isRectangle, isRhombus, }: {
14
+ drawCenter: boolean;
15
+ drawDecorations: boolean;
16
+ isRectangle?: boolean;
17
+ isRhombus?: boolean;
18
+ }): void;
19
+ drawSidesDecoration({ isRhombus }: {
20
+ isRhombus?: boolean;
21
+ }): void;
22
+ }
23
+ //# sourceMappingURL=parallelogram.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parallelogram.d.ts","sourceRoot":"","sources":["../../../../src/math/geometry/quadrilaterals/parallelogram.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAoB,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,8BAAsB,wBAAwB;IAC5C,MAAM,CAAC,MAAM;IA2Bb,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,wBAAwB;CAO7D;AAED,MAAM,MAAM,wBAAwB,GAAG;IACrC,MAAM,EAAE,gBAAgB,EAAE,CAAC;CAC5B,CAAC;AAEF,qBAAa,aAAc,SAAQ,aAAa;gBAClC,MAAM,EAAE,KAAK,EAAE;IAG3B,aAAa,IAAI,wBAAwB;IAKzC,aAAa,CAAC,EACZ,UAAU,EACV,eAAe,EACf,WAAW,EACX,SAAS,GACV,EAAE;QACD,UAAU,EAAE,OAAO,CAAC;QACpB,eAAe,EAAE,OAAO,CAAC;QACzB,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB,SAAS,CAAC,EAAE,OAAO,CAAC;KACrB,GAAG,IAAI;IA6BR,mBAAmB,CAAC,EAAE,SAAS,EAAE,EAAE;QAAE,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI;CAclE"}
@@ -0,0 +1,65 @@
1
+ import { randfloat } from "../../../math/utils/random/randfloat.js";
2
+ import { Point, PointConstructor } from "../point.js";
3
+ import { Quadrilateral } from "./quadrilateral.js";
4
+ export class ParallelogramConstructor {
5
+ static random() {
6
+ const angle = randfloat(0, Math.PI / 2);
7
+ const additionalAngle = randfloat(Math.PI / 4, (3 * Math.PI) / 4);
8
+ const xRand = randfloat(5, 8);
9
+ const xRand2 = randfloat(3, 8);
10
+ const origin = new Point("O", (0).toTree(), (0).toTree());
11
+ const A = new Point("A", (-xRand).toTree(), (0).toTree()).rotate(angle, origin);
12
+ const C = new Point("C", xRand.toTree(), (0).toTree()).rotate(angle, origin);
13
+ const yRand = randfloat(3, 6);
14
+ const B = new Point("B", (-xRand2).toTree(), (0).toTree()).rotate(angle + additionalAngle, origin);
15
+ const D = new Point("D", xRand2.toTree(), (0).toTree()).rotate(angle + additionalAngle, origin);
16
+ return new Parallelogram([A, B, C, D]);
17
+ }
18
+ static fromIdentifiers(identifiers) {
19
+ return new Parallelogram(identifiers.points.map((point) => PointConstructor.fromIdentifiers(point)));
20
+ }
21
+ }
22
+ export class Parallelogram extends Quadrilateral {
23
+ constructor(points) {
24
+ super(points);
25
+ }
26
+ toIdentifiers() {
27
+ return {
28
+ points: this.points.map((point) => point.toIdentifiers()),
29
+ };
30
+ }
31
+ drawDiagonals({ drawCenter, drawDecorations, isRectangle, isRhombus, }) {
32
+ super.drawDiagonals({ drawCenter, drawDecorations });
33
+ if (drawDecorations) {
34
+ this.commands.push(`midDiago1 = Segment(${this.points[0].name}, diagoCenter)`);
35
+ this.commands.push(`midDiago2 = Segment(${this.points[2].name}, diagoCenter)`);
36
+ this.commands.push(`midDiago3 = Segment(${this.points[1].name}, diagoCenter)`);
37
+ this.commands.push(`midDiago4 = Segment(${this.points[3].name}, diagoCenter)`);
38
+ const secondDeco = isRectangle ? 2 : 3;
39
+ this.commands.push(`SetDecoration(midDiago1, 2)`);
40
+ this.commands.push(`SetDecoration(midDiago2, 2)`);
41
+ this.commands.push(`SetDecoration(midDiago3, ${secondDeco})`);
42
+ this.commands.push(`SetDecoration(midDiago4, ${secondDeco})`);
43
+ }
44
+ isRhombus &&
45
+ this.commands.push(...[
46
+ `centerAngle = Angle(${this.points[0].name}, diagoCenter, ${this.points[1].name}, xAxis)`,
47
+ `ShowLabel(centerAngle, false)`,
48
+ ]);
49
+ }
50
+ drawSidesDecoration({ isRhombus }) {
51
+ if (isRhombus) {
52
+ this.sides.forEach((side, index) => {
53
+ this.commands.push(`SetDecoration(${side.ggbName}, 2)`);
54
+ });
55
+ }
56
+ else {
57
+ this.sides.forEach((side, index) => {
58
+ if (index % 2 === 0)
59
+ this.commands.push(`SetDecoration(${side.ggbName}, 2)`);
60
+ if (index % 2 !== 0)
61
+ this.commands.push(`SetDecoration(${side.ggbName}, 3)`);
62
+ });
63
+ }
64
+ }
65
+ }
@@ -0,0 +1,15 @@
1
+ import { Point } from "../point.js";
2
+ import { Segment } from "../segment.js";
3
+ export declare class Quadrilateral {
4
+ commands: string[];
5
+ points: Point[];
6
+ sides: Segment[];
7
+ name: string;
8
+ constructor(points: Point[]);
9
+ drawDiagonals({ drawCenter, drawDecorations, }: {
10
+ drawCenter: boolean;
11
+ drawDecorations: boolean;
12
+ }): void;
13
+ toGGBCommands(): string[];
14
+ }
15
+ //# sourceMappingURL=quadrilateral.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quadrilateral.d.ts","sourceRoot":"","sources":["../../../../src/math/geometry/quadrilaterals/quadrilateral.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,qBAAa,aAAa;IACxB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,KAAK,EAAE,OAAO,EAAE,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;gBACD,MAAM,EAAE,KAAK,EAAE;IAuB3B,aAAa,CAAC,EACZ,UAAkB,EAClB,eAAuB,GACxB,EAAE;QACD,UAAU,EAAE,OAAO,CAAC;QACpB,eAAe,EAAE,OAAO,CAAC;KAC1B;IAcD,aAAa;CAGd"}
@@ -0,0 +1,38 @@
1
+ import { Segment } from "../segment.js";
2
+ export class Quadrilateral {
3
+ commands;
4
+ points;
5
+ sides;
6
+ name;
7
+ constructor(points) {
8
+ if (points.length !== 4)
9
+ throw new Error("Quadrilateral must have 4 points");
10
+ this.name = points.map((p) => p.name).join("");
11
+ this.points = points;
12
+ this.sides = [
13
+ new Segment(points[0], points[1]),
14
+ new Segment(points[1], points[2]),
15
+ new Segment(points[2], points[3]),
16
+ new Segment(points[3], points[0]),
17
+ ];
18
+ this.commands = [
19
+ ...points.flatMap((p) => p.toGGBCommand({
20
+ isFixed: true,
21
+ showLabel: true,
22
+ })),
23
+ ...this.sides.flatMap((s) => s.toGGBCommands(false)),
24
+ ];
25
+ }
26
+ drawDiagonals({ drawCenter = false, drawDecorations = false, }) {
27
+ const res = [];
28
+ res.push(`diago1 = Segment(${this.points[0].name}, ${this.points[2].name})`);
29
+ res.push(`diago2 = Segment(${this.points[1].name}, ${this.points[3].name})`);
30
+ if (drawCenter) {
31
+ res.push(`diagoCenter = Intersect(diago1, diago2)`);
32
+ }
33
+ this.commands.push(...res);
34
+ }
35
+ toGGBCommands() {
36
+ return this.commands;
37
+ }
38
+ }
@@ -0,0 +1,24 @@
1
+ import { Point, PointIdentifiers } from "../point.js";
2
+ import { Parallelogram } from "./parallelogram.js";
3
+ export declare abstract class RectangleConstructor {
4
+ static random(): Rectangle;
5
+ static fromIdentifiers(identifiers: RectangleIdentifiers): Rectangle;
6
+ }
7
+ export type RectangleIdentifiers = {
8
+ points: PointIdentifiers[];
9
+ };
10
+ export declare class Rectangle extends Parallelogram {
11
+ constructor(points: Point[]);
12
+ toIdentifiers(): RectangleIdentifiers;
13
+ drawDiagonals({ drawCenter, drawDecorations, isRhombus, }: {
14
+ drawCenter: boolean;
15
+ drawDecorations: boolean;
16
+ isRhombus?: boolean;
17
+ }): void;
18
+ drawSidesDecoration({ drawAngles, drawSidesLengths, isRhombus, }: {
19
+ drawAngles: boolean;
20
+ drawSidesLengths: boolean;
21
+ isRhombus?: boolean;
22
+ }): void;
23
+ }
24
+ //# sourceMappingURL=rectangle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rectangle.d.ts","sourceRoot":"","sources":["../../../../src/math/geometry/quadrilaterals/rectangle.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAoB,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,8BAAsB,oBAAoB;IACxC,MAAM,CAAC,MAAM;IAyBb,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,oBAAoB;CAOzD;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,EAAE,gBAAgB,EAAE,CAAC;CAC5B,CAAC;AACF,qBAAa,SAAU,SAAQ,aAAa;gBAC9B,MAAM,EAAE,KAAK,EAAE;IAG3B,aAAa,IAAI,oBAAoB;IAKrC,aAAa,CAAC,EACZ,UAAU,EACV,eAAe,EACf,SAAS,GACV,EAAE;QACD,UAAU,EAAE,OAAO,CAAC;QACpB,eAAe,EAAE,OAAO,CAAC;QACzB,SAAS,CAAC,EAAE,OAAO,CAAC;KACrB,GAAG,IAAI;IASR,mBAAmB,CAAC,EAClB,UAAU,EACV,gBAAgB,EAChB,SAAS,GACV,EAAE;QACD,UAAU,EAAE,OAAO,CAAC;QACpB,gBAAgB,EAAE,OAAO,CAAC;QAC1B,SAAS,CAAC,EAAE,OAAO,CAAC;KACrB,GAAG,IAAI;CA2BT"}
@@ -0,0 +1,59 @@
1
+ import { randfloat } from "../../../math/utils/random/randfloat.js";
2
+ import { Point, PointConstructor } from "../point.js";
3
+ import { Parallelogram } from "./parallelogram.js";
4
+ export class RectangleConstructor {
5
+ static random() {
6
+ const angle = randfloat(0, Math.PI / 2);
7
+ const additionalAngle = randfloat(Math.PI / 4, (3 * Math.PI) / 4);
8
+ const xRand = randfloat(5, 8);
9
+ const origin = new Point("O", (0).toTree(), (0).toTree());
10
+ const A = new Point("A", (-xRand).toTree(), (0).toTree()).rotate(angle, origin);
11
+ const C = new Point("C", xRand.toTree(), (0).toTree()).rotate(angle, origin);
12
+ const yRand = randfloat(3, 6);
13
+ const B = new Point("B", (-xRand).toTree(), (0).toTree()).rotate(angle + additionalAngle, origin);
14
+ const D = new Point("D", xRand.toTree(), (0).toTree()).rotate(angle + additionalAngle, origin);
15
+ return new Rectangle([A, B, C, D]);
16
+ }
17
+ static fromIdentifiers(identifiers) {
18
+ return new Rectangle(identifiers.points.map((point) => PointConstructor.fromIdentifiers(point)));
19
+ }
20
+ }
21
+ export class Rectangle extends Parallelogram {
22
+ constructor(points) {
23
+ super(points);
24
+ }
25
+ toIdentifiers() {
26
+ return {
27
+ points: this.points.map((point) => point.toIdentifiers()),
28
+ };
29
+ }
30
+ drawDiagonals({ drawCenter, drawDecorations, isRhombus, }) {
31
+ super.drawDiagonals({
32
+ drawCenter,
33
+ drawDecorations,
34
+ isRectangle: true,
35
+ isRhombus,
36
+ });
37
+ }
38
+ drawSidesDecoration({ drawAngles, drawSidesLengths, isRhombus, }) {
39
+ if (drawAngles) {
40
+ const angles = [
41
+ [1, 0, 3],
42
+ [2, 1, 0],
43
+ [3, 2, 1],
44
+ [0, 3, 2],
45
+ ];
46
+ angles.forEach((angle, index) => {
47
+ this.commands.push(`angle_${index} = Angle(${this.points[angle[0]].name}, ${this.points[angle[1]].name}, ${this.points[angle[2]].name}, xAxis)`);
48
+ //xAxis sert à obtenir l'angle aigu
49
+ this.commands.push(`ShowLabel(angle_${index}, false)`);
50
+ });
51
+ }
52
+ if (drawSidesLengths) {
53
+ super.drawSidesDecoration({ isRhombus });
54
+ this.commands.push(`angle_0 = Angle(${this.points[1].name}, ${this.points[0].name}, ${this.points[3].name}, xAxis)`);
55
+ //xAxis sert à obtenir l'angle aigu
56
+ this.commands.push(`ShowLabel(angle_0, false)`);
57
+ }
58
+ }
59
+ }
@@ -0,0 +1,19 @@
1
+ import { Point, PointIdentifiers } from "../point.js";
2
+ import { Parallelogram } from "./parallelogram.js";
3
+ export declare abstract class RhombusConstructor {
4
+ static random(): Rhombus;
5
+ static fromIdentifiers(identifiers: RhombusIdentifiers): Rhombus;
6
+ }
7
+ export type RhombusIdentifiers = {
8
+ points: PointIdentifiers[];
9
+ };
10
+ export declare class Rhombus extends Parallelogram {
11
+ constructor(points: Point[]);
12
+ toIdentifiers(): RhombusIdentifiers;
13
+ drawDiagonals({ drawCenter, drawDecorations, }: {
14
+ drawCenter: boolean;
15
+ drawDecorations: boolean;
16
+ }): void;
17
+ drawSidesDecoration(): void;
18
+ }
19
+ //# sourceMappingURL=rhombus.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rhombus.d.ts","sourceRoot":"","sources":["../../../../src/math/geometry/quadrilaterals/rhombus.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAoB,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD,8BAAsB,kBAAkB;IACtC,MAAM,CAAC,MAAM;IAwBb,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,kBAAkB;CAOvD;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,gBAAgB,EAAE,CAAC;CAC5B,CAAC;AAEF,qBAAa,OAAQ,SAAQ,aAAa;gBAC5B,MAAM,EAAE,KAAK,EAAE;IAG3B,aAAa,IAAI,kBAAkB;IAKnC,aAAa,CAAC,EACZ,UAAU,EACV,eAAe,GAChB,EAAE;QACD,UAAU,EAAE,OAAO,CAAC;QACpB,eAAe,EAAE,OAAO,CAAC;KAC1B,GAAG,IAAI;IAUR,mBAAmB,IAAI,IAAI;CAK5B"}
@@ -0,0 +1,41 @@
1
+ import { randfloat } from "../../../math/utils/random/randfloat.js";
2
+ import { Point, PointConstructor } from "../point.js";
3
+ import { Parallelogram } from "./parallelogram.js";
4
+ export class RhombusConstructor {
5
+ static random() {
6
+ const angle = randfloat(0, Math.PI / 2);
7
+ const xRand = randfloat(5, 8);
8
+ const origin = new Point("O", (0).toTree(), (0).toTree());
9
+ const A = new Point("A", (-xRand).toTree(), (0).toTree()).rotate(angle, origin);
10
+ const C = new Point("C", xRand.toTree(), (0).toTree()).rotate(angle, origin);
11
+ const yRand = randfloat(3, 6);
12
+ const B = new Point("B", (0).toTree(), yRand.toTree()).rotate(angle, origin);
13
+ const D = new Point("D", (0).toTree(), (-yRand).toTree()).rotate(angle, origin);
14
+ return new Rhombus([A, B, C, D]);
15
+ }
16
+ static fromIdentifiers(identifiers) {
17
+ return new Rhombus(identifiers.points.map((point) => PointConstructor.fromIdentifiers(point)));
18
+ }
19
+ }
20
+ export class Rhombus extends Parallelogram {
21
+ constructor(points) {
22
+ super(points);
23
+ }
24
+ toIdentifiers() {
25
+ return {
26
+ points: this.points.map((point) => point.toIdentifiers()),
27
+ };
28
+ }
29
+ drawDiagonals({ drawCenter, drawDecorations, }) {
30
+ super.drawDiagonals({ drawCenter, drawDecorations, isRhombus: true });
31
+ if (drawDecorations) {
32
+ this.commands.push(`centerAngle = Angle(${this.points[1].name}, diagoCenter, ${this.points[0].name}, xAxis)`);
33
+ this.commands.push(`ShowLabel(centerAngle, false)`);
34
+ }
35
+ }
36
+ drawSidesDecoration() {
37
+ this.sides.forEach((side, index) => {
38
+ this.commands.push(`SetDecoration(${side.ggbName}, 2)`);
39
+ });
40
+ }
41
+ }
@@ -0,0 +1,22 @@
1
+ import { Point, PointIdentifiers } from "../point.js";
2
+ import { Rectangle } from "./rectangle.js";
3
+ export declare abstract class SquareConstructor {
4
+ static random(): Square;
5
+ static fromIdentifiers(identifiers: SquareIdentifiers): Square;
6
+ }
7
+ export type SquareIdentifiers = {
8
+ points: PointIdentifiers[];
9
+ };
10
+ export declare class Square extends Rectangle {
11
+ constructor(points: Point[]);
12
+ toIdentifiers(): SquareIdentifiers;
13
+ drawDiagonals({ drawCenter, drawDecorations, }: {
14
+ drawCenter: boolean;
15
+ drawDecorations: boolean;
16
+ }): void;
17
+ drawSidesDecoration({ drawAngles, drawSidesLengths, }: {
18
+ drawAngles: boolean;
19
+ drawSidesLengths: boolean;
20
+ }): void;
21
+ }
22
+ //# sourceMappingURL=square.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"square.d.ts","sourceRoot":"","sources":["../../../../src/math/geometry/quadrilaterals/square.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAoB,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAG3C,8BAAsB,iBAAiB;IACrC,MAAM,CAAC,MAAM;IAwBb,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,iBAAiB;CAOtD;AACD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,gBAAgB,EAAE,CAAC;CAC5B,CAAC;AACF,qBAAa,MAAO,SAAQ,SAAS;gBACvB,MAAM,EAAE,KAAK,EAAE;IAG3B,aAAa,IAAI,iBAAiB;IAKlC,aAAa,CAAC,EACZ,UAAU,EACV,eAAe,GAChB,EAAE;QACD,UAAU,EAAE,OAAO,CAAC;QACpB,eAAe,EAAE,OAAO,CAAC;KAC1B,GAAG,IAAI;IAGR,mBAAmB,CAAC,EAClB,UAAU,EACV,gBAAgB,GACjB,EAAE;QACD,UAAU,EAAE,OAAO,CAAC;QACpB,gBAAgB,EAAE,OAAO,CAAC;KAC3B,GAAG,IAAI;CAOT"}
@@ -0,0 +1,38 @@
1
+ import { randfloat } from "../../../math/utils/random/randfloat.js";
2
+ import { Point, PointConstructor } from "../point.js";
3
+ import { Rectangle } from "./rectangle.js";
4
+ export class SquareConstructor {
5
+ static random() {
6
+ const angle = randfloat(0, Math.PI / 2);
7
+ const xRand = randfloat(5, 8);
8
+ const origin = new Point("O", (0).toTree(), (0).toTree());
9
+ const A = new Point("A", (-xRand).toTree(), (0).toTree()).rotate(angle, origin);
10
+ const C = new Point("C", xRand.toTree(), (0).toTree()).rotate(angle, origin);
11
+ const B = new Point("B", (0).toTree(), xRand.toTree()).rotate(angle, origin);
12
+ const D = new Point("D", (0).toTree(), (-xRand).toTree()).rotate(angle, origin);
13
+ return new Square([A, B, C, D]);
14
+ }
15
+ static fromIdentifiers(identifiers) {
16
+ return new Square(identifiers.points.map((point) => PointConstructor.fromIdentifiers(point)));
17
+ }
18
+ }
19
+ export class Square extends Rectangle {
20
+ constructor(points) {
21
+ super(points);
22
+ }
23
+ toIdentifiers() {
24
+ return {
25
+ points: this.points.map((point) => point.toIdentifiers()),
26
+ };
27
+ }
28
+ drawDiagonals({ drawCenter, drawDecorations, }) {
29
+ super.drawDiagonals({ drawCenter, drawDecorations, isRhombus: true });
30
+ }
31
+ drawSidesDecoration({ drawAngles, drawSidesLengths, }) {
32
+ super.drawSidesDecoration({
33
+ drawAngles: true,
34
+ drawSidesLengths: true,
35
+ isRhombus: true,
36
+ });
37
+ }
38
+ }
@@ -0,0 +1,21 @@
1
+ import { Point } from "../point.js";
2
+ import { Triangle, TriangleIdentifiers, TriangleProps } from "./triangle.js";
3
+ export declare abstract class EquilateralTriangleConstructor {
4
+ static fromIdentifiers(identifiers: TriangleIdentifiers): EquilateralTriangle;
5
+ static randomNiceSides({ names, randomName, intSides, minAngle, }: {
6
+ names?: string[] | undefined;
7
+ randomName?: boolean | undefined;
8
+ intSides?: boolean | undefined;
9
+ minAngle?: number | undefined;
10
+ }): Triangle;
11
+ }
12
+ type EquilateralTriangleProps = {} & TriangleProps;
13
+ export declare class EquilateralTriangle extends Triangle {
14
+ /**
15
+ *
16
+ */
17
+ constructor(points: Point[], props?: EquilateralTriangleProps);
18
+ drawSidesDecoration(): void;
19
+ }
20
+ export {};
21
+ //# sourceMappingURL=equilateralTriangle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"equilateralTriangle.d.ts","sourceRoot":"","sources":["../../../../src/math/geometry/triangles/equilateralTriangle.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,EAAoB,MAAM,aAAa,CAAC;AACtD,OAAO,EACL,QAAQ,EAER,mBAAmB,EACnB,aAAa,EACd,MAAM,eAAe,CAAC;AAEvB,8BAAsB,8BAA8B;IAClD,MAAM,CAAC,eAAe,CACpB,WAAW,EAAE,mBAAmB,GAC/B,mBAAmB;IAgBtB,MAAM,CAAC,eAAe,CAAC,EACrB,KAAuB,EACvB,UAAkB,EAClB,QAAgB,EAChB,QAAY,GACb;;;;;KAAA,GAAG,QAAQ;CAkCb;AAED,KAAK,wBAAwB,GAAG,EAAE,GAAG,aAAa,CAAC;AACnD,qBAAa,mBAAoB,SAAQ,QAAQ;IAC/C;;OAEG;gBACS,MAAM,EAAE,KAAK,EAAE,EAAE,KAAK,CAAC,EAAE,wBAAwB;IAa7D,mBAAmB,IAAI,IAAI;CAO5B"}
@@ -0,0 +1,52 @@
1
+ import { randfloat } from "../../../math/utils/random/randfloat.js";
2
+ import { round } from "../../../math/utils/round.js";
3
+ import { reifyAlgebraic } from "../../../tree/nodes/nodeConstructor.js";
4
+ import { Point, PointConstructor } from "../point.js";
5
+ import { Triangle, TriangleConstructor, } from "./triangle.js";
6
+ export class EquilateralTriangleConstructor {
7
+ static fromIdentifiers(identifiers) {
8
+ return new EquilateralTriangle(identifiers.points.map((p) => PointConstructor.fromIdentifiers(p)), {
9
+ anglesRadianValues: identifiers.props?.anglesRadianValues?.map((n) => reifyAlgebraic(n)),
10
+ anglesDegreeValues: identifiers.props?.anglesDegreeValues?.map((n) => reifyAlgebraic(n)),
11
+ sidesLengths: identifiers.props?.sidesLengths?.map((n) => n ? reifyAlgebraic(n) : undefined),
12
+ });
13
+ }
14
+ static randomNiceSides({ names = ["A", "B", "C"], randomName = false, intSides = false, minAngle = 0, }) {
15
+ let vertices = [];
16
+ if (randomName)
17
+ vertices = TriangleConstructor.randomName();
18
+ else
19
+ vertices = names;
20
+ let A;
21
+ let B;
22
+ let C;
23
+ const origin = new Point("O", (0).toTree(), (0).toTree());
24
+ const angle = randfloat(0, 2 * Math.PI);
25
+ const midSide = randfloat(3, 8, 1);
26
+ C = new Point(vertices[2], midSide.toTree(), (0).toTree()).rotate(angle, origin);
27
+ B = new Point(vertices[1], (-midSide).toTree(), (0).toTree()).rotate(angle, origin);
28
+ const height = Math.sqrt(3) * midSide;
29
+ A = new Point(vertices[0], (0).toTree(), height.toTree()).rotate(angle, origin);
30
+ return new Triangle([A, B, C], {
31
+ sidesLengths: [
32
+ round(B.distanceTo(C), intSides ? 0 : 1).toTree(),
33
+ round(A.distanceTo(C), intSides ? 0 : 1).toTree(),
34
+ round(A.distanceTo(B), intSides ? 0 : 1).toTree(),
35
+ ],
36
+ });
37
+ }
38
+ }
39
+ export class EquilateralTriangle extends Triangle {
40
+ /**
41
+ *
42
+ */
43
+ constructor(points, props) {
44
+ super(points, props);
45
+ if (Math.abs(points[0].distanceTo(points[1]) - points[0].distanceTo(points[2])) > 0.001 ||
46
+ Math.abs(points[1].distanceTo(points[2]) - points[1].distanceTo(points[0])) > 0.001)
47
+ throw new Error("Not an equilateral triangle");
48
+ }
49
+ drawSidesDecoration() {
50
+ this.commands.push(`SetDecoration(${this.sides[1].ggbName}, 2)`, `SetDecoration(${this.sides[2].ggbName}, 2)`, `SetDecoration(${this.sides[0].ggbName}, 2)`);
51
+ }
52
+ }
@@ -0,0 +1,23 @@
1
+ import { Point } from "../point.js";
2
+ import { Triangle, TriangleIdentifiers, TriangleProps } from "./triangle.js";
3
+ export declare abstract class IsoceleTriangleConstructor {
4
+ static fromIdentifiers(identifiers: TriangleIdentifiers): IsoceleTriangle;
5
+ static randomNiceSides({ names, randomName, intSides, minAngle, }: {
6
+ names?: string[] | undefined;
7
+ randomName?: boolean | undefined;
8
+ intSides?: boolean | undefined;
9
+ minAngle?: number | undefined;
10
+ }): Triangle;
11
+ }
12
+ type IsoceleTriangleProps = {} & TriangleProps;
13
+ export declare class IsoceleTriangle extends Triangle {
14
+ /**
15
+ *
16
+ * @param points points[0] est le sommet principal
17
+ * sides[0] est la base
18
+ */
19
+ constructor(points: Point[], props?: IsoceleTriangleProps);
20
+ drawSidesDecoration(): void;
21
+ }
22
+ export {};
23
+ //# sourceMappingURL=isoceleTriangle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isoceleTriangle.d.ts","sourceRoot":"","sources":["../../../../src/math/geometry/triangles/isoceleTriangle.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,EAAoB,MAAM,aAAa,CAAC;AACtD,OAAO,EACL,QAAQ,EAER,mBAAmB,EACnB,aAAa,EACd,MAAM,eAAe,CAAC;AAEvB,8BAAsB,0BAA0B;IAC9C,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,mBAAmB,GAAG,eAAe;IAgBzE,MAAM,CAAC,eAAe,CAAC,EACrB,KAAuB,EACvB,UAAkB,EAClB,QAAgB,EAChB,QAAY,GACb;;;;;KAAA,GAAG,QAAQ;CA8Cb;AAED,KAAK,oBAAoB,GAAG,EAAE,GAAG,aAAa,CAAC;AAC/C,qBAAa,eAAgB,SAAQ,QAAQ;IAC3C;;;;OAIG;gBACS,MAAM,EAAE,KAAK,EAAE,EAAE,KAAK,CAAC,EAAE,oBAAoB;IAUzD,mBAAmB,IAAI,IAAI;CAM5B"}
@@ -0,0 +1,66 @@
1
+ import { randfloat } from "../../../math/utils/random/randfloat.js";
2
+ import { round } from "../../../math/utils/round.js";
3
+ import { reifyAlgebraic } from "../../../tree/nodes/nodeConstructor.js";
4
+ import { Angle } from "../angle.js";
5
+ import { Point, PointConstructor } from "../point.js";
6
+ import { Triangle, TriangleConstructor, } from "./triangle.js";
7
+ export class IsoceleTriangleConstructor {
8
+ static fromIdentifiers(identifiers) {
9
+ return new IsoceleTriangle(identifiers.points.map((p) => PointConstructor.fromIdentifiers(p)), {
10
+ anglesRadianValues: identifiers.props?.anglesRadianValues?.map((n) => reifyAlgebraic(n)),
11
+ anglesDegreeValues: identifiers.props?.anglesDegreeValues?.map((n) => reifyAlgebraic(n)),
12
+ sidesLengths: identifiers.props?.sidesLengths?.map((n) => n ? reifyAlgebraic(n) : undefined),
13
+ });
14
+ }
15
+ static randomNiceSides({ names = ["A", "B", "C"], randomName = false, intSides = false, minAngle = 0, }) {
16
+ let vertices = [];
17
+ if (randomName)
18
+ vertices = TriangleConstructor.randomName();
19
+ else
20
+ vertices = names;
21
+ let A;
22
+ let B;
23
+ let C;
24
+ const anglesAreNice = () => {
25
+ const values = [
26
+ new Angle([C, B, A]).evaluate(),
27
+ new Angle([A, C, B]).evaluate(),
28
+ new Angle([B, A, C]).evaluate(),
29
+ ];
30
+ if (minAngle)
31
+ return values.every((v) => v > minAngle && v < 180 - minAngle);
32
+ return values.every((v) => v > 20 && v < 110);
33
+ };
34
+ do {
35
+ const origin = new Point("O", (0).toTree(), (0).toTree());
36
+ const angle = randfloat(0, 2 * Math.PI);
37
+ const midBase = randfloat(3, 8, 1);
38
+ const height = randfloat(3, 8, 1, [2 * midBase]);
39
+ C = new Point(vertices[2], midBase.toTree(), (0).toTree()).rotate(angle, origin);
40
+ B = new Point(vertices[1], (-midBase).toTree(), (0).toTree()).rotate(angle, origin);
41
+ A = new Point(vertices[0], (0).toTree(), height.toTree()).rotate(angle, origin);
42
+ } while (!anglesAreNice());
43
+ return new Triangle([A, B, C], {
44
+ sidesLengths: [
45
+ round(B.distanceTo(C), intSides ? 0 : 1).toTree(),
46
+ round(A.distanceTo(C), intSides ? 0 : 1).toTree(),
47
+ round(A.distanceTo(B), intSides ? 0 : 1).toTree(),
48
+ ],
49
+ });
50
+ }
51
+ }
52
+ export class IsoceleTriangle extends Triangle {
53
+ /**
54
+ *
55
+ * @param points points[0] est le sommet principal
56
+ * sides[0] est la base
57
+ */
58
+ constructor(points, props) {
59
+ super(points, props);
60
+ if (Math.abs(points[0].distanceTo(points[1]) - points[0].distanceTo(points[2])) > 0.001)
61
+ throw new Error("Not an isocele triangle");
62
+ }
63
+ drawSidesDecoration() {
64
+ this.commands.push(`SetDecoration(${this.sides[1].ggbName}, 2)`, `SetDecoration(${this.sides[2].ggbName}, 2)`);
65
+ }
66
+ }
@@ -0,0 +1,31 @@
1
+ import { Angle } from "../angle.js";
2
+ import { Point } from "../point.js";
3
+ import { Triangle, TriangleIdentifiers, TriangleProps } from "./triangle.js";
4
+ export declare abstract class RightTriangleConstructor {
5
+ static randomNiceSides({ names, randomName, }: {
6
+ names?: string[] | undefined;
7
+ randomName?: boolean | undefined;
8
+ }): RightTriangle;
9
+ static randomNiceAngles({ names, randomName, niceSideIndex, }: {
10
+ names?: string[];
11
+ randomName?: boolean;
12
+ niceSideIndex?: number;
13
+ }): RightTriangle;
14
+ static fromIdentifiers(identifiers: TriangleIdentifiers): RightTriangle;
15
+ }
16
+ type RightTriangleProps = {} & TriangleProps;
17
+ export declare class RightTriangle extends Triangle {
18
+ /**
19
+ *
20
+ * @param points points[0] is right angle
21
+ * sides[0] is the hypotenuse (side "A" = "BC")
22
+ * angles[0] is angle A (90°)
23
+ */
24
+ constructor(points: Point[], props?: RightTriangleProps);
25
+ getRightAngle(): Angle;
26
+ getPythagorianTex(): string;
27
+ getOppositeSide(summitIndex: number): import("../segment.js").Segment;
28
+ getAdjacentSide(summitIndex: number): import("../segment.js").Segment;
29
+ }
30
+ export {};
31
+ //# sourceMappingURL=rightTriangle.d.ts.map