math-exercises 2.2.69 → 2.2.71

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 (213) hide show
  1. package/lib/exercises/math/calcul/arithmetics/divisorsList.d.ts.map +1 -1
  2. package/lib/exercises/math/calcul/arithmetics/divisorsList.js +2 -1
  3. package/lib/exercises/math/calcul/arithmetics/primeNumbers.d.ts.map +1 -1
  4. package/lib/exercises/math/calcul/arithmetics/primeNumbers.js +2 -1
  5. package/lib/exercises/math/calcul/fractions/fractionsOperations.d.ts.map +1 -1
  6. package/lib/exercises/math/calcul/fractions/fractionsOperations.js +6 -1
  7. package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivitySubstract.d.ts +12 -0
  8. package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivitySubstract.d.ts.map +1 -0
  9. package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivitySubstract.js +128 -0
  10. package/lib/exercises/math/calculLitteral/distributivity/index.d.ts +1 -0
  11. package/lib/exercises/math/calculLitteral/distributivity/index.d.ts.map +1 -1
  12. package/lib/exercises/math/calculLitteral/distributivity/index.js +1 -0
  13. package/lib/exercises/math/calculLitteral/equation/equationType1Exercise.d.ts.map +1 -1
  14. package/lib/exercises/math/calculLitteral/equation/equationType1Exercise.js +3 -6
  15. package/lib/exercises/math/calculLitteral/equation/equationType2Exercise.d.ts.map +1 -1
  16. package/lib/exercises/math/calculLitteral/equation/equationType2Exercise.js +3 -8
  17. package/lib/exercises/math/calculLitteral/equation/equationType3Exercise.d.ts.map +1 -1
  18. package/lib/exercises/math/calculLitteral/equation/equationType3Exercise.js +7 -9
  19. package/lib/exercises/math/calculLitteral/equation/equationType4Exercise.d.ts.map +1 -1
  20. package/lib/exercises/math/calculLitteral/equation/equationType4Exercise.js +6 -19
  21. package/lib/exercises/math/calculLitteral/factorisation/factoByX.d.ts +8 -0
  22. package/lib/exercises/math/calculLitteral/factorisation/factoByX.d.ts.map +1 -0
  23. package/lib/exercises/math/calculLitteral/factorisation/factoByX.js +146 -0
  24. package/lib/exercises/math/calculLitteral/factorisation/index.d.ts +1 -0
  25. package/lib/exercises/math/calculLitteral/factorisation/index.d.ts.map +1 -1
  26. package/lib/exercises/math/calculLitteral/factorisation/index.js +1 -0
  27. package/lib/exercises/math/functions/absolute/absolueValueAffineEquation.d.ts.map +1 -1
  28. package/lib/exercises/math/functions/absolute/absolueValueAffineEquation.js +2 -5
  29. package/lib/exercises/math/functions/trinoms/coefficientsIdentification.js +3 -3
  30. package/lib/exercises/math/functions/trinoms/findSecondRoot.d.ts +2 -2
  31. package/lib/exercises/math/functions/trinoms/findSecondRoot.d.ts.map +1 -1
  32. package/lib/exercises/math/functions/trinoms/findSecondRoot.js +5 -5
  33. package/lib/exercises/math/functions/trinoms/rootsProduct.d.ts +2 -2
  34. package/lib/exercises/math/functions/trinoms/rootsProduct.d.ts.map +1 -1
  35. package/lib/exercises/math/functions/trinoms/rootsProduct.js +6 -6
  36. package/lib/exercises/math/functions/trinoms/rootsSum.d.ts +2 -2
  37. package/lib/exercises/math/functions/trinoms/rootsSum.d.ts.map +1 -1
  38. package/lib/exercises/math/functions/trinoms/rootsSum.js +7 -7
  39. package/lib/exercises/math/functions/trinoms/trinomSignFromRoots.js +6 -6
  40. package/lib/exercises/math/geometry/angles/index.d.ts +2 -0
  41. package/lib/exercises/math/geometry/angles/index.d.ts.map +1 -0
  42. package/lib/exercises/math/geometry/angles/index.js +17 -0
  43. package/lib/exercises/math/geometry/angles/recognizeAngleType.d.ts +11 -0
  44. package/lib/exercises/math/geometry/angles/recognizeAngleType.d.ts.map +1 -0
  45. package/lib/exercises/math/geometry/angles/recognizeAngleType.js +272 -0
  46. package/lib/exercises/math/geometry/areas/rightTriangleArea.d.ts +3 -1
  47. package/lib/exercises/math/geometry/areas/rightTriangleArea.d.ts.map +1 -1
  48. package/lib/exercises/math/geometry/areas/rightTriangleArea.js +10 -22
  49. package/lib/exercises/math/geometry/areas/triangleArea.d.ts +6 -1
  50. package/lib/exercises/math/geometry/areas/triangleArea.d.ts.map +1 -1
  51. package/lib/exercises/math/geometry/areas/triangleArea.js +34 -48
  52. package/lib/exercises/math/geometry/euclidianConstructions/pointImageFromTranslation.js +1 -1
  53. package/lib/exercises/math/geometry/index.d.ts +2 -0
  54. package/lib/exercises/math/geometry/index.d.ts.map +1 -1
  55. package/lib/exercises/math/geometry/index.js +2 -0
  56. package/lib/exercises/math/geometry/pythagore/isTriangleRight.d.ts.map +1 -1
  57. package/lib/exercises/math/geometry/pythagore/pythagore.d.ts +0 -3
  58. package/lib/exercises/math/geometry/pythagore/pythagore.d.ts.map +1 -1
  59. package/lib/exercises/math/geometry/pythagore/pythagore.js +19 -25
  60. package/lib/exercises/math/geometry/pythagore/pythagoreCalcul.d.ts +1 -2
  61. package/lib/exercises/math/geometry/pythagore/pythagoreCalcul.d.ts.map +1 -1
  62. package/lib/exercises/math/geometry/pythagore/pythagoreCalcul.js +30 -65
  63. package/lib/exercises/math/geometry/quadrilaterals/index.d.ts +2 -0
  64. package/lib/exercises/math/geometry/quadrilaterals/index.d.ts.map +1 -0
  65. package/lib/exercises/math/geometry/quadrilaterals/index.js +17 -0
  66. package/lib/exercises/math/geometry/quadrilaterals/quadrilateralRecognition.d.ts +14 -0
  67. package/lib/exercises/math/geometry/quadrilaterals/quadrilateralRecognition.d.ts.map +1 -0
  68. package/lib/exercises/math/geometry/quadrilaterals/quadrilateralRecognition.js +221 -0
  69. package/lib/exercises/math/geometry/thales/index.d.ts.map +1 -1
  70. package/lib/exercises/math/geometry/thales/index.js +0 -1
  71. package/lib/exercises/math/geometry/thales/thales.js +2 -2
  72. package/lib/exercises/math/geometry/thales/thalesCalcul.d.ts +3 -4
  73. package/lib/exercises/math/geometry/thales/thalesCalcul.d.ts.map +1 -1
  74. package/lib/exercises/math/geometry/thales/thalesCalcul.js +69 -78
  75. package/lib/exercises/math/geometry/volumes/parallelepipedVolume.js +3 -3
  76. package/lib/exercises/math/geometry/volumes/sphereVolume.js +1 -1
  77. package/lib/exercises/math/trigonometry/trigonometry.d.ts +2 -3
  78. package/lib/exercises/math/trigonometry/trigonometry.d.ts.map +1 -1
  79. package/lib/exercises/math/trigonometry/trigonometry.js +32 -31
  80. package/lib/exercises/math/trigonometry/trigonometryAngleCalcul.d.ts +3 -2
  81. package/lib/exercises/math/trigonometry/trigonometryAngleCalcul.d.ts.map +1 -1
  82. package/lib/exercises/math/trigonometry/trigonometryAngleCalcul.js +18 -28
  83. package/lib/exercises/math/trigonometry/trigonometrySideCalcul.d.ts +5 -4
  84. package/lib/exercises/math/trigonometry/trigonometrySideCalcul.d.ts.map +1 -1
  85. package/lib/exercises/math/trigonometry/trigonometrySideCalcul.js +60 -56
  86. package/lib/exercises/pc/index.d.ts +0 -4
  87. package/lib/exercises/pc/index.d.ts.map +1 -1
  88. package/lib/exercises/pc/index.js +6 -4
  89. package/lib/exercises/utils/geogebra/toGGBCommandsProps.d.ts +1 -0
  90. package/lib/exercises/utils/geogebra/toGGBCommandsProps.d.ts.map +1 -1
  91. package/lib/exercises/vea/equationVEA.d.ts +2 -0
  92. package/lib/exercises/vea/equationVEA.d.ts.map +1 -0
  93. package/lib/exercises/vea/equationVEA.js +24 -0
  94. package/lib/exercises/vea/rationalVEA.d.ts.map +1 -1
  95. package/lib/exercises/vea/sqrtVEA.d.ts +6 -0
  96. package/lib/exercises/vea/sqrtVEA.d.ts.map +1 -0
  97. package/lib/exercises/vea/sqrtVEA.js +30 -0
  98. package/lib/geogebra/geogebraConstructor.d.ts +2 -0
  99. package/lib/geogebra/geogebraConstructor.d.ts.map +1 -1
  100. package/lib/geogebra/geogebraConstructor.js +7 -0
  101. package/lib/index.d.ts +39 -46
  102. package/lib/index.d.ts.map +1 -1
  103. package/lib/math/complex/complex.d.ts +1 -1
  104. package/lib/math/geometry/angle.d.ts +47 -0
  105. package/lib/math/geometry/angle.d.ts.map +1 -0
  106. package/lib/math/geometry/angle.js +210 -0
  107. package/lib/math/geometry/line.d.ts +7 -1
  108. package/lib/math/geometry/line.d.ts.map +1 -1
  109. package/lib/math/geometry/line.js +33 -0
  110. package/lib/math/geometry/parallelogram.d.ts +23 -0
  111. package/lib/math/geometry/parallelogram.d.ts.map +1 -0
  112. package/lib/math/geometry/parallelogram.js +70 -0
  113. package/lib/math/geometry/point.d.ts +4 -0
  114. package/lib/math/geometry/point.d.ts.map +1 -1
  115. package/lib/math/geometry/point.js +20 -0
  116. package/lib/math/geometry/quadrilateral.d.ts +15 -0
  117. package/lib/math/geometry/quadrilateral.d.ts.map +1 -0
  118. package/lib/math/geometry/quadrilateral.js +38 -0
  119. package/lib/math/geometry/rectangle.d.ts +24 -0
  120. package/lib/math/geometry/rectangle.d.ts.map +1 -0
  121. package/lib/math/geometry/rectangle.js +64 -0
  122. package/lib/math/geometry/rhombus.d.ts +19 -0
  123. package/lib/math/geometry/rhombus.d.ts.map +1 -0
  124. package/lib/math/geometry/rhombus.js +46 -0
  125. package/lib/math/geometry/rightTriangle.d.ts +31 -0
  126. package/lib/math/geometry/rightTriangle.d.ts.map +1 -0
  127. package/lib/math/geometry/rightTriangle.js +113 -0
  128. package/lib/math/geometry/segment.d.ts +24 -6
  129. package/lib/math/geometry/segment.d.ts.map +1 -1
  130. package/lib/math/geometry/segment.js +70 -4
  131. package/lib/math/geometry/square.d.ts +22 -0
  132. package/lib/math/geometry/square.d.ts.map +1 -0
  133. package/lib/math/geometry/square.js +43 -0
  134. package/lib/math/geometry/triangle.d.ts +45 -45
  135. package/lib/math/geometry/triangle.d.ts.map +1 -1
  136. package/lib/math/geometry/triangle.js +159 -186
  137. package/lib/math/geometry/vector.d.ts +5 -2
  138. package/lib/math/geometry/vector.d.ts.map +1 -1
  139. package/lib/math/geometry/vector.js +27 -9
  140. package/lib/math/numbers/rationals/rational.d.ts +1 -1
  141. package/lib/math/numbers/reals/extendedRingElement.d.ts +1 -1
  142. package/lib/math/numbers/reals/real.d.ts.map +1 -1
  143. package/lib/math/numbers/reals/real.js +3 -0
  144. package/lib/math/polynomials/generalAffine.d.ts +3 -0
  145. package/lib/math/polynomials/generalAffine.d.ts.map +1 -1
  146. package/lib/math/polynomials/generalAffine.js +5 -1
  147. package/lib/math/polynomials/polynomial.d.ts +1 -1
  148. package/lib/math/polynomials/trinom.d.ts +2 -2
  149. package/lib/math/utils/geometry/pythagoricianTriplets.d.ts +1 -0
  150. package/lib/math/utils/geometry/pythagoricianTriplets.d.ts.map +1 -1
  151. package/lib/math/utils/geometry/pythagoricianTriplets.js +14 -1
  152. package/lib/math/utils/random/randfloat.d.ts +1 -1
  153. package/lib/math/utils/random/randfloat.d.ts.map +1 -1
  154. package/lib/math/utils/random/randfloat.js +8 -1
  155. package/lib/math/utils/random/randint.d.ts +8 -1
  156. package/lib/math/utils/random/randint.d.ts.map +1 -1
  157. package/lib/math/utils/random/randint.js +6 -1
  158. package/lib/playground.d.ts.map +1 -1
  159. package/lib/playground.js +1 -8
  160. package/lib/tree/nodes/functions/absNode.d.ts +1 -1
  161. package/lib/tree/nodes/functions/functionNode.d.ts +2 -2
  162. package/lib/tree/nodes/functions/functionNode.d.ts.map +1 -1
  163. package/lib/tree/nodes/functions/oppositeNode.d.ts +5 -5
  164. package/lib/tree/nodes/functions/oppositeNode.d.ts.map +1 -1
  165. package/lib/tree/nodes/node.d.ts +6 -2
  166. package/lib/tree/nodes/node.d.ts.map +1 -1
  167. package/lib/tree/nodes/node.js +3 -0
  168. package/lib/tree/nodes/nodeConstructor.d.ts.map +1 -1
  169. package/lib/tree/nodes/nodeConstructor.js +8 -0
  170. package/lib/tree/nodes/numbers/numberNode.d.ts +2 -0
  171. package/lib/tree/nodes/numbers/numberNode.d.ts.map +1 -1
  172. package/lib/tree/nodes/numbers/numberNode.js +6 -1
  173. package/lib/tree/nodes/operators/addNode.d.ts.map +1 -1
  174. package/lib/tree/nodes/operators/addNode.js +123 -89
  175. package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
  176. package/lib/tree/nodes/operators/multiplyNode.js +3 -3
  177. package/lib/tree/nodes/polynomials/monomNode.d.ts +47 -0
  178. package/lib/tree/nodes/polynomials/monomNode.d.ts.map +1 -0
  179. package/lib/tree/nodes/polynomials/monomNode.js +214 -0
  180. package/lib/tree/nodes/polynomials/trinomNode.d.ts +70 -0
  181. package/lib/tree/nodes/polynomials/trinomNode.d.ts.map +1 -0
  182. package/lib/tree/nodes/polynomials/trinomNode.js +156 -0
  183. package/lib/tree/nodes/variables/variableNode.d.ts.map +1 -1
  184. package/lib/tree/nodes/variables/variableNode.js +1 -1
  185. package/lib/tree/parsers/affineParser.d.ts.map +1 -1
  186. package/lib/tree/parsers/affineParser.js +2 -1
  187. package/lib/tree/parsers/discreteSetParser.d.ts +3 -0
  188. package/lib/tree/parsers/discreteSetParser.d.ts.map +1 -0
  189. package/lib/tree/parsers/discreteSetParser.js +23 -0
  190. package/lib/tree/parsers/equationSolutionParser.d.ts +1 -1
  191. package/lib/tree/parsers/equationSolutionParser.d.ts.map +1 -1
  192. package/lib/tree/parsers/equationSolutionParser.js +15 -4
  193. package/lib/tree/parsers/latexParser.d.ts +5 -1
  194. package/lib/tree/parsers/latexParser.d.ts.map +1 -1
  195. package/lib/tree/parsers/latexParser.js +17 -3
  196. package/lib/tree/parsers/monomParser.d.ts +2 -2
  197. package/lib/tree/parsers/monomParser.d.ts.map +1 -1
  198. package/lib/tree/parsers/monomParser.js +61 -8
  199. package/lib/tree/parsers/rationalParser.d.ts +1 -1
  200. package/lib/tree/parsers/rationalParser.d.ts.map +1 -1
  201. package/lib/tree/parsers/rationalParser.js +28 -24
  202. package/lib/tree/parsers/sqrtParser.d.ts +9 -0
  203. package/lib/tree/parsers/sqrtParser.d.ts.map +1 -0
  204. package/lib/tree/parsers/sqrtParser.js +52 -0
  205. package/lib/tree/parsers/trinomParser.d.ts +1 -1
  206. package/lib/tree/parsers/trinomParser.d.ts.map +1 -1
  207. package/lib/tree/parsers/trinomParser.js +14 -2
  208. package/lib/tree/utilities/functionComposition.d.ts +1 -1
  209. package/lib/tree/utilities/functionComposition.d.ts.map +1 -1
  210. package/lib/utils/arrays/rotation.d.ts +8 -0
  211. package/lib/utils/arrays/rotation.d.ts.map +1 -0
  212. package/lib/utils/arrays/rotation.js +17 -0
  213. package/package.json +1 -1
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Rectangle = exports.RectangleConstructor = void 0;
4
+ const randfloat_1 = require("../utils/random/randfloat");
5
+ const parallelogram_1 = require("./parallelogram");
6
+ const point_1 = require("./point");
7
+ class RectangleConstructor {
8
+ static random() {
9
+ const angle = (0, randfloat_1.randfloat)(0, Math.PI / 2);
10
+ const additionalAngle = (0, randfloat_1.randfloat)(Math.PI / 4, (3 * Math.PI) / 4);
11
+ const xRand = (0, randfloat_1.randfloat)(5, 8);
12
+ const origin = new point_1.Point("O", (0).toTree(), (0).toTree());
13
+ const A = new point_1.Point("A", (-xRand).toTree(), (0).toTree()).rotate(angle, origin);
14
+ const C = new point_1.Point("C", xRand.toTree(), (0).toTree()).rotate(angle, origin);
15
+ const yRand = (0, randfloat_1.randfloat)(3, 6);
16
+ const B = new point_1.Point("B", (-xRand).toTree(), (0).toTree()).rotate(angle + additionalAngle, origin);
17
+ const D = new point_1.Point("D", xRand.toTree(), (0).toTree()).rotate(angle + additionalAngle, origin);
18
+ return new Rectangle([A, B, C, D]);
19
+ }
20
+ static fromIdentifiers(identifiers) {
21
+ return new Rectangle(identifiers.points.map((point) => point_1.PointConstructor.fromIdentifiers(point)));
22
+ }
23
+ }
24
+ exports.RectangleConstructor = RectangleConstructor;
25
+ class Rectangle extends parallelogram_1.Parallelogram {
26
+ constructor(points) {
27
+ super(points);
28
+ }
29
+ toIdentifiers() {
30
+ return {
31
+ points: this.points.map((point) => point.toIdentifiers()),
32
+ };
33
+ }
34
+ drawDiagonals({ drawCenter, drawDecorations, isRhombus, }) {
35
+ super.drawDiagonals({
36
+ drawCenter,
37
+ drawDecorations,
38
+ isRectangle: true,
39
+ isRhombus,
40
+ });
41
+ }
42
+ drawSidesDecoration({ drawAngles, drawSidesLengths, isRhombus, }) {
43
+ if (drawAngles) {
44
+ const angles = [
45
+ [1, 0, 3],
46
+ [2, 1, 0],
47
+ [3, 2, 1],
48
+ [0, 3, 2],
49
+ ];
50
+ angles.forEach((angle, index) => {
51
+ this.commands.push(`angle_${index} = Angle(${this.points[angle[0]].name}, ${this.points[angle[1]].name}, ${this.points[angle[2]].name}, xAxis)`);
52
+ //xAxis sert à obtenir l'angle aigu
53
+ this.commands.push(`ShowLabel(angle_${index}, false)`);
54
+ });
55
+ }
56
+ if (drawSidesLengths) {
57
+ super.drawSidesDecoration({ isRhombus });
58
+ this.commands.push(`angle_0 = Angle(${this.points[1].name}, ${this.points[0].name}, ${this.points[3].name}, xAxis)`);
59
+ //xAxis sert à obtenir l'angle aigu
60
+ this.commands.push(`ShowLabel(angle_0, false)`);
61
+ }
62
+ }
63
+ }
64
+ exports.Rectangle = Rectangle;
@@ -0,0 +1,19 @@
1
+ import { Parallelogram } from "./parallelogram";
2
+ import { Point, PointIdentifiers } from "./point";
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/rhombus.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAoB,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAGpE,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,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Rhombus = exports.RhombusConstructor = void 0;
4
+ const randfloat_1 = require("../utils/random/randfloat");
5
+ const parallelogram_1 = require("./parallelogram");
6
+ const point_1 = require("./point");
7
+ class RhombusConstructor {
8
+ static random() {
9
+ const angle = (0, randfloat_1.randfloat)(0, Math.PI / 2);
10
+ const xRand = (0, randfloat_1.randfloat)(5, 8);
11
+ const origin = new point_1.Point("O", (0).toTree(), (0).toTree());
12
+ const A = new point_1.Point("A", (-xRand).toTree(), (0).toTree()).rotate(angle, origin);
13
+ const C = new point_1.Point("C", xRand.toTree(), (0).toTree()).rotate(angle, origin);
14
+ const yRand = (0, randfloat_1.randfloat)(3, 6);
15
+ const B = new point_1.Point("B", (0).toTree(), yRand.toTree()).rotate(angle, origin);
16
+ const D = new point_1.Point("D", (0).toTree(), (-yRand).toTree()).rotate(angle, origin);
17
+ return new Rhombus([A, B, C, D]);
18
+ }
19
+ static fromIdentifiers(identifiers) {
20
+ return new Rhombus(identifiers.points.map((point) => point_1.PointConstructor.fromIdentifiers(point)));
21
+ }
22
+ }
23
+ exports.RhombusConstructor = RhombusConstructor;
24
+ class Rhombus extends parallelogram_1.Parallelogram {
25
+ constructor(points) {
26
+ super(points);
27
+ }
28
+ toIdentifiers() {
29
+ return {
30
+ points: this.points.map((point) => point.toIdentifiers()),
31
+ };
32
+ }
33
+ drawDiagonals({ drawCenter, drawDecorations, }) {
34
+ super.drawDiagonals({ drawCenter, drawDecorations, isRhombus: true });
35
+ if (drawDecorations) {
36
+ this.commands.push(`centerAngle = Angle(${this.points[1].name}, diagoCenter, ${this.points[0].name}, xAxis)`);
37
+ this.commands.push(`ShowLabel(centerAngle, false)`);
38
+ }
39
+ }
40
+ drawSidesDecoration() {
41
+ this.sides.forEach((side, index) => {
42
+ this.commands.push(`SetDecoration(${side.ggbName}, 2)`);
43
+ });
44
+ }
45
+ }
46
+ exports.Rhombus = Rhombus;
@@ -0,0 +1,31 @@
1
+ import { Angle } from "./angle";
2
+ import { Point } from "./point";
3
+ import { Triangle, TriangleIdentifiers, TriangleProps } from "./triangle";
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").Segment;
28
+ getAdjacentSide(summitIndex: number): import("./segment").Segment;
29
+ }
30
+ export {};
31
+ //# sourceMappingURL=rightTriangle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rightTriangle.d.ts","sourceRoot":"","sources":["../../../src/math/geometry/rightTriangle.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,KAAK,EAAoB,MAAM,SAAS,CAAC;AAClD,OAAO,EACL,QAAQ,EAER,mBAAmB,EACnB,aAAa,EACd,MAAM,YAAY,CAAC;AAEpB,8BAAsB,wBAAwB;IAC5C,MAAM,CAAC,eAAe,CAAC,EACrB,KAAuB,EACvB,UAAkB,GACnB;;;KAAA,GAAG,aAAa;IAqCjB,MAAM,CAAC,gBAAgB,CAAC,EACtB,KAAuB,EACvB,UAAkB,EAClB,aAAyB,GAC1B,EAAE;QACD,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;QACjB,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,aAAa,CAAC,EAAE,MAAM,CAAC;KACxB;IA0CD,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,mBAAmB;CAaxD;AAED,KAAK,kBAAkB,GAAG,EAAE,GAAG,aAAa,CAAC;AAC7C,qBAAa,aAAc,SAAQ,QAAQ;IACzC;;;;;OAKG;gBACS,MAAM,EAAE,KAAK,EAAE,EAAE,KAAK,CAAC,EAAE,kBAAkB;IAKvD,aAAa,IAAI,KAAK;IAMtB,iBAAiB;IAIjB,eAAe,CAAC,WAAW,EAAE,MAAM;IAInC,eAAe,CAAC,WAAW,EAAE,MAAM;CAKpC"}
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RightTriangle = exports.RightTriangleConstructor = void 0;
4
+ const nodeConstructor_1 = require("../../tree/nodes/nodeConstructor");
5
+ const random_1 = require("../../utils/alea/random");
6
+ const pythagoricianTriplets_1 = require("../utils/geometry/pythagoricianTriplets");
7
+ const randfloat_1 = require("../utils/random/randfloat");
8
+ const randint_1 = require("../utils/random/randint");
9
+ const round_1 = require("../utils/round");
10
+ const point_1 = require("./point");
11
+ const triangle_1 = require("./triangle");
12
+ class RightTriangleConstructor {
13
+ static randomNiceSides({ names = ["A", "B", "C"], randomName = false, }) {
14
+ let vertices = [];
15
+ if (randomName)
16
+ vertices = triangle_1.TriangleConstructor.randomName();
17
+ else
18
+ vertices = names;
19
+ const triplet = (0, random_1.random)(pythagoricianTriplets_1.pythagoricianTripletsNiceAngles);
20
+ // const triplet = pythagoricianTriplets[0];
21
+ const coeff = (0, random_1.random)([1, 2, 0.1, 0.2, 0.25, 0.4, 0.5, 0.75, 0.8]);
22
+ let [ac, ab, bc] = triplet.map((e) => (0, round_1.round)(e * coeff, 4));
23
+ // const angles = [
24
+ // frac(PiNode, 2),
25
+ // frac(multiply(round(Math.asin(ac / bc), 2), PiNode), 180),
26
+ // frac(multiply(round(Math.asin(ab / bc), 2), PiNode), 180),
27
+ // ];
28
+ const angle = (0, randfloat_1.randfloat)(0, 2 * Math.PI);
29
+ //on construit [AC] sur (Ox) de milieu O et de taille 2*xRand
30
+ //puis [AB] perpendiculaire à (AB) de taille yRand
31
+ //puis on rotate
32
+ const midAc = ac / 2;
33
+ const origin = new point_1.Point("O", (0).toTree(), (0).toTree());
34
+ const A = new point_1.Point(vertices[0], (-midAc).toTree(), (0).toTree()).rotate(angle, origin);
35
+ const C = new point_1.Point(vertices[2], midAc.toTree(), (0).toTree()).rotate(angle, origin);
36
+ const B = new point_1.Point(vertices[1], (-midAc).toTree(), ab.toTree()).rotate(angle, origin);
37
+ return new RightTriangle([A, B, C], {
38
+ sidesLengths: [bc.toTree(), ac.toTree(), ab.toTree()],
39
+ // anglesRadianValues: angles,
40
+ });
41
+ }
42
+ static randomNiceAngles({ names = ["A", "B", "C"], randomName = false, niceSideIndex = undefined, }) {
43
+ let vertices = [];
44
+ if (randomName)
45
+ vertices = triangle_1.TriangleConstructor.randomName();
46
+ else
47
+ vertices = names;
48
+ const angleB = (0, randfloat_1.randfloat)(20, 60, 1);
49
+ const angleC = (0, round_1.round)(90 - angleB, 1);
50
+ const angles = [90, angleB, angleC];
51
+ //a / sin(A) = b/sin(B) = c/sin(C)
52
+ const niceSide = niceSideIndex !== undefined ? niceSideIndex : (0, randint_1.randint)(0, 3);
53
+ const sideLenght = (0, randfloat_1.randfloat)(1, 20, 1);
54
+ const sidesLenghts = angles.map((angle, index) => index === niceSideIndex
55
+ ? sideLenght
56
+ : (Math.sin((angle * Math.PI) / 180) * sideLenght) /
57
+ Math.sin((angles[niceSide] * Math.PI) / 180));
58
+ const angle = (0, randfloat_1.randfloat)(0, 2 * Math.PI);
59
+ //on construit [AC] sur (Ox) de milieu O et de taille 2*xRand
60
+ //puis [AB] perpendiculaire à (AB) de taille yRand
61
+ //puis on rotate
62
+ const midAc = sidesLenghts[1] / 2;
63
+ const origin = new point_1.Point("O", (0).toTree(), (0).toTree());
64
+ const A = new point_1.Point(vertices[0], (-midAc).toTree(), (0).toTree()).rotate(angle, origin);
65
+ const C = new point_1.Point(vertices[2], midAc.toTree(), (0).toTree()).rotate(angle, origin);
66
+ const B = new point_1.Point(vertices[1], (-midAc).toTree(), sidesLenghts[2].toTree()).rotate(angle, origin);
67
+ return new RightTriangle([A, B, C], {
68
+ sidesLengths: sidesLenghts.map((s) => s.toTree()),
69
+ anglesDegreeValues: angles.map((a) => a.toTree()),
70
+ });
71
+ }
72
+ static fromIdentifiers(identifiers) {
73
+ return new RightTriangle(identifiers.points.map((p) => point_1.PointConstructor.fromIdentifiers(p)), {
74
+ anglesRadianValues: identifiers.props?.anglesRadianValues?.map((n) => (0, nodeConstructor_1.reifyAlgebraic)(n)),
75
+ sidesLengths: identifiers.props?.sidesLengths?.map((n) => n ? (0, nodeConstructor_1.reifyAlgebraic)(n) : undefined),
76
+ });
77
+ }
78
+ }
79
+ exports.RightTriangleConstructor = RightTriangleConstructor;
80
+ class RightTriangle extends triangle_1.Triangle {
81
+ /**
82
+ *
83
+ * @param points points[0] is right angle
84
+ * sides[0] is the hypotenuse (side "A" = "BC")
85
+ * angles[0] is angle A (90°)
86
+ */
87
+ constructor(points, props) {
88
+ super(points, props);
89
+ if (!this.isRight())
90
+ throw new Error("Not a right triangle");
91
+ this.commands.push(...this.angles[0].toCommands());
92
+ }
93
+ getRightAngle() {
94
+ const angle = this.angles.find((a) => a.isRight());
95
+ if (!angle)
96
+ throw new Error("Not a right triangle");
97
+ return angle;
98
+ }
99
+ getPythagorianTex() {
100
+ return `${this.sides[0].toInsideName()}^2=${this.sides[1].toInsideName()}^2+${this.sides[2].toInsideName()}^2`;
101
+ }
102
+ getOppositeSide(summitIndex) {
103
+ if (summitIndex === 0)
104
+ throw Error("Right angle has no opposite side");
105
+ return this.sides[summitIndex];
106
+ }
107
+ getAdjacentSide(summitIndex) {
108
+ if (summitIndex === 0)
109
+ throw Error("Right angle has no adjacent side");
110
+ return this.sides[3 - summitIndex];
111
+ }
112
+ }
113
+ exports.RightTriangle = RightTriangle;
@@ -1,26 +1,44 @@
1
1
  import { ToGGBCommandsProps } from "../../exercises/utils/geogebra/toGGBCommandsProps";
