math-exercises 3.0.152 → 3.0.153
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/exercise.d.ts +2 -0
- package/lib/exercises/exercise.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/index.d.ts +1 -1
- package/lib/exercises/math/calculLitteral/equation/index.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/index.js +1 -1
- package/lib/exercises/math/calculLitteral/equation/square/equationSimpleSquare.d.ts +10 -0
- package/lib/exercises/math/calculLitteral/equation/square/equationSimpleSquare.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/equation/square/equationSimpleSquare.js +183 -0
- package/lib/exercises/math/calculLitteral/equation/square/equationSquareWithSteps.d.ts +10 -0
- package/lib/exercises/math/calculLitteral/equation/square/equationSquareWithSteps.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/equation/square/equationSquareWithSteps.js +173 -0
- package/lib/exercises/math/calculLitteral/equation/square/index.d.ts +3 -0
- package/lib/exercises/math/calculLitteral/equation/square/index.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/equation/square/index.js +2 -0
- package/lib/exercises/math/functions/sqrt/squareRootCalculation.d.ts.map +1 -1
- package/lib/exercises/math/functions/sqrt/squareRootCalculation.js +4 -2
- package/lib/exercises/math/geometry/euclidian/homothetyFactorFromPoints.d.ts +15 -0
- package/lib/exercises/math/geometry/euclidian/homothetyFactorFromPoints.d.ts.map +1 -0
- package/lib/exercises/math/geometry/euclidian/homothetyFactorFromPoints.js +301 -0
- package/lib/exercises/math/geometry/euclidian/index.d.ts +7 -0
- package/lib/exercises/math/geometry/euclidian/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/euclidian/index.js +7 -0
- package/lib/exercises/math/geometry/euclidian/pinPointFromAxialOrCentralSymmetry.d.ts +21 -0
- package/lib/exercises/math/geometry/euclidian/pinPointFromAxialOrCentralSymmetry.d.ts.map +1 -0
- package/lib/exercises/math/geometry/euclidian/pinPointFromAxialOrCentralSymmetry.js +406 -0
- package/lib/exercises/math/geometry/euclidian/pinPointFromRotation.d.ts +18 -0
- package/lib/exercises/math/geometry/euclidian/pinPointFromRotation.d.ts.map +1 -0
- package/lib/exercises/math/geometry/euclidian/pinPointFromRotation.js +315 -0
- package/lib/exercises/math/geometry/euclidian/pinPointFromTranslation.d.ts +20 -0
- package/lib/exercises/math/geometry/euclidian/pinPointFromTranslation.d.ts.map +1 -0
- package/lib/exercises/math/geometry/euclidian/pinPointFromTranslation.js +314 -0
- package/lib/exercises/math/geometry/euclidian/pinSegmentFromRotation.d.ts +18 -0
- package/lib/exercises/math/geometry/euclidian/pinSegmentFromRotation.d.ts.map +1 -0
- package/lib/exercises/math/geometry/euclidian/pinSegmentFromRotation.js +387 -0
- package/lib/exercises/math/geometry/euclidian/recognizeAngleFromRotation.d.ts +18 -0
- package/lib/exercises/math/geometry/euclidian/recognizeAngleFromRotation.d.ts.map +1 -0
- package/lib/exercises/math/geometry/euclidian/recognizeAngleFromRotation.js +309 -0
- package/lib/exercises/math/geometry/euclidian/recognizeHomothetyCenter.d.ts +17 -0
- package/lib/exercises/math/geometry/euclidian/recognizeHomothetyCenter.d.ts.map +1 -0
- package/lib/exercises/math/geometry/euclidian/recognizeHomothetyCenter.js +301 -0
- package/lib/exercises/math/geometry/euclidianConstructions/buildPointFromAxialSymetry.d.ts.map +1 -1
- package/lib/exercises/math/geometry/euclidianConstructions/buildPointFromAxialSymetry.js +22 -8
- package/lib/exercises/math/geometry/euclidianConstructions/buildPointFromCentralSymmetry.d.ts +11 -0
- package/lib/exercises/math/geometry/euclidianConstructions/buildPointFromCentralSymmetry.d.ts.map +1 -0
- package/lib/exercises/math/geometry/euclidianConstructions/buildPointFromCentralSymmetry.js +169 -0
- package/lib/exercises/math/geometry/euclidianConstructions/index.d.ts +2 -0
- package/lib/exercises/math/geometry/euclidianConstructions/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/euclidianConstructions/index.js +2 -0
- package/lib/exercises/math/geometry/euclidianConstructions/placeHomothetyCenter.d.ts +16 -0
- package/lib/exercises/math/geometry/euclidianConstructions/placeHomothetyCenter.d.ts.map +1 -0
- package/lib/exercises/math/geometry/euclidianConstructions/placeHomothetyCenter.js +309 -0
- package/lib/exercises/math/probaStat/stats1var/averageWithClasses.d.ts +9 -0
- package/lib/exercises/math/probaStat/stats1var/averageWithClasses.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/stats1var/averageWithClasses.js +140 -0
- package/lib/exercises/math/probaStat/stats1var/averageWithTableWithContext.d.ts +8 -0
- package/lib/exercises/math/probaStat/stats1var/averageWithTableWithContext.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/stats1var/averageWithTableWithContext.js +113 -0
- package/lib/exercises/math/probaStat/stats1var/index.d.ts +2 -0
- package/lib/exercises/math/probaStat/stats1var/index.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/index.js +2 -0
- package/lib/exercises/math/scratch/index.d.ts +3 -0
- package/lib/exercises/math/scratch/index.d.ts.map +1 -1
- package/lib/exercises/math/scratch/index.js +3 -0
- package/lib/exercises/math/scratch/scratchListElemAtIndex.d.ts +13 -0
- package/lib/exercises/math/scratch/scratchListElemAtIndex.d.ts.map +1 -0
- package/lib/exercises/math/scratch/scratchListElemAtIndex.js +189 -0
- package/lib/exercises/math/scratch/scratchListElemAtIndex2.d.ts +23 -0
- package/lib/exercises/math/scratch/scratchListElemAtIndex2.d.ts.map +1 -0
- package/lib/exercises/math/scratch/scratchListElemAtIndex2.js +207 -0
- package/lib/exercises/math/scratch/scratchListFilter.d.ts +13 -0
- package/lib/exercises/math/scratch/scratchListFilter.d.ts.map +1 -0
- package/lib/exercises/math/scratch/scratchListFilter.js +397 -0
- package/lib/exercises/math/spaceGeometry/basis/findSpacePointOnRectangularPrism.d.ts +14 -0
- package/lib/exercises/math/spaceGeometry/basis/findSpacePointOnRectangularPrism.d.ts.map +1 -0
- package/lib/exercises/math/spaceGeometry/basis/findSpacePointOnRectangularPrism.js +347 -0
- package/lib/exercises/math/spaceGeometry/basis/index.d.ts +1 -0
- package/lib/exercises/math/spaceGeometry/basis/index.d.ts.map +1 -1
- package/lib/exercises/math/spaceGeometry/basis/index.js +1 -0
- package/lib/exercises/math/spaceGeometry/index.d.ts +2 -0
- package/lib/exercises/math/spaceGeometry/index.d.ts.map +1 -1
- package/lib/exercises/math/spaceGeometry/index.js +2 -0
- package/lib/exercises/math/spaceGeometry/sections/areaOfConeSection.js +3 -3
- package/lib/exercises/math/spaceGeometry/solids/index.d.ts +3 -0
- package/lib/exercises/math/spaceGeometry/solids/index.d.ts.map +1 -0
- package/lib/exercises/math/spaceGeometry/solids/index.js +2 -0
- package/lib/exercises/math/spaceGeometry/solids/recognizeSolidFrom3D.d.ts +15 -0
- package/lib/exercises/math/spaceGeometry/solids/recognizeSolidFrom3D.d.ts.map +1 -0
- package/lib/exercises/math/spaceGeometry/solids/recognizeSolidFrom3D.js +440 -0
- package/lib/exercises/math/spaceGeometry/solids/recognizeSolidFromSolidPattern.d.ts +11 -0
- package/lib/exercises/math/spaceGeometry/solids/recognizeSolidFromSolidPattern.d.ts.map +1 -0
- package/lib/exercises/math/spaceGeometry/solids/recognizeSolidFromSolidPattern.js +1089 -0
- package/lib/exercises/math/spaceGeometry/sphere/index.d.ts +3 -0
- package/lib/exercises/math/spaceGeometry/sphere/index.d.ts.map +1 -0
- package/lib/exercises/math/spaceGeometry/sphere/index.js +2 -0
- package/lib/exercises/math/spaceGeometry/sphere/pickIsPointInSphereOrBall.d.ts +9 -0
- package/lib/exercises/math/spaceGeometry/sphere/pickIsPointInSphereOrBall.d.ts.map +1 -0
- package/lib/exercises/math/spaceGeometry/sphere/pickIsPointInSphereOrBall.js +127 -0
- package/lib/exercises/math/spaceGeometry/sphere/sphereLatLonReading.d.ts +14 -0
- package/lib/exercises/math/spaceGeometry/sphere/sphereLatLonReading.d.ts.map +1 -0
- package/lib/exercises/math/spaceGeometry/sphere/sphereLatLonReading.js +390 -0
- package/lib/geogebra/geogebraConstructor.d.ts +2 -0
- package/lib/geogebra/geogebraConstructor.d.ts.map +1 -1
- package/lib/geogebra/geogebraConstructor.js +6 -0
- package/lib/index.d.ts +178 -5
- package/lib/index.d.ts.map +1 -1
- package/lib/math/geometry/point.d.ts +6 -0
- package/lib/math/geometry/point.d.ts.map +1 -1
- package/lib/math/geometry/point.js +28 -0
- package/lib/tree/nodes/equations/equalNode.d.ts +1 -1
- package/lib/tree/nodes/equations/equalNode.d.ts.map +1 -1
- package/lib/tree/nodes/equations/equalNode.js +0 -1
- package/lib/tree/utilities/nodeSimplifier.d.ts +1 -1
- package/lib/utils/arrays/arrayZip.d.ts +2 -0
- package/lib/utils/arrays/arrayZip.d.ts.map +1 -0
- package/lib/utils/arrays/arrayZip.js +12 -0
- package/package.json +1 -1
|
@@ -0,0 +1,440 @@
|
|
|
1
|
+
import { shuffleProps, addValidProp, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { blueMain, greenMain, orange, pinkMain, purpleMain, red, } from "../../../../geogebra/colors.js";
|
|
4
|
+
import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
|
|
5
|
+
import { Point } from "../../../../math/geometry/point.js";
|
|
6
|
+
import { Segment } from "../../../../math/geometry/segment.js";
|
|
7
|
+
import { Vector, VectorConstructor } from "../../../../math/geometry/vector.js";
|
|
8
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
9
|
+
import { round } from "../../../../math/utils/round.js";
|
|
10
|
+
import { tan } from "../../../../tree/nodes/functions/tanNode.js";
|
|
11
|
+
import { PiNode } from "../../../../tree/nodes/numbers/piNode.js";
|
|
12
|
+
import { add } from "../../../../tree/nodes/operators/addNode.js";
|
|
13
|
+
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
14
|
+
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
15
|
+
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
16
|
+
import { random, randomMany } from "../../../../utils/alea/random.js";
|
|
17
|
+
const colors = [greenMain, orange, blueMain, pinkMain, purpleMain, red];
|
|
18
|
+
const createVector = (from, to, name, precision = 5) => {
|
|
19
|
+
return new Vector(name, round(substract(to.x, from.x).evaluate(), precision).toTree(), round(substract(to.y, from.y).evaluate(), precision).toTree());
|
|
20
|
+
};
|
|
21
|
+
const createPoint = (x, y, name, precision = 5) => {
|
|
22
|
+
return new Point(name, round(x, precision), round(y, precision));
|
|
23
|
+
};
|
|
24
|
+
const rotatePoint = (target, angle, center, name, precision = 2) => {
|
|
25
|
+
const vSrc = createVector(center, target, "vSrc", precision);
|
|
26
|
+
const vRotated = vSrc.rotate(angle, "vRotated");
|
|
27
|
+
return createPoint(add(center.x, vRotated.x).evaluate(), add(center.y, vRotated.y).evaluate(), name, precision);
|
|
28
|
+
};
|
|
29
|
+
const regularPolygonPoints = (iObj, segmentBase, nbSides) => {
|
|
30
|
+
const nodeApotheme = frac(segmentBase.getLength(), multiply(2, tan(frac(PiNode, nbSides))));
|
|
31
|
+
const vecAB = VectorConstructor.fromPoints(segmentBase.pointA, segmentBase.pointB);
|
|
32
|
+
const vecOrth = vecAB.getOrthogonal();
|
|
33
|
+
const vecOrthUnit = vecOrth.times(frac(1, vecOrth.getNorm()));
|
|
34
|
+
const pointCenter = vecOrthUnit
|
|
35
|
+
.times(nodeApotheme)
|
|
36
|
+
.getEndPoint(segmentBase.getMidpoint());
|
|
37
|
+
const angleBase = frac(multiply(2, PiNode), nbSides).evaluate();
|
|
38
|
+
const points = [...Array(nbSides).keys()].map((i) => {
|
|
39
|
+
return rotatePoint(segmentBase.pointA, i * angleBase, pointCenter, `P_${iObj}_${i}`, 5);
|
|
40
|
+
});
|
|
41
|
+
return points;
|
|
42
|
+
};
|
|
43
|
+
const ggbCommandRectangularPrism = (indexColor, L, l, h) => {
|
|
44
|
+
return [
|
|
45
|
+
//points
|
|
46
|
+
`A = Point({${L},${l},${h}})`,
|
|
47
|
+
`B = Point({${L},0,${h}})`,
|
|
48
|
+
`C = Point({0,0,${h}})`,
|
|
49
|
+
`D = Point({0,${l},${h}})`,
|
|
50
|
+
`E = Point({${L},${l},0})`,
|
|
51
|
+
//prism
|
|
52
|
+
`Pri = Prism(A,B,C,D,E)`,
|
|
53
|
+
`SetColor(Pri, "${colors[indexColor]}")`,
|
|
54
|
+
`SetFilling(Pri, 0.36)`,
|
|
55
|
+
`SetLineThickness(Pri, 1)`,
|
|
56
|
+
//hide points
|
|
57
|
+
`SetVisibleInView(A,-1, false)`,
|
|
58
|
+
`SetVisibleInView(B,-1, false)`,
|
|
59
|
+
`SetVisibleInView(C,-1, false)`,
|
|
60
|
+
`SetVisibleInView(D,-1, false)`,
|
|
61
|
+
`SetVisibleInView(E,-1, false)`,
|
|
62
|
+
`SetVisibleInView(F,-1, false)`,
|
|
63
|
+
`SetVisibleInView(G,-1, false)`,
|
|
64
|
+
`SetVisibleInView(H,-1, false)`,
|
|
65
|
+
];
|
|
66
|
+
};
|
|
67
|
+
const boundingCoordsRectangularPrism = (L, l, h) => {
|
|
68
|
+
return {
|
|
69
|
+
xMin: 0,
|
|
70
|
+
yMin: 0,
|
|
71
|
+
zMin: 0,
|
|
72
|
+
xMax: L,
|
|
73
|
+
yMax: l,
|
|
74
|
+
zMax: h,
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
const ggbCommandPrismFromRegularPolygon = (indexColor, nbSides, l, h) => {
|
|
78
|
+
return [
|
|
79
|
+
//polygon
|
|
80
|
+
`PolBase = Polygon((${-l / 2.0}, 0), (${l / 2.0}, 0), ${nbSides})`,
|
|
81
|
+
//prism
|
|
82
|
+
`Pri = Prism(PolBase, ${h})`,
|
|
83
|
+
`SetColor(Pri, "${colors[indexColor]}")`,
|
|
84
|
+
`SetFilling(Pri, 0.36)`,
|
|
85
|
+
`SetLineThickness(Pri, 1)`,
|
|
86
|
+
`SetFixed(Pri, false, true)`,
|
|
87
|
+
];
|
|
88
|
+
};
|
|
89
|
+
const boundingCoordsPrismFromRegularPolygon = (nbSides, l, h) => {
|
|
90
|
+
const ySpan = (() => {
|
|
91
|
+
const pointA = new Point("A", l, 0);
|
|
92
|
+
const pointB = new Point("B", 0, 0);
|
|
93
|
+
const segmentBase = new Segment(pointA, pointB);
|
|
94
|
+
const points = regularPolygonPoints(0, segmentBase, nbSides);
|
|
95
|
+
const ySpan = Math.max(...points.map((point) => point.y.evaluate()));
|
|
96
|
+
return ySpan;
|
|
97
|
+
})();
|
|
98
|
+
return {
|
|
99
|
+
xMin: -ySpan / 2,
|
|
100
|
+
yMin: 0,
|
|
101
|
+
zMin: 0,
|
|
102
|
+
xMax: ySpan / 2,
|
|
103
|
+
yMax: ySpan,
|
|
104
|
+
zMax: h,
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
const ggbCommandPyramidFromRegularPolygon = (indexColor, nbSides, l, h) => {
|
|
108
|
+
return [
|
|
109
|
+
//polygon
|
|
110
|
+
`PolBase = Polygon((${-l / 2.0}, 0), (${l / 2.0}, 0), ${nbSides})`,
|
|
111
|
+
//prism
|
|
112
|
+
`Pyr = Pyramid(PolBase, ${h})`,
|
|
113
|
+
`SetColor(Pyr, "${colors[indexColor]}")`,
|
|
114
|
+
`SetFilling(Pyr, 0.36)`,
|
|
115
|
+
`SetLineThickness(Pyr, 1)`,
|
|
116
|
+
`SetFixed(Pyr, false, true)`,
|
|
117
|
+
];
|
|
118
|
+
};
|
|
119
|
+
const boundingCoordsPyramidFromRegularPolygon = (nbSides, l, h) => {
|
|
120
|
+
const ySpan = (() => {
|
|
121
|
+
const pointA = new Point("A", l, 0);
|
|
122
|
+
const pointB = new Point("B", 0, 0);
|
|
123
|
+
const segmentBase = new Segment(pointA, pointB);
|
|
124
|
+
const points = regularPolygonPoints(0, segmentBase, nbSides);
|
|
125
|
+
const ySpan = Math.max(...points.map((point) => point.y.evaluate()));
|
|
126
|
+
return ySpan;
|
|
127
|
+
})();
|
|
128
|
+
return {
|
|
129
|
+
xMin: -ySpan / 2,
|
|
130
|
+
yMin: 0,
|
|
131
|
+
zMin: 0,
|
|
132
|
+
xMax: ySpan / 2,
|
|
133
|
+
yMax: ySpan,
|
|
134
|
+
zMax: h,
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
const ggbCommandCylinder = (indexColor, l, h) => {
|
|
138
|
+
return [
|
|
139
|
+
//cylinder
|
|
140
|
+
`Cyl = Cylinder((0,0,${-h / 2.0}), (0,0,${h / 2.0}), ${l})`,
|
|
141
|
+
`SetColor(Cyl, "${colors[indexColor]}")`,
|
|
142
|
+
`SetFilling(Cyl, 0.36)`,
|
|
143
|
+
`SetLineThickness(Cyl, 1)`,
|
|
144
|
+
];
|
|
145
|
+
};
|
|
146
|
+
const boundingCoordsCylinder = (l, //radius
|
|
147
|
+
h) => {
|
|
148
|
+
return {
|
|
149
|
+
xMin: -l,
|
|
150
|
+
yMin: -l,
|
|
151
|
+
zMin: -h / 2,
|
|
152
|
+
xMax: l,
|
|
153
|
+
yMax: l,
|
|
154
|
+
zMax: h / 2,
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
const ggbCommandCone = (indexColor, l, h) => {
|
|
158
|
+
return [
|
|
159
|
+
//cone
|
|
160
|
+
`Con = Cone((0,0,0), (0,0,${h}), ${l})`,
|
|
161
|
+
`SetColor(Con, "${colors[indexColor]}")`,
|
|
162
|
+
`SetFilling(Con, 0.36)`,
|
|
163
|
+
`SetLineThickness(Con, 1)`,
|
|
164
|
+
];
|
|
165
|
+
};
|
|
166
|
+
const boundingCoordsCone = (l, //radius
|
|
167
|
+
h) => {
|
|
168
|
+
return {
|
|
169
|
+
xMin: -l,
|
|
170
|
+
yMin: -l,
|
|
171
|
+
zMin: 0,
|
|
172
|
+
xMax: l,
|
|
173
|
+
yMax: l,
|
|
174
|
+
zMax: h,
|
|
175
|
+
};
|
|
176
|
+
};
|
|
177
|
+
const ggbCommandSphere = (indexColor, l, _) => {
|
|
178
|
+
return [
|
|
179
|
+
//sphere
|
|
180
|
+
`Sph = Sphere((0,0,0), ${l})`,
|
|
181
|
+
`SetColor(Sph, "${colors[indexColor]}")`,
|
|
182
|
+
`SetFilling(Sph, 0.36)`,
|
|
183
|
+
`SetLineThickness(Sph, 1)`,
|
|
184
|
+
];
|
|
185
|
+
};
|
|
186
|
+
const boundingCoordsSphere = (l, //radius
|
|
187
|
+
_) => {
|
|
188
|
+
return {
|
|
189
|
+
xMin: -l,
|
|
190
|
+
yMin: -l,
|
|
191
|
+
zMin: -l,
|
|
192
|
+
xMax: l,
|
|
193
|
+
yMax: l,
|
|
194
|
+
zMax: l,
|
|
195
|
+
};
|
|
196
|
+
};
|
|
197
|
+
const solidFamilies = [
|
|
198
|
+
{
|
|
199
|
+
str: "un cube",
|
|
200
|
+
ggbCommandsFunc: (indexColor, L, l, h) => ggbCommandRectangularPrism(indexColor, L, l, h),
|
|
201
|
+
boundingCoordsFunc: (L, l, h) => boundingCoordsRectangularPrism(L, l, h),
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
str: "un pavé droit",
|
|
205
|
+
ggbCommandsFunc: (indexColor, L, l, h) => ggbCommandRectangularPrism(indexColor, L, l, h),
|
|
206
|
+
boundingCoordsFunc: (L, l, h) => boundingCoordsRectangularPrism(L, l, h),
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
str: "un prisme droit de polygone régulier",
|
|
210
|
+
ggbCommandsFunc: (indexColor, nbSides, l, h) => ggbCommandPrismFromRegularPolygon(indexColor, nbSides, l, h),
|
|
211
|
+
boundingCoordsFunc: (L, l, h) => boundingCoordsPrismFromRegularPolygon(L, l, h),
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
str: "une pyramide régulière",
|
|
215
|
+
ggbCommandsFunc: (indexColor, nbSides, l, h) => ggbCommandPyramidFromRegularPolygon(indexColor, nbSides, l, h),
|
|
216
|
+
boundingCoordsFunc: (nbSides, l, h) => boundingCoordsPyramidFromRegularPolygon(/*index,*/ nbSides, l, h),
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
str: "un cylindre",
|
|
220
|
+
ggbCommandsFunc: (indexColor, _, l, h) => ggbCommandCylinder(indexColor, l, h),
|
|
221
|
+
boundingCoordsFunc: (_, l, h) => boundingCoordsCylinder(l, h),
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
str: "un cône",
|
|
225
|
+
ggbCommandsFunc: (indexColor, _, l, h) => ggbCommandCone(indexColor, l, h),
|
|
226
|
+
boundingCoordsFunc: (_, l, h) => boundingCoordsCone(l, h),
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
str: "une sphère",
|
|
230
|
+
ggbCommandsFunc: (indexColor, _, l, h) => ggbCommandSphere(indexColor, l, h),
|
|
231
|
+
boundingCoordsFunc: (_, l, h) => boundingCoordsSphere(l, h),
|
|
232
|
+
},
|
|
233
|
+
];
|
|
234
|
+
const getInstruction = (_, opts) => {
|
|
235
|
+
return `Quel solide est ici représenté ${(() => {
|
|
236
|
+
switch (opts?.projection) {
|
|
237
|
+
case "1":
|
|
238
|
+
return "en $3$D";
|
|
239
|
+
case "3":
|
|
240
|
+
return "en perspective cavalière";
|
|
241
|
+
default:
|
|
242
|
+
return "";
|
|
243
|
+
}
|
|
244
|
+
})()} ?
|
|
245
|
+
|
|
246
|
+
${(() => {
|
|
247
|
+
switch (opts?.projection) {
|
|
248
|
+
case "1":
|
|
249
|
+
return "*On pourra tourner la fenêtre graphique.*";
|
|
250
|
+
default:
|
|
251
|
+
return "";
|
|
252
|
+
}
|
|
253
|
+
})()}`;
|
|
254
|
+
};
|
|
255
|
+
const getAnswer = (identifiers) => {
|
|
256
|
+
const { indexFamily } = identifiers;
|
|
257
|
+
const solidFamily = solidFamilies[indexFamily];
|
|
258
|
+
return solidFamily.str;
|
|
259
|
+
};
|
|
260
|
+
const getHint = () => {
|
|
261
|
+
return `Est-ce un solide de révolution ? Est-ce un prisme ?`;
|
|
262
|
+
};
|
|
263
|
+
const getCorrection = (identifiers) => {
|
|
264
|
+
return `C'est ${getAnswer(identifiers)}.`;
|
|
265
|
+
};
|
|
266
|
+
const getGGBOptions = (identifiers, optsIn) => {
|
|
267
|
+
const opts = optsIn ?? optsDefault;
|
|
268
|
+
const { indexFamily, L, l, h, indexColor } = identifiers;
|
|
269
|
+
const solidFamily = solidFamilies[indexFamily];
|
|
270
|
+
const commands = [
|
|
271
|
+
//hide xOyPlane
|
|
272
|
+
`SetFilling(xOyPlane, 0)`,
|
|
273
|
+
...solidFamily.ggbCommandsFunc(indexColor, L, l, h),
|
|
274
|
+
];
|
|
275
|
+
const projection = +opts.projection;
|
|
276
|
+
const ggb = new GeogebraConstructor({
|
|
277
|
+
commands,
|
|
278
|
+
forbidShiftDragZoom: projection === 0,
|
|
279
|
+
is3D: true,
|
|
280
|
+
projection,
|
|
281
|
+
projectionParam: projection === 1 ? 500 : undefined,
|
|
282
|
+
xAxis: {
|
|
283
|
+
hidden: true,
|
|
284
|
+
},
|
|
285
|
+
yAxis: {
|
|
286
|
+
hidden: true,
|
|
287
|
+
},
|
|
288
|
+
zAxis: {
|
|
289
|
+
hidden: true,
|
|
290
|
+
},
|
|
291
|
+
});
|
|
292
|
+
return ggb.getOptions({
|
|
293
|
+
coords: ggb.getAdaptedCoords(solidFamily.boundingCoordsFunc(L, l, h)),
|
|
294
|
+
});
|
|
295
|
+
};
|
|
296
|
+
const getPropositions = (n, { answer, ...identifiers }) => {
|
|
297
|
+
const propositions = [];
|
|
298
|
+
addValidProp(propositions, answer, "raw");
|
|
299
|
+
let arrStrWrong;
|
|
300
|
+
const { indexFamily } = identifiers;
|
|
301
|
+
switch (indexFamily) {
|
|
302
|
+
//avoid multiple possible answers
|
|
303
|
+
case 0:
|
|
304
|
+
case 1:
|
|
305
|
+
{
|
|
306
|
+
arrStrWrong = [
|
|
307
|
+
"une pyramide régulière",
|
|
308
|
+
"un cylindre",
|
|
309
|
+
"un cône",
|
|
310
|
+
"une sphère",
|
|
311
|
+
];
|
|
312
|
+
}
|
|
313
|
+
break;
|
|
314
|
+
default:
|
|
315
|
+
{
|
|
316
|
+
arrStrWrong = solidFamilies.map((Family) => Family.str);
|
|
317
|
+
}
|
|
318
|
+
break;
|
|
319
|
+
}
|
|
320
|
+
arrStrWrong.forEach((str) => {
|
|
321
|
+
tryToAddWrongProp(propositions, str, "raw");
|
|
322
|
+
});
|
|
323
|
+
return shuffleProps(propositions, n);
|
|
324
|
+
};
|
|
325
|
+
const getRecognizeSolidFrom3DQuestion = (opts) => {
|
|
326
|
+
const indexFamily = randint(0, solidFamilies.length);
|
|
327
|
+
let L;
|
|
328
|
+
let l;
|
|
329
|
+
let h;
|
|
330
|
+
switch (indexFamily) {
|
|
331
|
+
case 0:
|
|
332
|
+
{
|
|
333
|
+
L = 5;
|
|
334
|
+
l = 5;
|
|
335
|
+
h = 5;
|
|
336
|
+
}
|
|
337
|
+
break;
|
|
338
|
+
case 1:
|
|
339
|
+
{
|
|
340
|
+
[L, l, h] = randomMany([...Array(20).keys()].map((i) => i + 5), 3);
|
|
341
|
+
}
|
|
342
|
+
break;
|
|
343
|
+
case 2:
|
|
344
|
+
{
|
|
345
|
+
//L is nbSides
|
|
346
|
+
L = random([3, 5, 6, 7, 8]);
|
|
347
|
+
[l, h] = randomMany([...Array(20).keys()].map((i) => i + 5), 2);
|
|
348
|
+
}
|
|
349
|
+
break;
|
|
350
|
+
case 3:
|
|
351
|
+
{
|
|
352
|
+
//L is nbSides
|
|
353
|
+
L = random([3, 5, 6, 7, 8]);
|
|
354
|
+
l = random([...Array(20).keys()].map((i) => i + 5));
|
|
355
|
+
const nodeApotheme = frac(l, multiply(2, tan(frac(PiNode, L))));
|
|
356
|
+
const minHAsIntegerSharp = Math.ceil(nodeApotheme.evaluate());
|
|
357
|
+
const minHAsIntegerForEye = Math.ceil(1.5 * minHAsIntegerSharp);
|
|
358
|
+
h = randint(minHAsIntegerForEye, 2 * minHAsIntegerForEye);
|
|
359
|
+
}
|
|
360
|
+
break;
|
|
361
|
+
case 4:
|
|
362
|
+
{
|
|
363
|
+
//L is useless
|
|
364
|
+
L = 0;
|
|
365
|
+
[l, h] = randomMany([...Array(20).keys()].map((i) => i + 5), 2);
|
|
366
|
+
}
|
|
367
|
+
break;
|
|
368
|
+
case 5:
|
|
369
|
+
{
|
|
370
|
+
//L is useless
|
|
371
|
+
L = 0;
|
|
372
|
+
[l, h] = randomMany([...Array(20).keys()].map((i) => i + 5), 2);
|
|
373
|
+
h = h + 10;
|
|
374
|
+
}
|
|
375
|
+
break;
|
|
376
|
+
case 6:
|
|
377
|
+
{
|
|
378
|
+
L = 0;
|
|
379
|
+
h = 0;
|
|
380
|
+
l = 5;
|
|
381
|
+
}
|
|
382
|
+
break;
|
|
383
|
+
default:
|
|
384
|
+
throw new Error("Unsupported indexFamily: " + indexFamily);
|
|
385
|
+
}
|
|
386
|
+
const indexColor = randint(0, colors.length);
|
|
387
|
+
const identifiers = { indexFamily, L, l, h, indexColor };
|
|
388
|
+
return getQuestionFromIdentifiers(identifiers, opts);
|
|
389
|
+
};
|
|
390
|
+
const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
391
|
+
const question = {
|
|
392
|
+
instruction: getInstruction(identifiers, opts),
|
|
393
|
+
answer: getAnswer(identifiers, opts),
|
|
394
|
+
hint: getHint(identifiers, opts),
|
|
395
|
+
correction: getCorrection(identifiers, opts),
|
|
396
|
+
ggbOptions: getGGBOptions(identifiers, opts),
|
|
397
|
+
keys: [],
|
|
398
|
+
answerFormat: "raw",
|
|
399
|
+
identifiers,
|
|
400
|
+
options: opts,
|
|
401
|
+
};
|
|
402
|
+
return question;
|
|
403
|
+
};
|
|
404
|
+
const optsDefault = {
|
|
405
|
+
projection: "3",
|
|
406
|
+
};
|
|
407
|
+
export const recognizeSolidFromCavalierPerspective = {
|
|
408
|
+
id: "recognizeSolidFromCavalierPerspective",
|
|
409
|
+
connector: "=",
|
|
410
|
+
label: "Nommer un solide à partir de sa représentation en perspective cavalière",
|
|
411
|
+
isSingleStep: true,
|
|
412
|
+
generator: (nb) => getDistinctQuestions(() => getRecognizeSolidFrom3DQuestion({ projection: "3" }), nb),
|
|
413
|
+
qcmTimer: 60,
|
|
414
|
+
freeTimer: 60,
|
|
415
|
+
getPropositions,
|
|
416
|
+
subject: "Mathématiques",
|
|
417
|
+
getQuestionFromIdentifiers,
|
|
418
|
+
answerType: "QCU",
|
|
419
|
+
getHint,
|
|
420
|
+
getCorrection,
|
|
421
|
+
hasHintAndCorrection: true,
|
|
422
|
+
hasGeogebra: true,
|
|
423
|
+
};
|
|
424
|
+
export const recognizeSolidFrom3D = {
|
|
425
|
+
id: "recognizeSolidFrom3D",
|
|
426
|
+
connector: "=",
|
|
427
|
+
label: "Nommer un solide à partir de sa représentation $3$D",
|
|
428
|
+
isSingleStep: true,
|
|
429
|
+
generator: (nb) => getDistinctQuestions(() => getRecognizeSolidFrom3DQuestion({ projection: "1" }), nb),
|
|
430
|
+
qcmTimer: 60,
|
|
431
|
+
freeTimer: 60,
|
|
432
|
+
getPropositions,
|
|
433
|
+
subject: "Mathématiques",
|
|
434
|
+
getQuestionFromIdentifiers,
|
|
435
|
+
answerType: "QCU",
|
|
436
|
+
getHint,
|
|
437
|
+
getCorrection,
|
|
438
|
+
hasHintAndCorrection: true,
|
|
439
|
+
hasGeogebra: true,
|
|
440
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
indexFamily: number;
|
|
4
|
+
indexPattern: number;
|
|
5
|
+
L: number;
|
|
6
|
+
l: number;
|
|
7
|
+
h: number;
|
|
8
|
+
};
|
|
9
|
+
export declare const recognizeSolidFromSolidPattern: Exercise<Identifiers>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=recognizeSolidFromSolidPattern.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recognizeSolidFromSolidPattern.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/spaceGeometry/solids/recognizeSolidFromSolidPattern.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AA8qCrC,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA0JF,eAAO,MAAM,8BAA8B,EAAE,QAAQ,CAAC,WAAW,CAiBhE,CAAC"}
|