math-exercises 3.0.46 → 3.0.48
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.
- package/lib/exercises/math/dataRepresentations/barChartReading.d.ts.map +1 -1
- package/lib/exercises/math/dataRepresentations/barChartReading.js +5 -4
- package/lib/exercises/math/geometry/quadrilaterals/index.d.ts +1 -0
- package/lib/exercises/math/geometry/quadrilaterals/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/quadrilaterals/index.js +1 -0
- package/lib/exercises/math/geometry/quadrilaterals/parallelogramAngles.d.ts +10 -0
- package/lib/exercises/math/geometry/quadrilaterals/parallelogramAngles.d.ts.map +1 -0
- package/lib/exercises/math/geometry/quadrilaterals/parallelogramAngles.js +128 -0
- package/lib/exercises/math/geometry/triangles/triangleThirdAngleValue.d.ts.map +1 -1
- package/lib/exercises/math/geometry/triangles/triangleThirdAngleValue.js +16 -4
- package/lib/exercises/math/trigonometry/trigonometry.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/trigonometry.js +49 -22
- package/lib/exercises/math/trigonometry/trigonometryAngleCalcul.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/trigonometryAngleCalcul.js +44 -22
- package/lib/exercises/math/trigonometry/trigonometrySideCalcul.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/trigonometrySideCalcul.js +6 -3
- package/lib/index.d.ts +4 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/math/geometry/angle.d.ts.map +1 -1
- package/lib/math/geometry/angle.js +2 -1
- package/lib/math/geometry/quadrilaterals/parallelogram.d.ts.map +1 -1
- package/lib/math/geometry/quadrilaterals/parallelogram.js +3 -1
- package/lib/math/geometry/quadrilaterals/quadrilateral.d.ts +6 -0
- package/lib/math/geometry/quadrilaterals/quadrilateral.d.ts.map +1 -1
- package/lib/math/geometry/quadrilaterals/quadrilateral.js +11 -0
- package/lib/math/geometry/triangles/triangle.js +2 -2
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"barChartReading.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/dataRepresentations/barChartReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAOrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;
|
|
1
|
+
{"version":3,"file":"barChartReading.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/dataRepresentations/barChartReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAOrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAsHF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAgBjD,CAAC;;AAgFF,oBAAoB;AACpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmFG"}
|
|
@@ -50,7 +50,7 @@ const getGGBOptions = (identifiers) => {
|
|
|
50
50
|
const { labels, data } = identifiers;
|
|
51
51
|
const commands = [
|
|
52
52
|
`B = BarChart({1,2,3,4,5}, {${data.join(",")}}, 0.5)`,
|
|
53
|
-
...labels.map((l, i) => `Text("\\footnotesize ${l}", (${i + 1},
|
|
53
|
+
...labels.map((l, i) => `Text("\\footnotesize ${l}", (${i + 1}, 50), true, true, 0, -1)`),
|
|
54
54
|
`Text("\\footnotesize Diamètre\\ (en \\ cm)", (3, -100), true, true, 0, -1)`,
|
|
55
55
|
`ShowLabel(B,false)`,
|
|
56
56
|
`SetColor(B, "#FE0045AB")`,
|
|
@@ -59,7 +59,7 @@ const getGGBOptions = (identifiers) => {
|
|
|
59
59
|
commands,
|
|
60
60
|
gridDistance: [10000, 50],
|
|
61
61
|
fontSize: 16,
|
|
62
|
-
lockedAxesRatio: 1 /
|
|
62
|
+
lockedAxesRatio: 1 / 400,
|
|
63
63
|
xAxis: {
|
|
64
64
|
// hideNumbers: true,
|
|
65
65
|
showPositive: true,
|
|
@@ -72,7 +72,7 @@ const getGGBOptions = (identifiers) => {
|
|
|
72
72
|
},
|
|
73
73
|
});
|
|
74
74
|
return ggb.getOptions({
|
|
75
|
-
coords: [-
|
|
75
|
+
coords: [-0.2, 5.2, -300, 1100],
|
|
76
76
|
});
|
|
77
77
|
};
|
|
78
78
|
const getBarChartReadingQuestion = (ops) => {
|
|
@@ -80,7 +80,8 @@ const getBarChartReadingQuestion = (ops) => {
|
|
|
80
80
|
const labels = ["11", "12", "13", "15", "16"];
|
|
81
81
|
for (let i = 0; i < labels.length; i++) {
|
|
82
82
|
data.push(50 *
|
|
83
|
-
randint(1, 20,
|
|
83
|
+
randint(1, i < 3 ? 18 : 20, //pour ne pas que les 2 premieres barres touchent le label de l'axe
|
|
84
|
+
data.map((d) => d / 50)));
|
|
84
85
|
}
|
|
85
86
|
const itemAsked = randint(0, 5);
|
|
86
87
|
const identifiers = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/quadrilaterals/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/quadrilaterals/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { ParallelogramIdentifiers } from "../../../../math/geometry/quadrilaterals/parallelogram.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
paraIdentifiers: ParallelogramIdentifiers;
|
|
5
|
+
givenAngleIndex: number;
|
|
6
|
+
askedAngleIndex: number;
|
|
7
|
+
};
|
|
8
|
+
export declare const parallelogramAngles: Exercise<Identifiers>;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=parallelogramAngles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parallelogramAngles.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/quadrilaterals/parallelogramAngles.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EAEL,wBAAwB,EACzB,MAAM,qDAAqD,CAAC;AAO7D,KAAK,WAAW,GAAG;IACjB,eAAe,EAAE,wBAAwB,CAAC;IAC1C,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAuIF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAmBrD,CAAC"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
|
|
4
|
+
import { ParallelogramConstructor, } from "../../../../math/geometry/quadrilaterals/parallelogram.js";
|
|
5
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
6
|
+
import { round } from "../../../../math/utils/round.js";
|
|
7
|
+
import { degreeParser } from "../../../../tree/parsers/degreeParser.js";
|
|
8
|
+
import { doWhile } from "../../../../utils/doWhile.js";
|
|
9
|
+
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
10
|
+
const getPropositions = (n, { answer, ...identifiers }) => {
|
|
11
|
+
const propositions = [];
|
|
12
|
+
const para = ParallelogramConstructor.fromIdentifiers(identifiers.paraIdentifiers);
|
|
13
|
+
const value = round(para.angles[identifiers.givenAngleIndex].evaluate(), 0);
|
|
14
|
+
addValidProp(propositions, answer);
|
|
15
|
+
tryToAddWrongProp(propositions, "180^{\\circ}");
|
|
16
|
+
tryToAddWrongProp(propositions, (180 - value).frenchify() + "^{\\circ}");
|
|
17
|
+
tryToAddWrongProp(propositions, value.frenchify() + "^{\\circ}");
|
|
18
|
+
while (propositions.length < n) {
|
|
19
|
+
tryToAddWrongProp(propositions, randint(20, 160) + "^{\\circ}");
|
|
20
|
+
}
|
|
21
|
+
return shuffleProps(propositions, n);
|
|
22
|
+
};
|
|
23
|
+
const getAnswer = (identifiers) => {
|
|
24
|
+
const para = ParallelogramConstructor.fromIdentifiers(identifiers.paraIdentifiers);
|
|
25
|
+
const value = round(para.angles[identifiers.givenAngleIndex].evaluate(), 0);
|
|
26
|
+
const askedAngle = para.angles[identifiers.askedAngleIndex];
|
|
27
|
+
const isOpposite = identifiers.askedAngleIndex === (identifiers.givenAngleIndex + 2) % 4;
|
|
28
|
+
return (isOpposite ? value : 180 - value).frenchify() + "^{\\circ}";
|
|
29
|
+
};
|
|
30
|
+
const getInstruction = (identifiers) => {
|
|
31
|
+
const para = ParallelogramConstructor.fromIdentifiers(identifiers.paraIdentifiers);
|
|
32
|
+
const value = round(para.angles[identifiers.givenAngleIndex].evaluate(), 0);
|
|
33
|
+
return `On considère le parallélogramme $ABCD$ ci-dessous.
|
|
34
|
+
|
|
35
|
+
L'angle $${para.angles[identifiers.givenAngleIndex].toTex()}$ vaut $${value}^{\\circ}$.
|
|
36
|
+
|
|
37
|
+
Que vaut l'angle $${para.angles[identifiers.askedAngleIndex].toTex()}$ ?`;
|
|
38
|
+
};
|
|
39
|
+
const getHint = (identifiers) => {
|
|
40
|
+
return "Dans un parallélogramme, la somme totale des angles vaut $360^{\\circ}$. Les angles opposés sont égaux, et la somme de deux angles consécutifs est égale à $180^{\\circ}$.";
|
|
41
|
+
};
|
|
42
|
+
const getCorrection = (identifiers) => {
|
|
43
|
+
const para = ParallelogramConstructor.fromIdentifiers(identifiers.paraIdentifiers);
|
|
44
|
+
const value = round(para.angles[identifiers.givenAngleIndex].evaluate(), 0);
|
|
45
|
+
const askedAngle = para.angles[identifiers.askedAngleIndex];
|
|
46
|
+
const isOpposite = identifiers.askedAngleIndex === (identifiers.givenAngleIndex + 2) % 4;
|
|
47
|
+
return isOpposite
|
|
48
|
+
? `Dans un parallélogramme, les angles opposés sont égaux.
|
|
49
|
+
|
|
50
|
+
On a donc :
|
|
51
|
+
|
|
52
|
+
$$
|
|
53
|
+
${askedAngle.toTex()} = ${getAnswer(identifiers)}
|
|
54
|
+
$$`
|
|
55
|
+
: `Dans un parallélogramme, la somme de deux angles consécutifs vaut $180^{\\circ}$.
|
|
56
|
+
|
|
57
|
+
Ainsi,
|
|
58
|
+
|
|
59
|
+
${alignTex([
|
|
60
|
+
[askedAngle.toTex(), "=", `180 - ${value}`],
|
|
61
|
+
["", "=", getAnswer(identifiers)],
|
|
62
|
+
])}`;
|
|
63
|
+
};
|
|
64
|
+
const getGGBOptions = (identifiers) => {
|
|
65
|
+
const para = ParallelogramConstructor.fromIdentifiers(identifiers.paraIdentifiers);
|
|
66
|
+
para.drawAngle(identifiers.givenAngleIndex, { showValue: false });
|
|
67
|
+
const ggb = new GeogebraConstructor({
|
|
68
|
+
commands: [
|
|
69
|
+
...para.toGGBCommands(),
|
|
70
|
+
...para.angles[identifiers.givenAngleIndex].toCommands({}),
|
|
71
|
+
// ...para.angles[identifiers.givenAngleIndex].getFitCaptionCommands({
|
|
72
|
+
// size: "scriptsize",
|
|
73
|
+
// color: "black",
|
|
74
|
+
// text: `${value}`,
|
|
75
|
+
// }),
|
|
76
|
+
...para.angles[identifiers.askedAngleIndex].toCommands({ color: "red" }),
|
|
77
|
+
],
|
|
78
|
+
hideAxes: true,
|
|
79
|
+
hideGrid: true,
|
|
80
|
+
});
|
|
81
|
+
return ggb.getOptions({ coords: ggb.getCoordsForPoints(para.points) });
|
|
82
|
+
};
|
|
83
|
+
const getKeys = (identifiers) => {
|
|
84
|
+
return ["degree"];
|
|
85
|
+
};
|
|
86
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
87
|
+
return degreeParser(ans) === answer;
|
|
88
|
+
};
|
|
89
|
+
const getParallelogramAnglesQuestion = (opts) => {
|
|
90
|
+
const givenAngleIndex = randint(0, 3);
|
|
91
|
+
const askedAngleIndex = randint(0, 3, [givenAngleIndex]);
|
|
92
|
+
const para = doWhile(() => ParallelogramConstructor.random(), (p) => round(p.angles[givenAngleIndex].evaluate(), 0) === 90); //ParallelogramConstructor.random();
|
|
93
|
+
const identifiers = {
|
|
94
|
+
paraIdentifiers: para.toIdentifiers(),
|
|
95
|
+
givenAngleIndex,
|
|
96
|
+
askedAngleIndex,
|
|
97
|
+
};
|
|
98
|
+
const question = {
|
|
99
|
+
answer: getAnswer(identifiers),
|
|
100
|
+
instruction: getInstruction(identifiers),
|
|
101
|
+
keys: getKeys(identifiers),
|
|
102
|
+
answerFormat: "tex",
|
|
103
|
+
identifiers,
|
|
104
|
+
hint: getHint(identifiers),
|
|
105
|
+
correction: getCorrection(identifiers),
|
|
106
|
+
ggbOptions: getGGBOptions(identifiers),
|
|
107
|
+
};
|
|
108
|
+
return question;
|
|
109
|
+
};
|
|
110
|
+
export const parallelogramAngles = {
|
|
111
|
+
id: "parallelogramAngles",
|
|
112
|
+
connector: "=",
|
|
113
|
+
label: "Angles opposés et consécutifs dans un parallélogramme",
|
|
114
|
+
isSingleStep: true,
|
|
115
|
+
generator: (nb, opts) => getDistinctQuestions(() => getParallelogramAnglesQuestion(opts), nb),
|
|
116
|
+
qcmTimer: 60,
|
|
117
|
+
freeTimer: 60,
|
|
118
|
+
getPropositions,
|
|
119
|
+
isAnswerValid,
|
|
120
|
+
subject: "Mathématiques",
|
|
121
|
+
getHint,
|
|
122
|
+
getCorrection,
|
|
123
|
+
getInstruction,
|
|
124
|
+
getAnswer,
|
|
125
|
+
getGGBOptions,
|
|
126
|
+
hasGeogebra: true,
|
|
127
|
+
hasHintAndCorrection: true,
|
|
128
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"triangleThirdAngleValue.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/triangles/triangleThirdAngleValue.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"triangleThirdAngleValue.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/triangles/triangleThirdAngleValue.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAmBT,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EAGL,mBAAmB,EAEpB,MAAM,2CAA2C,CAAC;AASnD,KAAK,WAAW,GAAG;IACjB,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AA8IF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAoBzD,CAAC"}
|
|
@@ -6,6 +6,7 @@ import { randint } from "../../../../math/utils/random/randint.js";
|
|
|
6
6
|
import { round } from "../../../../math/utils/round.js";
|
|
7
7
|
import { DegreeNode } from "../../../../tree/nodes/geometry/degree.js";
|
|
8
8
|
import { add } from "../../../../tree/nodes/operators/addNode.js";
|
|
9
|
+
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
9
10
|
import { degreeParser } from "../../../../tree/parsers/degreeParser.js";
|
|
10
11
|
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
11
12
|
const getPropositions = (n, { answer }) => {
|
|
@@ -20,7 +21,13 @@ const getPropositions = (n, { answer }) => {
|
|
|
20
21
|
const getAnswer = (identifiers) => {
|
|
21
22
|
const { triangleIdentifiers, angleAsked } = identifiers;
|
|
22
23
|
const triangle = TriangleConstructor.fromIdentifiers(triangleIdentifiers);
|
|
23
|
-
|
|
24
|
+
const angles = [
|
|
25
|
+
triangle.angles[(angleAsked + 1) % 3].getValueNode(true),
|
|
26
|
+
triangle.angles[(angleAsked + 2) % 3].getValueNode(true),
|
|
27
|
+
];
|
|
28
|
+
const addAngles = add(angles[0], angles[1]);
|
|
29
|
+
const simp = addAngles.simplify();
|
|
30
|
+
return substract(180, simp).simplify().toTex() + "^{\\circ}";
|
|
24
31
|
};
|
|
25
32
|
const getInstruction = (identifiers) => {
|
|
26
33
|
const { triangleIdentifiers, angleAsked } = identifiers;
|
|
@@ -66,7 +73,9 @@ $$`;
|
|
|
66
73
|
const getGGBOptions = (identifiers) => {
|
|
67
74
|
const { triangleIdentifiers, angleAsked } = identifiers;
|
|
68
75
|
const triangle = TriangleConstructor.fromIdentifiers(triangleIdentifiers);
|
|
69
|
-
triangle.drawAngles([angleAsked], { fitCaption: true, color: "
|
|
76
|
+
// triangle.drawAngles([angleAsked], { fitCaption: true, color: "black" });
|
|
77
|
+
triangle.drawAngles([angleAsked]);
|
|
78
|
+
triangle.highlightAngle(angleAsked, { color: "red" });
|
|
70
79
|
const ggb = new GeogebraConstructor({
|
|
71
80
|
commands: [...triangle.commands],
|
|
72
81
|
hideAxes: true,
|
|
@@ -101,7 +110,10 @@ const getTriangleThirdAngleValueQuestion = (opts) => {
|
|
|
101
110
|
triangleIdentifiers: triangle.toIdentifiers(),
|
|
102
111
|
angleAsked: randint(0, 3),
|
|
103
112
|
};
|
|
104
|
-
|
|
113
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
114
|
+
};
|
|
115
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
116
|
+
return {
|
|
105
117
|
answer: getAnswer(identifiers),
|
|
106
118
|
instruction: getInstruction(identifiers),
|
|
107
119
|
keys: getKeys(identifiers),
|
|
@@ -111,7 +123,6 @@ const getTriangleThirdAngleValueQuestion = (opts) => {
|
|
|
111
123
|
correction: getCorrection(identifiers),
|
|
112
124
|
ggbOptions: getGGBOptions(identifiers),
|
|
113
125
|
};
|
|
114
|
-
return question;
|
|
115
126
|
};
|
|
116
127
|
export const triangleThirdAngleValue = {
|
|
117
128
|
id: "triangleThirdAngleValue",
|
|
@@ -131,4 +142,5 @@ export const triangleThirdAngleValue = {
|
|
|
131
142
|
getGGBOptions,
|
|
132
143
|
hasGeogebra: true,
|
|
133
144
|
hasHintAndCorrection: true,
|
|
145
|
+
getQuestionFromIdentifiers,
|
|
134
146
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trigonometry.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/trigonometry/trigonometry.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"trigonometry.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/trigonometry/trigonometry.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAEL,mBAAmB,EACpB,MAAM,2CAA2C,CAAC;AASnD,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,mBAAmB,EAAE,mBAAmB,CAAC;CAC1C,CAAC;AAyJF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,CAmB9C,CAAC"}
|
|
@@ -7,17 +7,18 @@ import { LengthNode } from "../../../tree/nodes/geometry/lengthNode.js";
|
|
|
7
7
|
import { FractionNode } from "../../../tree/nodes/operators/fractionNode.js";
|
|
8
8
|
import { random } from "../../../utils/alea/random.js";
|
|
9
9
|
import { shuffle } from "../../../utils/alea/shuffle.js";
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
});
|
|
10
|
+
const getInstruction = (identifiers) => {
|
|
11
|
+
const { randAngle, triangleIdentifiers, randTrigo } = identifiers;
|
|
12
|
+
const triangle = RightTriangleConstructor.fromIdentifiers(triangleIdentifiers);
|
|
14
13
|
const trigo = ["le cosinus", "le sinus", "la tangente"];
|
|
15
|
-
const randTrigo = randint(0, 3);
|
|
16
|
-
const randAngle = random([1, 2]);
|
|
17
|
-
triangle.highlightAngle(randAngle, { color: "red" });
|
|
18
|
-
const [sideA, sideB, sideC] = triangle.sides.map((s) => s.toInsideName());
|
|
19
14
|
const angleSummit = triangle.points[randAngle].name;
|
|
15
|
+
return `À quel quotient est égal ${trigo[randTrigo]} de l'angle $${triangle.angles[randAngle].toTex()}$ ?`;
|
|
16
|
+
};
|
|
17
|
+
const getAnswer = (identifiers) => {
|
|
18
|
+
const { randAngle, triangleIdentifiers, randTrigo } = identifiers;
|
|
19
|
+
const triangle = RightTriangleConstructor.fromIdentifiers(triangleIdentifiers);
|
|
20
20
|
let quotient;
|
|
21
|
+
const [sideA, sideB, sideC] = triangle.sides.map((s) => s.toInsideName());
|
|
21
22
|
switch (randAngle) {
|
|
22
23
|
case 1: //angle B
|
|
23
24
|
quotient = [
|
|
@@ -35,27 +36,49 @@ const getTrigonometry = () => {
|
|
|
35
36
|
];
|
|
36
37
|
break;
|
|
37
38
|
}
|
|
39
|
+
const answer = quotient[randTrigo];
|
|
40
|
+
return answer;
|
|
41
|
+
};
|
|
42
|
+
const getKeys = (identifiers) => {
|
|
43
|
+
const { randAngle, triangleIdentifiers, randTrigo } = identifiers;
|
|
44
|
+
const triangle = RightTriangleConstructor.fromIdentifiers(triangleIdentifiers);
|
|
45
|
+
return [...triangle.points.map((p) => p.name), "equal"];
|
|
46
|
+
};
|
|
47
|
+
const getGGBOptions = (identifiers) => {
|
|
48
|
+
const { randAngle, triangleIdentifiers, randTrigo } = identifiers;
|
|
49
|
+
const triangle = RightTriangleConstructor.fromIdentifiers(triangleIdentifiers);
|
|
50
|
+
triangle.highlightAngle(randAngle, { color: "red" });
|
|
38
51
|
const ggb = new GeogebraConstructor({
|
|
39
52
|
commands: triangle.commands,
|
|
40
53
|
hideAxes: true,
|
|
41
54
|
hideGrid: true,
|
|
42
55
|
});
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
56
|
+
return ggb.getOptions({
|
|
57
|
+
coords: triangle.generateCoords(),
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
const getTrigonometry = () => {
|
|
61
|
+
const triangle = RightTriangleConstructor.randomNiceSides({
|
|
62
|
+
randomName: true,
|
|
63
|
+
});
|
|
64
|
+
const randTrigo = randint(0, 3);
|
|
65
|
+
const randAngle = random([1, 2]);
|
|
66
|
+
const identifiers = {
|
|
67
|
+
triangleIdentifiers: triangle.toIdentifiers(),
|
|
68
|
+
randAngle,
|
|
69
|
+
randTrigo,
|
|
70
|
+
};
|
|
71
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
72
|
+
};
|
|
73
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
74
|
+
return {
|
|
75
|
+
instruction: getInstruction(identifiers),
|
|
76
|
+
answer: getAnswer(identifiers),
|
|
77
|
+
keys: getKeys(identifiers),
|
|
78
|
+
ggbOptions: getGGBOptions(identifiers),
|
|
51
79
|
answerFormat: "tex",
|
|
52
|
-
identifiers
|
|
53
|
-
triangleIdentifiers: triangle.toIdentifiers(),
|
|
54
|
-
randAngle,
|
|
55
|
-
randTrigo,
|
|
56
|
-
},
|
|
80
|
+
identifiers,
|
|
57
81
|
};
|
|
58
|
-
return question;
|
|
59
82
|
};
|
|
60
83
|
const getPropositions = (n, { answer, triangleIdentifiers }) => {
|
|
61
84
|
const propositions = [];
|
|
@@ -116,4 +139,8 @@ export const trigonometry = {
|
|
|
116
139
|
isAnswerValid,
|
|
117
140
|
hasGeogebra: true,
|
|
118
141
|
subject: "Mathématiques",
|
|
142
|
+
getAnswer,
|
|
143
|
+
getInstruction,
|
|
144
|
+
getGGBOptions,
|
|
145
|
+
getQuestionFromIdentifiers,
|
|
119
146
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trigonometryAngleCalcul.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/trigonometry/trigonometryAngleCalcul.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"trigonometryAngleCalcul.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/trigonometry/trigonometryAngleCalcul.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAEL,mBAAmB,EACpB,MAAM,2CAA2C,CAAC;AAOnD,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,mBAAmB,EAAE,mBAAmB,CAAC;CAC1C,CAAC;AA+EF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAmBzD,CAAC"}
|
|
@@ -5,39 +5,57 @@ import { RightTriangleConstructor } from "../../../math/geometry/triangles/right
|
|
|
5
5
|
import { randint } from "../../../math/utils/random/randint.js";
|
|
6
6
|
import { round } from "../../../math/utils/round.js";
|
|
7
7
|
import { shuffle } from "../../../utils/alea/shuffle.js";
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
});
|
|
12
|
-
const randAngle = randint(1, 3);
|
|
13
|
-
const hiddenSide = randint(0, 3);
|
|
8
|
+
const getInstruction = (identifiers) => {
|
|
9
|
+
const { randAngle, hiddenSide, triangleIdentifiers } = identifiers;
|
|
10
|
+
const triangle = RightTriangleConstructor.fromIdentifiers(triangleIdentifiers);
|
|
14
11
|
const givenSides = triangle.sides.filter((s, i) => i !== hiddenSide);
|
|
12
|
+
return `Le triangle $${triangle.name}$ rectangle en $${triangle.points[0].name}$ est tel que $${givenSides[0].toLengthTex()}$ cm et $${givenSides[1].toLengthTex()}$ cm.
|
|
13
|
+
|
|
14
|
+
Calculer $\\widehat{${triangle.points[randAngle].name}}$ à $1^\\circ$ près.`;
|
|
15
|
+
};
|
|
16
|
+
const getAnswer = (identifiers) => {
|
|
17
|
+
const { randAngle, hiddenSide, triangleIdentifiers } = identifiers;
|
|
18
|
+
const triangle = RightTriangleConstructor.fromIdentifiers(triangleIdentifiers);
|
|
19
|
+
const answer = round(triangle.angles[randAngle].evaluate(), 0);
|
|
20
|
+
return answer + "^{\\circ}";
|
|
21
|
+
};
|
|
22
|
+
const getGGBOptions = (identifiers) => {
|
|
23
|
+
const { randAngle, hiddenSide, triangleIdentifiers } = identifiers;
|
|
24
|
+
const triangle = RightTriangleConstructor.fromIdentifiers(triangleIdentifiers);
|
|
15
25
|
triangle.showSidesLength([hiddenSide]);
|
|
16
26
|
triangle.highlightAngle(randAngle, { color: "red" });
|
|
17
|
-
const answer = round(triangle.angles[randAngle].evaluate(), 0);
|
|
18
|
-
const answerTex = answer + "^{\\circ}";
|
|
19
27
|
const ggb = new GeogebraConstructor({
|
|
20
28
|
commands: triangle.commands,
|
|
21
29
|
hideAxes: true,
|
|
22
30
|
hideGrid: true,
|
|
23
31
|
});
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
32
|
+
return ggb.getOptions({
|
|
33
|
+
coords: triangle.generateCoords(),
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
const getTrigonometryAngleCalcul = () => {
|
|
37
|
+
const triangle = RightTriangleConstructor.randomNiceSides({
|
|
38
|
+
randomName: true,
|
|
39
|
+
});
|
|
40
|
+
const randAngle = randint(1, 3);
|
|
41
|
+
const hiddenSide = randint(0, 3);
|
|
42
|
+
const identifiers = {
|
|
43
|
+
randAngle,
|
|
44
|
+
hiddenSide,
|
|
45
|
+
triangleIdentifiers: triangle.toIdentifiers(),
|
|
46
|
+
};
|
|
47
|
+
const question = getQuestionFromIdentifiers(identifiers);
|
|
48
|
+
return question;
|
|
49
|
+
};
|
|
50
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
51
|
+
return {
|
|
52
|
+
instruction: getInstruction(identifiers),
|
|
53
|
+
answer: getAnswer(identifiers),
|
|
29
54
|
keys: ["degree"],
|
|
30
|
-
ggbOptions:
|
|
31
|
-
coords: triangle.generateCoords(),
|
|
32
|
-
}),
|
|
55
|
+
ggbOptions: getGGBOptions(identifiers),
|
|
33
56
|
answerFormat: "tex",
|
|
34
|
-
identifiers
|
|
35
|
-
randAngle,
|
|
36
|
-
hiddenSide,
|
|
37
|
-
triangleIdentifiers: triangle.toIdentifiers(),
|
|
38
|
-
},
|
|
57
|
+
identifiers,
|
|
39
58
|
};
|
|
40
|
-
return question;
|
|
41
59
|
};
|
|
42
60
|
const getPropositions = (n, { answer }) => {
|
|
43
61
|
const propositions = [];
|
|
@@ -64,4 +82,8 @@ export const trigonometryAngleCalcul = {
|
|
|
64
82
|
isAnswerValid,
|
|
65
83
|
hasGeogebra: true,
|
|
66
84
|
subject: "Mathématiques",
|
|
85
|
+
getAnswer,
|
|
86
|
+
getInstruction,
|
|
87
|
+
getGGBOptions,
|
|
88
|
+
getQuestionFromIdentifiers,
|
|
67
89
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trigonometrySideCalcul.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/trigonometry/trigonometrySideCalcul.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"trigonometrySideCalcul.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/trigonometry/trigonometrySideCalcul.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AASrC,OAAO,EAEL,mBAAmB,EACpB,MAAM,2CAA2C,CAAC;AAMnD,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,mBAAmB,EAAE,mBAAmB,CAAC;CAC1C,CAAC;AAiPF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAoBxD,CAAC"}
|
|
@@ -12,7 +12,7 @@ const getInstruction = (identifiers) => {
|
|
|
12
12
|
const { givenAngle, givenSide, sideAsked, triangleIdentifiers } = identifiers;
|
|
13
13
|
const triangle = TriangleConstructor.fromIdentifiers(triangleIdentifiers);
|
|
14
14
|
const angleValue = triangle.angles[givenAngle].evaluate().frenchify();
|
|
15
|
-
return `Le triangle $${triangle.name}$ rectangle en $${triangle.points[0].name}$ est tel que $${triangle.sides[givenSide].toLengthTex()}$ cm et
|
|
15
|
+
return `Le triangle $${triangle.name}$ rectangle en $${triangle.points[0].name}$ est tel que $${triangle.sides[givenSide].toLengthTex()}$ cm et $${triangle.angles[givenAngle].toTex()} = ${angleValue}^\\circ$.
|
|
16
16
|
|
|
17
17
|
Calculer $${triangle.sides[sideAsked].toInsideName()}$ à $0,1$ cm près.`;
|
|
18
18
|
};
|
|
@@ -51,7 +51,10 @@ const getTrigonometrySideCalcul = () => {
|
|
|
51
51
|
sideAsked,
|
|
52
52
|
triangleIdentifiers: triangle.toIdentifiers(),
|
|
53
53
|
};
|
|
54
|
-
|
|
54
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
55
|
+
};
|
|
56
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
57
|
+
return {
|
|
55
58
|
instruction: getInstruction(identifiers),
|
|
56
59
|
answer: getAnswer(identifiers),
|
|
57
60
|
hint: getHint(identifiers),
|
|
@@ -61,7 +64,6 @@ const getTrigonometrySideCalcul = () => {
|
|
|
61
64
|
answerFormat: "tex",
|
|
62
65
|
identifiers,
|
|
63
66
|
};
|
|
64
|
-
return question;
|
|
65
67
|
};
|
|
66
68
|
const getPropositions = (n, { answer }) => {
|
|
67
69
|
const propositions = [];
|
|
@@ -223,4 +225,5 @@ export const trigonometrySideCalcul = {
|
|
|
223
225
|
getGGBOptions,
|
|
224
226
|
getCorrection,
|
|
225
227
|
hasHintAndCorrection: true,
|
|
228
|
+
getQuestionFromIdentifiers,
|
|
226
229
|
};
|
package/lib/index.d.ts
CHANGED
|
@@ -1305,6 +1305,10 @@ declare const mathExercises: (Exercise<{
|
|
|
1305
1305
|
showDiagonals: boolean;
|
|
1306
1306
|
drawAngles: boolean;
|
|
1307
1307
|
shapeIdentifiers: import("./math/geometry/quadrilaterals/rectangle.js").RectangleIdentifiers | import("./math/geometry/quadrilaterals/square.js").SquareIdentifiers | import("./math/geometry/quadrilaterals/rhombus.js").RhombusIdentifiers | import("./math/geometry/quadrilaterals/parallelogram.js").ParallelogramIdentifiers;
|
|
1308
|
+
}, {}> | Exercise<{
|
|
1309
|
+
paraIdentifiers: import("./math/geometry/quadrilaterals/parallelogram.js").ParallelogramIdentifiers;
|
|
1310
|
+
givenAngleIndex: number;
|
|
1311
|
+
askedAngleIndex: number;
|
|
1308
1312
|
}, {}> | Exercise<{
|
|
1309
1313
|
points: import("./math/geometry/point.js").PointIdentifiers[];
|
|
1310
1314
|
angleType: string;
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAG7D,OAAO,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,QAAA,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAG7D,OAAO,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AChC,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;IAkBzB,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;QACnB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB;CA2BF"}
|
|
@@ -176,7 +176,8 @@ export class Angle {
|
|
|
176
176
|
}
|
|
177
177
|
if (inRadian)
|
|
178
178
|
return round(angleRadians, 4);
|
|
179
|
-
|
|
179
|
+
const value = angleRadians * (180 / Math.PI);
|
|
180
|
+
return round(value > 180 ? 360 - value : value, 4);
|
|
180
181
|
}
|
|
181
182
|
getValueNode(inDegree = false) {
|
|
182
183
|
if (this.degreeValueNode || this.radianValueNode) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parallelogram.d.ts","sourceRoot":"","sources":["../../../../src/math/geometry/quadrilaterals/parallelogram.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"parallelogram.d.ts","sourceRoot":"","sources":["../../../../src/math/geometry/quadrilaterals/parallelogram.ts"],"names":[],"mappings":"AAEA,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"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { randfloat } from "../../../math/utils/random/randfloat.js";
|
|
2
|
+
import { coinFlip } from "../../../utils/alea/coinFlip.js";
|
|
2
3
|
import { Point, PointConstructor } from "../point.js";
|
|
3
4
|
import { Quadrilateral } from "./quadrilateral.js";
|
|
4
5
|
export class ParallelogramConstructor {
|
|
5
6
|
static random() {
|
|
6
7
|
const angle = randfloat(0, Math.PI / 2);
|
|
7
|
-
const
|
|
8
|
+
const additionalAngleDeg = 90 + (coinFlip() ? 1 : -1) * randfloat(10, 60);
|
|
9
|
+
const additionalAngle = additionalAngleDeg * (Math.PI / 180);
|
|
8
10
|
const xRand = randfloat(5, 8);
|
|
9
11
|
const xRand2 = randfloat(3, 8);
|
|
10
12
|
const origin = new Point("O", (0).toTree(), (0).toTree());
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { Angle } from "../angle.js";
|
|
1
2
|
import { Point } from "../point.js";
|
|
2
3
|
import { Segment } from "../segment.js";
|
|
3
4
|
export declare class Quadrilateral {
|
|
4
5
|
commands: string[];
|
|
5
6
|
points: Point[];
|
|
6
7
|
sides: Segment[];
|
|
8
|
+
angles: Angle[];
|
|
7
9
|
name: string;
|
|
8
10
|
constructor(points: Point[]);
|
|
9
11
|
drawDiagonals({ drawCenter, drawDecorations, }: {
|
|
@@ -11,5 +13,9 @@ export declare class Quadrilateral {
|
|
|
11
13
|
drawDecorations: boolean;
|
|
12
14
|
}): void;
|
|
13
15
|
toGGBCommands(): string[];
|
|
16
|
+
drawAngle(index: number, opts?: {
|
|
17
|
+
color?: string;
|
|
18
|
+
showValue?: boolean;
|
|
19
|
+
}): void;
|
|
14
20
|
}
|
|
15
21
|
//# sourceMappingURL=quadrilateral.d.ts.map
|
|
@@ -1 +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;
|
|
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,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,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;gBACD,MAAM,EAAE,KAAK,EAAE;IA6B3B,aAAa,CAAC,EACZ,UAAkB,EAClB,eAAuB,GACxB,EAAE;QACD,UAAU,EAAE,OAAO,CAAC;QACpB,eAAe,EAAE,OAAO,CAAC;KAC1B;IAcD,aAAa;IAIb,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE;CAGxE"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { Angle } from "../angle.js";
|
|
1
2
|
import { Segment } from "../segment.js";
|
|
2
3
|
export class Quadrilateral {
|
|
3
4
|
commands;
|
|
4
5
|
points;
|
|
5
6
|
sides;
|
|
7
|
+
angles;
|
|
6
8
|
name;
|
|
7
9
|
constructor(points) {
|
|
8
10
|
if (points.length !== 4)
|
|
@@ -15,6 +17,12 @@ export class Quadrilateral {
|
|
|
15
17
|
new Segment(points[2], points[3]),
|
|
16
18
|
new Segment(points[3], points[0]),
|
|
17
19
|
];
|
|
20
|
+
this.angles = [
|
|
21
|
+
new Angle([points[3], points[0], points[1]]),
|
|
22
|
+
new Angle([points[0], points[1], points[2]]),
|
|
23
|
+
new Angle([points[1], points[2], points[3]]),
|
|
24
|
+
new Angle([points[2], points[3], points[0]]),
|
|
25
|
+
];
|
|
18
26
|
this.commands = [
|
|
19
27
|
...points.flatMap((p) => p.toGGBCommand({
|
|
20
28
|
isFixed: true,
|
|
@@ -35,4 +43,7 @@ export class Quadrilateral {
|
|
|
35
43
|
toGGBCommands() {
|
|
36
44
|
return this.commands;
|
|
37
45
|
}
|
|
46
|
+
drawAngle(index, opts) {
|
|
47
|
+
this.commands.push(...this.angles[index].toCommands(opts));
|
|
48
|
+
}
|
|
38
49
|
}
|
|
@@ -78,7 +78,7 @@ export class Triangle {
|
|
|
78
78
|
this.props = props;
|
|
79
79
|
this.name = points.map((p) => p.name).join("");
|
|
80
80
|
this.points = points;
|
|
81
|
-
const anglePoints = [points[0], points[
|
|
81
|
+
const anglePoints = [points[0], points[1], points[2]];
|
|
82
82
|
this.angles = [
|
|
83
83
|
new Angle(arrayRotation(anglePoints, 2), {
|
|
84
84
|
radianValueNode: props?.anglesRadianValues?.[0],
|
|
@@ -166,7 +166,7 @@ export class Triangle {
|
|
|
166
166
|
showSidesLength(hiddenSides) {
|
|
167
167
|
this.commands.push(...this.sides
|
|
168
168
|
.filter((s, i) => !hiddenSides?.includes(i))
|
|
169
|
-
.flatMap((s) => s.getFitCaptionCommands()));
|
|
169
|
+
.flatMap((s) => s.getFitCaptionCommands({ size: "scriptsize" })));
|
|
170
170
|
}
|
|
171
171
|
getHeight(summitIndex, opts) {
|
|
172
172
|
const base = LineConstructor.fromSegment(this.sides[summitIndex]);
|