2
+ import { AlgebraicNode } from "../../tree/nodes/algebraicNode";
3
+ import { NodeIdentifiers } from "../../tree/nodes/nodeConstructor";
2
4
  import { Point, PointIdentifiers } from "./point";
5
+ import { Vector } from "./vector";
3
6
  export type SegmentIdentifiers = {
4
7
  pointA: PointIdentifiers;
5
8
  pointB: PointIdentifiers;
9
+ props?: SegmentPropsIdentifiers;
6
10
  };
7
11
  export declare abstract class SegmentConstructor {
8
12
  static random(): Segment;
9
13
  static fromIdentifiers(identifiers: SegmentIdentifiers): Segment;
10
14
  }
15
+ type SegmentPropsIdentifiers = {
16
+ lengthNode?: NodeIdentifiers;
17
+ roundLenghtTo?: number;
18
+ };
19
+ type SegmentProps = {
20
+ lengthNode?: AlgebraicNode;
21
+ roundLenghtTo?: number;
22
+ };
11
23
  export declare class Segment {
12
24
  pointA: Point;
13
25
  pointB: Point;
14
26
  name: string;
15
27
  ggbName: string;
16
- constructor(pointA: Point, pointB: Point);
17
- toIdentifiers(): {
18
- pointA: PointIdentifiers;
19
- pointB: PointIdentifiers;
20
- };
28
+ lengthNode?: AlgebraicNode;
29
+ props?: SegmentProps;
30
+ constructor(pointA: Point, pointB: Point, props?: SegmentProps);
31
+ toIdentifiers(): SegmentIdentifiers;
32
+ getMidpoint(): Point;
21
33
  getLength(): number;
34
+ getLengthNode(): AlgebraicNode;
22
35
  toTex(): string;
23
36
  toInsideName(): string;
24
- toGGBCommands(shouldBuildPoints: boolean, { isFixed, showLabel, showUnderlyingPointsLabel, }?: ToGGBCommandsProps): string[];
37
+ toLengthTex(): string;
38
+ getFitCaptionCommands(text?: string, color?: string): string[];
39
+ toGGBCommands(shouldBuildPoints: boolean, { isFixed, showLabel, showUnderlyingPointsLabel, showLength, style, }?: ToGGBCommandsProps): string[];
40
+ includes(point: Point): boolean;
41
+ toVector(): Vector;
25
42
  }
