math-exercises 3.0.100 → 3.0.101
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/geometry/euclidianConstructions/pointImageFromTranslation.d.ts.map +1 -1
- package/lib/exercises/math/geometry/euclidianConstructions/pointImageFromTranslation.js +41 -18
- package/lib/exercises/math/geometry/vectors/constructions/traceOppositeVector.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/constructions/traceOppositeVector.js +31 -6
- package/lib/exercises/math/geometry/vectors/constructions/traceVectorDifference.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/constructions/traceVectorDifference.js +50 -10
- package/lib/exercises/math/geometry/vectors/constructions/traceVectorMultiple.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/constructions/traceVectorMultiple.js +39 -6
- package/lib/exercises/math/geometry/vectors/constructions/traceVectorSum.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/constructions/traceVectorSum.js +44 -7
- package/package.json +1 -1
package/lib/exercises/math/geometry/euclidianConstructions/pointImageFromTranslation.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pointImageFromTranslation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/euclidianConstructions/pointImageFromTranslation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"pointImageFromTranslation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/euclidianConstructions/pointImageFromTranslation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAQrC,OAAO,EAGL,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AAMtC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,EAAE,CAAC;CAC7B,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAqKF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAiBpE,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { GeneratorOptionType, GeneratorOptionTarget, } from "../../../../exercises/exercise.js";
|
|
2
2
|
import { toolBarConstructor } from "../../../../exercises/utils/geogebra/toolBarConstructor.js";
|
|
3
3
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
4
|
+
import { red } from "../../../../geogebra/colors.js";
|
|
4
5
|
import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
|
|
5
6
|
import { approxEqual } from "../../../../geogebra/parsers/approxEqual.js";
|
|
6
7
|
import { ggbPointToCoords } from "../../../../geogebra/parsers/ggbPointToCoords.js";
|
|
@@ -23,18 +24,40 @@ const getEndPoint = (identifiers) => {
|
|
|
23
24
|
const end = vector.getEndPoint(startPoint, identifiers.startPoint + "'");
|
|
24
25
|
return end;
|
|
25
26
|
};
|
|
26
|
-
const getHint = (identifiers) => {
|
|
27
|
-
|
|
27
|
+
const getHint = (identifiers, opts) => {
|
|
28
|
+
const { points, startPoint, translationPoints } = identifiers;
|
|
29
|
+
const useVector = opts?.useVector;
|
|
30
|
+
if (useVector) {
|
|
31
|
+
const vector = translationPoints[0] + translationPoints[1];
|
|
32
|
+
return `Trace le vecteur $\\overrightarrow{${vector}}$ à partir du point $${startPoint}$.`;
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
const vector = translationPoints[0] + translationPoints[1];
|
|
36
|
+
return `À partir du point $${startPoint}$, déplace toi de la même façon que le déplacement de $${translationPoints[0]}$ vers $${translationPoints[1]}$.`;
|
|
37
|
+
}
|
|
28
38
|
};
|
|
29
|
-
const getCorrection = (identifiers) => {
|
|
30
|
-
|
|
39
|
+
const getCorrection = (identifiers, opts) => {
|
|
40
|
+
const { points, startPoint, translationPoints } = identifiers;
|
|
41
|
+
const useVector = opts?.useVector;
|
|
42
|
+
if (useVector) {
|
|
43
|
+
const vector = translationPoints[0] + translationPoints[1];
|
|
44
|
+
return `On se place à partir du point $${startPoint}$. On trace le vecteur $\\overrightarrow{${vector}}$. Le point d'arrivée est le point recherché.`;
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
return `On se place à partir du point $${startPoint}$. On se déplace de la même façon que le déplacement de $${translationPoints[0]}$ vers $${translationPoints[1]}$. Le point d'arrivée est le point recherché.`;
|
|
48
|
+
}
|
|
31
49
|
};
|
|
32
50
|
const getGGBAnswer = (identifiers) => {
|
|
33
|
-
|
|
51
|
+
const { points, startPoint, translationPoints } = identifiers;
|
|
52
|
+
const endPoint = getEndPoint(identifiers);
|
|
53
|
+
return [
|
|
54
|
+
...endPoint.toGGBCommand(),
|
|
55
|
+
`a = Vector(${startPoint}, ${endPoint.name})`,
|
|
56
|
+
`SetColor(a, "${red}")`,
|
|
57
|
+
];
|
|
34
58
|
};
|
|
35
59
|
const getStudentGGBOptions = (identifiers) => {
|
|
36
60
|
const points = identifiers.points.map((p) => PointConstructor.fromIdentifiers(p));
|
|
37
|
-
const end = getEndPoint(identifiers);
|
|
38
61
|
const ggb = new GeogebraConstructor({
|
|
39
62
|
hideAxes: true,
|
|
40
63
|
isGridSimple: true,
|
|
@@ -43,15 +66,11 @@ const getStudentGGBOptions = (identifiers) => {
|
|
|
43
66
|
size: 3,
|
|
44
67
|
style: 1,
|
|
45
68
|
})),
|
|
69
|
+
fontSize: 16,
|
|
46
70
|
});
|
|
47
|
-
const
|
|
71
|
+
const endPoint = getEndPoint(identifiers);
|
|
48
72
|
return ggb.getOptions({
|
|
49
|
-
coords: [
|
|
50
|
-
Math.min(endX - 2, -7),
|
|
51
|
-
Math.max(endX + 2, 7),
|
|
52
|
-
Math.min(endY - 2, -7),
|
|
53
|
-
Math.max(endY + 2, 7),
|
|
54
|
-
],
|
|
73
|
+
coords: ggb.getCoordsForPoints([...points, endPoint]),
|
|
55
74
|
});
|
|
56
75
|
};
|
|
57
76
|
const isGGBAnswerValid = (ans, { ggbAnswer }) => {
|
|
@@ -70,7 +89,7 @@ const getPointImageFromTranslationQuestion = (opts) => {
|
|
|
70
89
|
const points = [];
|
|
71
90
|
for (let i = 0; i < 4; i++) {
|
|
72
91
|
const name = String.fromCharCode(65 + i);
|
|
73
|
-
const newPoint = doWhile(() => PointConstructor.random(name, -
|
|
92
|
+
const newPoint = doWhile(() => PointConstructor.random(name, -3, 4), (p) => points.some((p2) => p.distanceTo(p2) < 2));
|
|
74
93
|
points.push(newPoint);
|
|
75
94
|
}
|
|
76
95
|
const startPoint = random(points).name;
|
|
@@ -78,8 +97,11 @@ const getPointImageFromTranslationQuestion = (opts) => {
|
|
|
78
97
|
random(points.filter((p) => p.name !== startPoint)).name,
|
|
79
98
|
];
|
|
80
99
|
translationPoints.push(random(points.filter((p) => p.name !== translationPoints[0])).name);
|
|
100
|
+
const pointsUsed = [startPoint, ...translationPoints];
|
|
81
101
|
const identifiers = {
|
|
82
|
-
points: points
|
|
102
|
+
points: points
|
|
103
|
+
.filter((p) => pointsUsed.includes(p.name))
|
|
104
|
+
.map((p) => p.toIdentifiers()),
|
|
83
105
|
startPoint,
|
|
84
106
|
translationPoints,
|
|
85
107
|
};
|
|
@@ -91,8 +113,8 @@ const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
|
91
113
|
instruction: getInstruction(identifiers, opts),
|
|
92
114
|
studentGgbOptions: getStudentGGBOptions(identifiers, opts),
|
|
93
115
|
identifiers,
|
|
94
|
-
|
|
95
|
-
|
|
116
|
+
hint: getHint(identifiers, opts),
|
|
117
|
+
correction: getCorrection(identifiers, opts),
|
|
96
118
|
};
|
|
97
119
|
return question;
|
|
98
120
|
};
|
|
@@ -102,6 +124,7 @@ const options = [
|
|
|
102
124
|
label: 'Utiliser le terme "translation de vecteur"',
|
|
103
125
|
type: GeneratorOptionType.checkbox,
|
|
104
126
|
target: GeneratorOptionTarget.instruction,
|
|
127
|
+
defaultValue: false,
|
|
105
128
|
},
|
|
106
129
|
];
|
|
107
130
|
export const pointImageFromTranslation = {
|
|
@@ -119,5 +142,5 @@ export const pointImageFromTranslation = {
|
|
|
119
142
|
answerType: "GGB",
|
|
120
143
|
options,
|
|
121
144
|
getQuestionFromIdentifiers,
|
|
122
|
-
|
|
145
|
+
hasHintAndCorrection: true,
|
|
123
146
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"traceOppositeVector.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/geometry/vectors/constructions/traceOppositeVector.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"traceOppositeVector.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/geometry/vectors/constructions/traceOppositeVector.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;AAOrC,OAAO,EAGL,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AAOtC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,eAAe,EAAE,MAAM,CAAC;IACxB,mBAAmB,EAAE,MAAM,EAAE,CAAC;CAC/B,CAAC;AAuJF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAkBrD,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { toolBarConstructor } from "../../../../../exercises/utils/geogebra/toolBarConstructor.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { red } from "../../../../../geogebra/colors.js";
|
|
3
4
|
import { GeogebraConstructor } from "../../../../../geogebra/geogebraConstructor.js";
|
|
4
5
|
import { ggbPointToCoords } from "../../../../../geogebra/parsers/ggbPointToCoords.js";
|
|
5
6
|
import { parseGGBPoints } from "../../../../../geogebra/parsers/parseGGBPoints.js";
|
|
@@ -23,19 +24,42 @@ $$
|
|
|
23
24
|
\\overrightarrow{${origin}K} = -\\overrightarrow{${vec}}
|
|
24
25
|
$$`;
|
|
25
26
|
};
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
const getHint = (identifiers) => {
|
|
28
|
+
const { startPointIndex, points, vectorPointsIndexes } = identifiers;
|
|
29
|
+
const origin = identifiers.points[startPointIndex].name;
|
|
30
|
+
const vec = `${identifiers.points[vectorPointsIndexes[0]].name}${identifiers.points[vectorPointsIndexes[1]].name}`;
|
|
31
|
+
return `Rappelle toi que $-\\overrightarrow{v}$ est le vecteur de même norme et de même direction que $\\overrightarrow{v}$, mais de sens opposé.`;
|
|
32
|
+
};
|
|
33
|
+
const getCorrection = (identifiers) => {
|
|
34
|
+
const { startPointIndex, points, vectorPointsIndexes } = identifiers;
|
|
35
|
+
const origin = identifiers.points[startPointIndex].name;
|
|
36
|
+
const vec = `${identifiers.points[vectorPointsIndexes[0]].name}${identifiers.points[vectorPointsIndexes[1]].name}`;
|
|
37
|
+
const trueVec = vec.split("").reverse().join("");
|
|
38
|
+
return `On se place au point $${origin}$. On trace à partir de ce point le vecteur $-\\overrightarrow{${vec}} = \\overrightarrow{${trueVec}}$. Le point d'arrivée est le point $K$ recherché.`;
|
|
39
|
+
};
|
|
28
40
|
const getGGBAnswer = (identifiers) => {
|
|
29
|
-
|
|
41
|
+
const { startPointIndex, points, vectorPointsIndexes } = identifiers;
|
|
42
|
+
const origin = identifiers.points[startPointIndex].name;
|
|
43
|
+
const vec = [
|
|
44
|
+
identifiers.points[vectorPointsIndexes[1]].name,
|
|
45
|
+
identifiers.points[vectorPointsIndexes[0]].name,
|
|
46
|
+
];
|
|
47
|
+
const endPoint = getSolutionPoint(identifiers);
|
|
48
|
+
return [
|
|
49
|
+
...endPoint.toGGBCommand(),
|
|
50
|
+
`a = Vector(${origin}, K)`,
|
|
51
|
+
`SetColor(a, "${red}")`,
|
|
52
|
+
];
|
|
30
53
|
};
|
|
31
54
|
const getStudentGGBOptions = (identifiers) => {
|
|
32
|
-
const commands = identifiers.points.flatMap((p) => PointConstructor.fromIdentifiers(p).toGGBCommand());
|
|
55
|
+
const commands = identifiers.points.flatMap((p) => PointConstructor.fromIdentifiers(p).toGGBCommand({ size: 4 }));
|
|
33
56
|
const ggb = new GeogebraConstructor({
|
|
34
57
|
commands,
|
|
35
58
|
customToolBar: toolBarConstructor({
|
|
36
59
|
point: true,
|
|
37
60
|
}),
|
|
38
61
|
hideAxes: true,
|
|
62
|
+
fontSize: 16,
|
|
39
63
|
});
|
|
40
64
|
const points = identifiers.points.map((p) => PointConstructor.fromIdentifiers(p));
|
|
41
65
|
const solutionPoint = getSolutionPoint(identifiers);
|
|
@@ -87,8 +111,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
|
|
|
87
111
|
instruction: getInstruction(identifiers),
|
|
88
112
|
studentGgbOptions: getStudentGGBOptions(identifiers),
|
|
89
113
|
identifiers,
|
|
90
|
-
|
|
91
|
-
|
|
114
|
+
hint: getHint(identifiers),
|
|
115
|
+
correction: getCorrection(identifiers),
|
|
92
116
|
};
|
|
93
117
|
return question;
|
|
94
118
|
};
|
|
@@ -107,4 +131,5 @@ export const traceOppositeVector = {
|
|
|
107
131
|
getStudentGGBOptions,
|
|
108
132
|
answerType: "GGB",
|
|
109
133
|
getQuestionFromIdentifiers,
|
|
134
|
+
hasHintAndCorrection: true,
|
|
110
135
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"traceVectorDifference.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/geometry/vectors/constructions/traceVectorDifference.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"traceVectorDifference.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/geometry/vectors/constructions/traceVectorDifference.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;AAOrC,OAAO,EAGL,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AAMtC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,eAAe,EAAE,MAAM,CAAC;IACxB,wBAAwB,EAAE,MAAM,EAAE,CAAC;IACnC,yBAAyB,EAAE,MAAM,EAAE,CAAC;CACrC,CAAC;AA4NF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,CAiBvD,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { toolBarConstructor } from "../../../../../exercises/utils/geogebra/toolBarConstructor.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { purpleDark, red } from "../../../../../geogebra/colors.js";
|
|
3
4
|
import { GeogebraConstructor } from "../../../../../geogebra/geogebraConstructor.js";
|
|
4
5
|
import { ggbPointToCoords } from "../../../../../geogebra/parsers/ggbPointToCoords.js";
|
|
5
6
|
import { parseGGBPoints } from "../../../../../geogebra/parsers/parseGGBPoints.js";
|
|
@@ -24,28 +25,66 @@ const getInstruction = (identifiers) => {
|
|
|
24
25
|
const secondVec = `${identifiers.points[secondVectorPointsIndexes[0]].name}${identifiers.points[secondVectorPointsIndexes[1]].name}`;
|
|
25
26
|
return `Placer le point $K$ tel que :
|
|
26
27
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
$$
|
|
29
|
+
\\overrightarrow{${origin}K} = \\overrightarrow{${firstVec}} - \\overrightarrow{${secondVec}}
|
|
30
|
+
$$`;
|
|
31
|
+
};
|
|
32
|
+
const getHint = (identifiers) => {
|
|
33
|
+
const { startPointIndex, firstVectorPointsIndexes, secondVectorPointsIndexes, points, } = identifiers;
|
|
34
|
+
const origin = identifiers.points[startPointIndex].name;
|
|
35
|
+
const firstVec = `${identifiers.points[firstVectorPointsIndexes[0]].name}${identifiers.points[firstVectorPointsIndexes[1]].name}`;
|
|
36
|
+
const secondVec = `${identifiers.points[secondVectorPointsIndexes[0]].name}${identifiers.points[secondVectorPointsIndexes[1]].name}`;
|
|
37
|
+
return `À partir du point $${origin}$, trace à la suite les vecteurs $\\overrightarrow{${firstVec}}$ et $-\\overrightarrow{${secondVec}}$. Rappelle toi que $-\\overrightarrow{v}$ est le vecteur de même norme et de même direction que $\\overrightarrow{v}$, mais de sens opposé.`;
|
|
38
|
+
};
|
|
39
|
+
const getCorrection = (identifiers) => {
|
|
40
|
+
const { startPointIndex, firstVectorPointsIndexes, secondVectorPointsIndexes, points, } = identifiers;
|
|
41
|
+
const origin = identifiers.points[startPointIndex].name;
|
|
42
|
+
const firstVec = `${identifiers.points[firstVectorPointsIndexes[0]].name}${identifiers.points[firstVectorPointsIndexes[1]].name}`;
|
|
43
|
+
const secondVec = `${identifiers.points[secondVectorPointsIndexes[0]].name}${identifiers.points[secondVectorPointsIndexes[1]].name}`;
|
|
44
|
+
return `On se place au point $${origin}$. On trace à partir de ce point le vecteur $\\overrightarrow{${firstVec}}$. Puis, à la suite, on trace le vecteur $-\\overrightarrow{${secondVec}} = \\overrightarrow{${secondVec
|
|
45
|
+
.split("")
|
|
46
|
+
.reverse()
|
|
47
|
+
.join("")}}$. Le point d'arrivée est le point $K$ recherché.`;
|
|
30
48
|
};
|
|
31
|
-
// const getHint: GetHint<Identifiers> = (identifiers) => {};
|
|
32
|
-
// const getCorrection: GetCorrection<Identifiers> = (identifiers) => {};
|
|
33
49
|
const getGGBAnswer = (identifiers) => {
|
|
34
|
-
|
|
50
|
+
const { startPointIndex, firstVectorPointsIndexes, secondVectorPointsIndexes, points, } = identifiers;
|
|
51
|
+
const origin = identifiers.points[startPointIndex].name;
|
|
52
|
+
const firstVec = [
|
|
53
|
+
identifiers.points[firstVectorPointsIndexes[0]].name,
|
|
54
|
+
identifiers.points[firstVectorPointsIndexes[1]].name,
|
|
55
|
+
];
|
|
56
|
+
const secondVec = [
|
|
57
|
+
identifiers.points[secondVectorPointsIndexes[0]].name,
|
|
58
|
+
identifiers.points[secondVectorPointsIndexes[1]].name,
|
|
59
|
+
];
|
|
60
|
+
const midPoint = `${origin}+Vector(${firstVec[0]}, ${firstVec[1]})`;
|
|
61
|
+
const endPoint = getSolutionPoint(identifiers);
|
|
62
|
+
return [
|
|
63
|
+
...endPoint.toGGBCommand(),
|
|
64
|
+
`a = Vector(${origin}, ${midPoint})`,
|
|
65
|
+
`SetColor(a, "${red}")`,
|
|
66
|
+
`b = Vector(${midPoint}, K)`,
|
|
67
|
+
`SetColor(b, "${purpleDark}")`,
|
|
68
|
+
];
|
|
35
69
|
};
|
|
36
70
|
const getStudentGGBOptions = (identifiers) => {
|
|
37
|
-
const
|
|
71
|
+
const { firstVectorPointsIndexes, secondVectorPointsIndexes, startPointIndex, } = identifiers;
|
|
72
|
+
const commands = identifiers.points.flatMap((p) => PointConstructor.fromIdentifiers(p).toGGBCommand({ size: 4 }));
|
|
38
73
|
const ggb = new GeogebraConstructor({
|
|
39
74
|
commands,
|
|
40
75
|
customToolBar: toolBarConstructor({
|
|
41
76
|
point: true,
|
|
42
77
|
}),
|
|
43
78
|
hideAxes: true,
|
|
79
|
+
fontSize: 16,
|
|
44
80
|
});
|
|
45
81
|
const points = identifiers.points.map((p) => PointConstructor.fromIdentifiers(p));
|
|
82
|
+
const firstVec = VectorConstructor.fromPoints(points[firstVectorPointsIndexes[0]], points[firstVectorPointsIndexes[1]]);
|
|
83
|
+
const origin = points[startPointIndex];
|
|
84
|
+
const midPoint = firstVec.getEndPoint(origin);
|
|
46
85
|
const solutionPoint = getSolutionPoint(identifiers);
|
|
47
86
|
return ggb.getOptions({
|
|
48
|
-
coords: ggb.getCoordsForPoints([...points, solutionPoint]),
|
|
87
|
+
coords: ggb.getCoordsForPoints([...points, solutionPoint, midPoint]),
|
|
49
88
|
});
|
|
50
89
|
};
|
|
51
90
|
const isGGBAnswerValid = (ans, { ggbAnswer, ...identifiers }) => {
|
|
@@ -100,8 +139,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
|
|
|
100
139
|
instruction: getInstruction(identifiers),
|
|
101
140
|
studentGgbOptions: getStudentGGBOptions(identifiers),
|
|
102
141
|
identifiers,
|
|
103
|
-
|
|
104
|
-
|
|
142
|
+
hint: getHint(identifiers),
|
|
143
|
+
correction: getCorrection(identifiers),
|
|
105
144
|
};
|
|
106
145
|
return question;
|
|
107
146
|
};
|
|
@@ -120,4 +159,5 @@ export const traceVectorDifference = {
|
|
|
120
159
|
getStudentGGBOptions,
|
|
121
160
|
answerType: "GGB",
|
|
122
161
|
getQuestionFromIdentifiers,
|
|
162
|
+
hasHintAndCorrection: true,
|
|
123
163
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"traceVectorMultiple.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/geometry/vectors/constructions/traceVectorMultiple.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"traceVectorMultiple.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/geometry/vectors/constructions/traceVectorMultiple.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;AAOrC,OAAO,EAGL,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AAOtC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,eAAe,EAAE,MAAM,CAAC;IACxB,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AA0KF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAkBrD,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { toolBarConstructor } from "../../../../../exercises/utils/geogebra/toolBarConstructor.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { purpleDark, red } from "../../../../../geogebra/colors.js";
|
|
3
4
|
import { GeogebraConstructor } from "../../../../../geogebra/geogebraConstructor.js";
|
|
4
5
|
import { ggbPointToCoords } from "../../../../../geogebra/parsers/ggbPointToCoords.js";
|
|
5
6
|
import { parseGGBPoints } from "../../../../../geogebra/parsers/parseGGBPoints.js";
|
|
@@ -23,19 +24,50 @@ $$
|
|
|
23
24
|
\\overrightarrow{${origin}K} = ${identifiers.coeff}\\overrightarrow{${vec}}
|
|
24
25
|
$$`;
|
|
25
26
|
};
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
const getHint = (identifiers) => {
|
|
28
|
+
const { startPointIndex, points, coeff, vectorPointsIndexes } = identifiers;
|
|
29
|
+
const origin = identifiers.points[startPointIndex].name;
|
|
30
|
+
const vec = `${identifiers.points[vectorPointsIndexes[0]].name}${identifiers.points[vectorPointsIndexes[1]].name}`;
|
|
31
|
+
return `Rappelle toi que $-\\overrightarrow{v}$ est le vecteur de même norme et de même direction que $\\overrightarrow{v}$, mais de sens opposé.`;
|
|
32
|
+
};
|
|
33
|
+
const getCorrection = (identifiers) => {
|
|
34
|
+
const { startPointIndex, points, coeff, vectorPointsIndexes } = identifiers;
|
|
35
|
+
const origin = identifiers.points[startPointIndex].name;
|
|
36
|
+
const vec = `${identifiers.points[vectorPointsIndexes[0]].name}${identifiers.points[vectorPointsIndexes[1]].name}`;
|
|
37
|
+
const trueVec = coeff < 0 ? vec.split("").reverse().join("") : vec;
|
|
38
|
+
return `On se place au point $${origin}$. On trace à partir de ce point le vecteur ${coeff < 0
|
|
39
|
+
? `$-\\overrightarrow{${vec}} = \\overrightarrow{${trueVec}}$`
|
|
40
|
+
: `$\\overrightarrow{${vec}}$`}, $${Math.abs(coeff)}$ fois à la suite. Le point d'arrivée est le point $K$ recherché.`;
|
|
41
|
+
};
|
|
28
42
|
const getGGBAnswer = (identifiers) => {
|
|
29
|
-
|
|
43
|
+
const { startPointIndex, points, coeff, vectorPointsIndexes } = identifiers;
|
|
44
|
+
const origin = identifiers.points[startPointIndex].name;
|
|
45
|
+
const vec = [
|
|
46
|
+
identifiers.points[vectorPointsIndexes[coeff < 0 ? 1 : 0]].name,
|
|
47
|
+
identifiers.points[vectorPointsIndexes[coeff < 0 ? 0 : 1]].name,
|
|
48
|
+
];
|
|
49
|
+
const endPoint = getSolutionPoint(identifiers);
|
|
50
|
+
const commands = [...endPoint.toGGBCommand()];
|
|
51
|
+
let midPoint = `${origin}`;
|
|
52
|
+
for (let i = 0; i < Math.abs(coeff); i++) {
|
|
53
|
+
const next = midPoint + `+Vector(${vec[0]}, ${vec[1]})`;
|
|
54
|
+
commands.push(...[
|
|
55
|
+
`a_${i} = Vector(${midPoint}, ${next})`,
|
|
56
|
+
`SetColor(a_${i}, "${i % 2 === 0 ? red : purpleDark}")`,
|
|
57
|
+
]);
|
|
58
|
+
midPoint = next;
|
|
59
|
+
}
|
|
60
|
+
return [...endPoint.toGGBCommand(), ...commands];
|
|
30
61
|
};
|
|
31
62
|
const getStudentGGBOptions = (identifiers) => {
|
|
32
|
-
const commands = identifiers.points.flatMap((p) => PointConstructor.fromIdentifiers(p).toGGBCommand());
|
|
63
|
+
const commands = identifiers.points.flatMap((p) => PointConstructor.fromIdentifiers(p).toGGBCommand({ size: 4 }));
|
|
33
64
|
const ggb = new GeogebraConstructor({
|
|
34
65
|
commands,
|
|
35
66
|
customToolBar: toolBarConstructor({
|
|
36
67
|
point: true,
|
|
37
68
|
}),
|
|
38
69
|
hideAxes: true,
|
|
70
|
+
fontSize: 16,
|
|
39
71
|
});
|
|
40
72
|
const points = identifiers.points.map((p) => PointConstructor.fromIdentifiers(p));
|
|
41
73
|
const solutionPoint = getSolutionPoint(identifiers);
|
|
@@ -92,8 +124,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
|
|
|
92
124
|
instruction: getInstruction(identifiers),
|
|
93
125
|
studentGgbOptions: getStudentGGBOptions(identifiers),
|
|
94
126
|
identifiers,
|
|
95
|
-
|
|
96
|
-
|
|
127
|
+
hint: getHint(identifiers),
|
|
128
|
+
correction: getCorrection(identifiers),
|
|
97
129
|
};
|
|
98
130
|
return question;
|
|
99
131
|
};
|
|
@@ -112,4 +144,5 @@ export const traceVectorMultiple = {
|
|
|
112
144
|
getStudentGGBOptions,
|
|
113
145
|
answerType: "GGB",
|
|
114
146
|
getQuestionFromIdentifiers,
|
|
147
|
+
hasHintAndCorrection: true,
|
|
115
148
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"traceVectorSum.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/geometry/vectors/constructions/traceVectorSum.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"traceVectorSum.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/geometry/vectors/constructions/traceVectorSum.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AAOrC,OAAO,EAGL,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AAMtC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,eAAe,EAAE,MAAM,CAAC;IACxB,wBAAwB,EAAE,MAAM,EAAE,CAAC;IACnC,yBAAyB,EAAE,MAAM,EAAE,CAAC;CACrC,CAAC;AA0NF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAiBhD,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { toolBarConstructor } from "../../../../../exercises/utils/geogebra/toolBarConstructor.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { purpleDark, red } from "../../../../../geogebra/colors.js";
|
|
3
4
|
import { GeogebraConstructor } from "../../../../../geogebra/geogebraConstructor.js";
|
|
4
5
|
import { ggbPointToCoords } from "../../../../../geogebra/parsers/ggbPointToCoords.js";
|
|
5
6
|
import { parseGGBPoints } from "../../../../../geogebra/parsers/parseGGBPoints.js";
|
|
@@ -28,24 +29,59 @@ $$
|
|
|
28
29
|
\\overrightarrow{${origin}K} = \\overrightarrow{${firstVec}} + \\overrightarrow{${secondVec}}
|
|
29
30
|
$$`;
|
|
30
31
|
};
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
const getHint = (identifiers) => {
|
|
33
|
+
const { startPointIndex, firstVectorPointsIndexes, secondVectorPointsIndexes, points, } = identifiers;
|
|
34
|
+
const origin = identifiers.points[startPointIndex].name;
|
|
35
|
+
const firstVec = `${identifiers.points[firstVectorPointsIndexes[0]].name}${identifiers.points[firstVectorPointsIndexes[1]].name}`;
|
|
36
|
+
const secondVec = `${identifiers.points[secondVectorPointsIndexes[0]].name}${identifiers.points[secondVectorPointsIndexes[1]].name}`;
|
|
37
|
+
return `À partir du point $${origin}$, trace à la suite les vecteurs $\\overrightarrow{${firstVec}}$ et $\\overrightarrow{${secondVec}}$.`;
|
|
38
|
+
};
|
|
39
|
+
const getCorrection = (identifiers) => {
|
|
40
|
+
const { startPointIndex, firstVectorPointsIndexes, secondVectorPointsIndexes, points, } = identifiers;
|
|
41
|
+
const origin = identifiers.points[startPointIndex].name;
|
|
42
|
+
const firstVec = `${identifiers.points[firstVectorPointsIndexes[0]].name}${identifiers.points[firstVectorPointsIndexes[1]].name}`;
|
|
43
|
+
const secondVec = `${identifiers.points[secondVectorPointsIndexes[0]].name}${identifiers.points[secondVectorPointsIndexes[1]].name}`;
|
|
44
|
+
return `On se place au point $${origin}$. On trace à partir de ce point le vecteur $\\overrightarrow{${firstVec}}$. Puis, à la suite, on trace le vecteur $\\overrightarrow{${secondVec}}$. Le point d'arrivée est le point $K$ recherché.`;
|
|
45
|
+
};
|
|
33
46
|
const getGGBAnswer = (identifiers) => {
|
|
34
|
-
|
|
47
|
+
const { startPointIndex, firstVectorPointsIndexes, secondVectorPointsIndexes, points, } = identifiers;
|
|
48
|
+
const origin = identifiers.points[startPointIndex].name;
|
|
49
|
+
const firstVec = [
|
|
50
|
+
identifiers.points[firstVectorPointsIndexes[0]].name,
|
|
51
|
+
identifiers.points[firstVectorPointsIndexes[1]].name,
|
|
52
|
+
];
|
|
53
|
+
const secondVec = [
|
|
54
|
+
identifiers.points[secondVectorPointsIndexes[0]].name,
|
|
55
|
+
identifiers.points[secondVectorPointsIndexes[1]].name,
|
|
56
|
+
];
|
|
57
|
+
const midPoint = `${origin}+Vector(${firstVec[0]}, ${firstVec[1]})`;
|
|
58
|
+
const endPoint = getSolutionPoint(identifiers);
|
|
59
|
+
return [
|
|
60
|
+
...endPoint.toGGBCommand(),
|
|
61
|
+
`a = Vector(${origin}, ${midPoint})`,
|
|
62
|
+
`SetColor(a, "${red}")`,
|
|
63
|
+
`b = Vector(${midPoint}, K)`,
|
|
64
|
+
`SetColor(b, "${purpleDark}")`,
|
|
65
|
+
];
|
|
35
66
|
};
|
|
36
67
|
const getStudentGGBOptions = (identifiers) => {
|
|
37
|
-
const
|
|
68
|
+
const { firstVectorPointsIndexes, secondVectorPointsIndexes, startPointIndex, } = identifiers;
|
|
69
|
+
const commands = identifiers.points.flatMap((p) => PointConstructor.fromIdentifiers(p).toGGBCommand({ size: 4 }));
|
|
38
70
|
const ggb = new GeogebraConstructor({
|
|
39
71
|
commands,
|
|
40
72
|
customToolBar: toolBarConstructor({
|
|
41
73
|
point: true,
|
|
42
74
|
}),
|
|
43
75
|
hideAxes: true,
|
|
76
|
+
fontSize: 16,
|
|
44
77
|
});
|
|
45
78
|
const points = identifiers.points.map((p) => PointConstructor.fromIdentifiers(p));
|
|
79
|
+
const firstVec = VectorConstructor.fromPoints(points[firstVectorPointsIndexes[0]], points[firstVectorPointsIndexes[1]]);
|
|
80
|
+
const origin = points[startPointIndex];
|
|
81
|
+
const midPoint = firstVec.getEndPoint(origin);
|
|
46
82
|
const solutionPoint = getSolutionPoint(identifiers);
|
|
47
83
|
return ggb.getOptions({
|
|
48
|
-
coords: ggb.getCoordsForPoints([...points, solutionPoint]),
|
|
84
|
+
coords: ggb.getCoordsForPoints([...points, solutionPoint, midPoint]),
|
|
49
85
|
});
|
|
50
86
|
};
|
|
51
87
|
const isGGBAnswerValid = (ans, { ggbAnswer, ...identifiers }) => {
|
|
@@ -100,8 +136,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
|
|
|
100
136
|
instruction: getInstruction(identifiers),
|
|
101
137
|
studentGgbOptions: getStudentGGBOptions(identifiers),
|
|
102
138
|
identifiers,
|
|
103
|
-
|
|
104
|
-
|
|
139
|
+
hint: getHint(identifiers),
|
|
140
|
+
correction: getCorrection(identifiers),
|
|
105
141
|
};
|
|
106
142
|
return question;
|
|
107
143
|
};
|
|
@@ -120,4 +156,5 @@ export const traceVectorSum = {
|
|
|
120
156
|
getStudentGGBOptions,
|
|
121
157
|
answerType: "GGB",
|
|
122
158
|
getQuestionFromIdentifiers,
|
|
159
|
+
hasHintAndCorrection: true,
|
|
123
160
|
};
|