43
+ export {};
26
44
  //# sourceMappingURL=segment.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"segment.d.ts","sourceRoot":"","sources":["../../../src/math/geometry/segment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mDAAmD,CAAC;AAEvF,OAAO,EAAE,KAAK,EAAoB,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEpE,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,gBAAgB,CAAC;IACzB,MAAM,EAAE,gBAAgB,CAAC;CAC1B,CAAC;AACF,8BAAsB,kBAAkB;IACtC,MAAM,CAAC,MAAM;IAKb,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,kBAAkB;CAMvD;AACD,qBAAa,OAAO;IAClB,MAAM,EAAE,KAAK,CAAC;IACd,MAAM,EAAE,KAAK,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;gBACJ,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK;IAOxC,aAAa;;;;IAMb,SAAS;IAGT,KAAK;IAGL,YAAY;IAGZ,aAAa,CACX,iBAAiB,EAAE,OAAO,EAC1B,EACE,OAAc,EACd,SAAiB,EACjB,yBAAgC,GACjC,GAAE,kBAAuB;CAoB7B"}
1
+ {"version":3,"file":"segment.d.ts","sourceRoot":"","sources":["../../../src/math/geometry/segment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mDAAmD,CAAC;AAEvF,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAE/D,OAAO,EAEL,eAAe,EAEhB,MAAM,kCAAkC,CAAC;AAK1C,OAAO,EAAE,KAAK,EAAoB,gBAAgB,EAAE,MAAM,SAAS,CAAC;AACpE,OAAO,EAAE,MAAM,EAAqB,MAAM,UAAU,CAAC;AAErD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,gBAAgB,CAAC;IACzB,MAAM,EAAE,gBAAgB,CAAC;IACzB,KAAK,CAAC,EAAE,uBAAuB,CAAC;CACjC,CAAC;AACF,8BAAsB,kBAAkB;IACtC,MAAM,CAAC,MAAM;IAKb,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,kBAAkB;CAYvD;AAED,KAAK,uBAAuB,GAAG;IAC7B,UAAU,CAAC,EAAE,eAAe,CAAC;IAC7B,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AACF,KAAK,YAAY,GAAG;IAAE,UAAU,CAAC,EAAE,aAAa,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAC3E,qBAAa,OAAO;IAClB,MAAM,EAAE,KAAK,CAAC;IACd,MAAM,EAAE,KAAK,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,aAAa,CAAC;IAC3B,KAAK,CAAC,EAAE,YAAY,CAAC;gBACT,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,YAAY;IAS9D,aAAa,IAAI,kBAAkB;IAUnC,WAAW;IAGX,SAAS;IAST,aAAa;IAYb,KAAK;IAGL,YAAY;IAGZ,WAAW;IAGX,qBAAqB,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM;IAanD,aAAa,CACX,iBAAiB,EAAE,OAAO,EAC1B,EACE,OAAc,EACd,SAAiB,EACjB,yBAAgC,EAChC,UAAkB,EAClB,KAAK,GACN,GAAE,kBAAuB;IA8B5B,QAAQ,CAAC,KAAK,EAAE,KAAK;IAOrB,QAAQ;CAGT"}
@@ -2,7 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Segment = exports.SegmentConstructor = void 0;
4
4
  const randomSegmentName_1 = require("../../exercises/utils/geometry/randomSegmentName");
5
+ const sqrtNode_1 = require("../../tree/nodes/functions/sqrtNode");
6
+ const nodeConstructor_1 = require("../../tree/nodes/nodeConstructor");
7
+ const addNode_1 = require("../../tree/nodes/operators/addNode");
8
+ const powerNode_1 = require("../../tree/nodes/operators/powerNode");
9
+ const substractNode_1 = require("../../tree/nodes/operators/substractNode");
10
+ const round_1 = require("../utils/round");
5
11
  const point_1 = require("./point");
12
+ const vector_1 = require("./vector");
6
13
  class SegmentConstructor {
7
14
  static random() {
8
15
  const name = (0, randomSegmentName_1.randomSegmentName)();
@@ -10,14 +17,21 @@ class SegmentConstructor {
10
17
  return new Segment(points[0], points[1]);
11
18
  }
12
19
  static fromIdentifiers(identifiers) {
13
- return new Segment(point_1.PointConstructor.fromIdentifiers(identifiers.pointA), point_1.PointConstructor.fromIdentifiers(identifiers.pointB));
20
+ return new Segment(point_1.PointConstructor.fromIdentifiers(identifiers.pointA), point_1.PointConstructor.fromIdentifiers(identifiers.pointB), {
21
+ lengthNode: identifiers.props?.lengthNode
22
+ ? (0, nodeConstructor_1.reifyAlgebraic)(identifiers.props.lengthNode)
23
+ : undefined,
24
+ roundLenghtTo: identifiers.props?.roundLenghtTo,
25
+ });
14
26
  }
15
27
  }
16
28
  exports.SegmentConstructor = SegmentConstructor;
17
29
  class Segment {
18
- constructor(pointA, pointB) {
30
+ constructor(pointA, pointB, props) {
19
31
  this.pointA = pointA;
20
32
  this.pointB = pointB;
33
+ this.props = props;
34
+ this.lengthNode = props?.lengthNode;
21
35
  this.name = `[${pointA.name}${pointB.name}]`;
22
36
  this.ggbName = `segment_{${pointA.name}${pointB.name}}`;
23
37
  }
@@ -25,10 +39,27 @@ class Segment {
25
39
  return {
26
40
  pointA: this.pointA.toIdentifiers(),
27
41
  pointB: this.pointB.toIdentifiers(),
42
+ props: {
43
+ lengthNode: this.lengthNode?.toIdentifiers(),
44
+ roundLenghtTo: this.props?.roundLenghtTo,
45
+ },
28
46
  };
29
47
  }
48
+ getMidpoint() {
49
+ return this.pointA.midpoint(this.pointB);
50
+ }
30
51
  getLength() {
31
- return this.pointA.distanceTo(this.pointB);
52
+ if (this.lengthNode) {
53
+ return this.lengthNode.evaluate();
54
+ }
55
+ return (0, round_1.round)(this.pointA.distanceTo(this.pointB), this.props?.roundLenghtTo ?? 6);
56
+ }
57
+ getLengthNode() {
58
+ if (this.lengthNode) {
59
+ return this.lengthNode;
60
+ }
61
+ // return this.getLength().toTree();
62
+ return (0, sqrtNode_1.sqrt)((0, addNode_1.add)((0, powerNode_1.square)((0, substractNode_1.substract)(this.pointB.x, this.pointA.x)), (0, powerNode_1.square)((0, substractNode_1.substract)(this.pointB.y, this.pointA.y)))).simplify();
32
63
  }
33
64
  toTex() {
34
65
  return this.name;
@@ -36,12 +67,36 @@ class Segment {
36
67
  toInsideName() {
37
68
  return `${this.pointA.name}${this.pointB.name}`;
38
69
  }
39
- toGGBCommands(shouldBuildPoints, { isFixed = true, showLabel = false, showUnderlyingPointsLabel = true, } = {}) {
70
+ toLengthTex() {
71
+ return `${this.toInsideName()} = ${this.getLengthNode().toTex()}`;
72
+ }
73
+ getFitCaptionCommands(text, color) {
74
+ const txt = text ?? this.getLength().frenchify();
75
+ const midPoint = this.getMidpoint().toMathString();
76
+ const cmds = [
77
+ `angle_{${this.name}} = Angle(Vector(${this.pointA.name}, ${this.pointB.name}))`,
78
+ `SetVisibleInView(angle_{${this.name}}, 1, false)`,
79
+ `text_{${this.name}} = Text(RotateText("${txt}", If(angle_{${this.name}} > 90° ∧ angle_{${this.name}} < 270°, angle_{${this.name}} + 180°, angle_{${this.name}})), ${midPoint}, true, true, 0, 0)`,
80
+ ];
81
+ if (color) {
82
+ cmds.push(`SetColor(text_{${this.name}}, "${color}")`);
83
+ }
84
+ return cmds;
85
+ }
86
+ toGGBCommands(shouldBuildPoints, { isFixed = true, showLabel = false, showUnderlyingPointsLabel = true, showLength = false, style, } = {}) {
40
87
  const commands = [
41
88
  `${this.ggbName}=Segment(${this.pointA.name},${this.pointB.name})`,
42
89
  `SetFixed(${this.ggbName},${isFixed ? "true" : "false"})`,
43
90
  `ShowLabel(${this.ggbName},${showLabel ? "true" : "false"})`,
44
91
  ];
92
+ if (style !== undefined) {
93
+ commands.push(`SetLineStyle(${this.ggbName}, ${style})`);
94
+ }
95
+ if (showLength) {
96
+ const length = this.getLengthNode().toTex();
97
+ commands.push(`SetCaption(${this.ggbName}, ${length})`);
98
+ commands.push(`ShowLabel(${this.ggbName}, true)`);
99
+ }
45
100
  if (shouldBuildPoints) {
46
101
  const ACommands = this.pointA.toGGBCommand({
47
102
  isFixed,
@@ -55,5 +110,16 @@ class Segment {
55
110
  }
56
111
  return commands;
57
112
  }
113
+ includes(point) {
114
+ const vec = this.toVector();
115
+ const pointVec = vector_1.VectorConstructor.fromPoints(this.pointA, point);
116
+ if (!vec.isColinear(pointVec))
117
+ return false;
118
+ const product = vec.scalarProduct(pointVec).evaluate();
119
+ return product >= 0 && product <= this.getLength() ** 2;
120
+ }
121
+ toVector() {
122
+ return vector_1.VectorConstructor.fromPoints(this.pointA, this.pointB);
123
+ }
58
124
  }
59
125
  exports.Segment = Segment;
@@ -0,0 +1,22 @@
1
+ import { Point, PointIdentifiers } from "./point";
2
+ import { Rectangle } from "./rectangle";
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/square.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAoB,gBAAgB,EAAE,MAAM,SAAS,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,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,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Square = exports.SquareConstructor = void 0;
4
+ const randfloat_1 = require("../utils/random/randfloat");
5
+ const point_1 = require("./point");
6
+ const rectangle_1 = require("./rectangle");
7
+ class SquareConstructor {
8
+ static random() {
9
+ const angle = (0, randfloat_1.randfloat)(0, Math.PI / 2);
10
+ const xRand = (0, randfloat_1.randfloat)(5, 8);
11
+ const origin = new point_1.Point("O", (0).toTree(), (0).toTree());
12
+ const A = new point_1.Point("A", (-xRand).toTree(), (0).toTree()).rotate(angle, origin);
13
+ const C = new point_1.Point("C", xRand.toTree(), (0).toTree()).rotate(angle, origin);
14
+ const B = new point_1.Point("B", (0).toTree(), xRand.toTree()).rotate(angle, origin);
15
+ const D = new point_1.Point("D", (0).toTree(), (-xRand).toTree()).rotate(angle, origin);
16
+ return new Square([A, B, C, D]);
17
+ }
18
+ static fromIdentifiers(identifiers) {
19
+ return new Square(identifiers.points.map((point) => point_1.PointConstructor.fromIdentifiers(point)));
20
+ }
21
+ }
22
+ exports.SquareConstructor = SquareConstructor;
23
+ class Square extends rectangle_1.Rectangle {
24
+ constructor(points) {
25
+ super(points);
26
+ }
27
+ toIdentifiers() {
28
+ return {
29
+ points: this.points.map((point) => point.toIdentifiers()),
30
+ };
31
+ }
32
+ drawDiagonals({ drawCenter, drawDecorations, }) {
33
+ super.drawDiagonals({ drawCenter, drawDecorations, isRhombus: true });
34
+ }
35
+ drawSidesDecoration({ drawAngles, drawSidesLengths, }) {
36
+ super.drawSidesDecoration({
37
+ drawAngles: true,
38
+ drawSidesLengths: true,
39
+ isRhombus: true,
40
+ });
41
+ }
42
+ }
43
+ exports.Square = Square;
@@ -1,67 +1,67 @@
1
1
  import { Point, PointIdentifiers } from "./point";
2
- import { SqrtNode } from "../../tree/nodes/functions/sqrtNode";
3
2
  import { Segment } from "./segment";
3
+ import { Angle } from "./angle";
4
+ import { AlgebraicNode } from "../../tree/nodes/algebraicNode";
5
+ import { NodeIdentifiers } from "../../tree/nodes/nodeConstructor";
4
6
  export type TriangleIdentifiers = {
5
- vertexA: PointIdentifiers;
6
- vertexB: PointIdentifiers;
7
- vertexC: PointIdentifiers;
7
+ points: PointIdentifiers[];
8
+ props?: TrianglePropsIdentifiers;
8
9
  };
9
10
  export declare abstract class TriangleConstructor {
10
11
  static fromIdentifiers(identifiers: TriangleIdentifiers): Triangle;
11
- static createRandomRightTriangle({ minRapport, maxRapport, names, }: {
12
- minRapport?: number | undefined;
13
- maxRapport?: number | undefined;
14
- names?: string[] | undefined;
15
- }): Triangle;
16
- static createRandomTriangle({ minAngle, maxAngle, names, }: {
17
- minAngle?: number | undefined;
18
- maxAngle?: number | undefined;
12
+ static randomNiceSides({ names, randomName, }: {
19
13
  names?: string[] | undefined;
14
+ randomName?: boolean | undefined;
20
15
  }): Triangle;
21
16
  static randomName(): string[];
22
17
  }
23
- type GenerateCommandsProps = {
24
- highlightedAngle?: string;
25
- colorHighlightedAngle?: string;
26
- highlightedSide?: string;
27
- colorHighlightedSide?: string;
28
- showLabels?: string[];
29
- setCaptions?: string[];
30
- showAxes?: boolean;
31
- showGrid?: boolean;
18
+ export type TrianglePropsIdentifiers = {
19
+ sidesLengths?: (NodeIdentifiers | undefined)[];
20
+ anglesRadianValues?: NodeIdentifiers[];
21
+ anglesDegreeValues?: NodeIdentifiers[];
22
+ };
23
+ export type TriangleProps = {
24
+ roundSidesTo?: number;
25
+ sidesLengths?: (AlgebraicNode | undefined)[];
26
+ anglesRadianValues?: AlgebraicNode[];
27
+ anglesDegreeValues?: AlgebraicNode[];
32
28
  };
33
29
  export declare class Triangle {
34
- vertexA: Point;
35
- vertexB: Point;
36
- vertexC: Point;
37
- constructor(vertexA: Point, vertexB: Point, vertexC: Point);
38
- getSegments(): Segment[];
39
- getSideASegment(): Segment;
40
- getSideBSegment(): Segment;
41
- getSideCSegment(): Segment;
30
+ angles: Angle[];
31
+ points: Point[];
32
+ sides: Segment[];
33
+ commands: string[];
34
+ name: string;
35
+ props?: TriangleProps;
36
+ constructor(points: Point[], props?: TriangleProps);
42
37
  toIdentifiers(): TriangleIdentifiers;
43
- getSideAnumber(): number;
44
- getSideBnumber(): number;
45
- getSideCnumber(): number;
46
- getTriangleName(): string;
47
- getSideAnode(): SqrtNode;
48
- getSideBnode(): SqrtNode;
49
- getSideCnode(): SqrtNode;
50
- getAngleA(): number;
51
- getAngleB(): number;
52
- getAngleC(): number;
38
+ /************* ✨ Codeium Command ⭐ *************/
39
+ /**
40
+ * Returns the perimeter of the triangle.
41
+ * @returns {number} the perimeter of the triangle.
42
+ */
43
+ /****** fbb7c5d7-3919-4ef2-b5ba-db0d6770666d *******/
53
44
  getPerimeter(): number;
54
45
  getArea(): number;
55
46
  isRight(): Boolean;
56
47
  isEquilateral(): Boolean;
57
48
  isIsosceles(): Boolean;
58
49
  isScalene(): boolean;
59
- getRightAngle(): string;
60
- generateCommands({ highlightedAngle: highlightedAngle, colorHighlightedAngle: colorHighlightedAngle, showLabels: showLabels, setCaptions: setCaptions, highlightedSide: highlightedSide, colorHighlightedSide: colorHighlightedSide, }: GenerateCommandsProps): string[];
50
+ highlightSide(index: number, opts: {
51
+ color?: string;
52
+ caption?: string;
53
+ }): void;
54
+ highlightAngle(index: number, opts?: {
55
+ color?: string;
56
+ showValue?: boolean;
57
+ }): void;
58
+ showSidesLength(hiddenSides?: number[]): void;
59
+ getHeight(summitIndex: number, opts?: {
60
+ footName?: string;
61
+ }): Segment;
62
+ drawHeight(summitIndex: number, opts?: {
63
+ footName?: string;
64
+ }): void;
61
65
  generateCoords(): number[];
62
- getSideAName(): string;
63
- getSideBName(): string;
64
- getSideCName(): string;
65
66
  }
66
- export {};
67
67
  //# sourceMappingURL=triangle.d.ts.map