math-exercises 3.0.151 → 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 +7 -0
- package/lib/exercises/exercise.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionToPercentToDecimal.d.ts +5 -1
- package/lib/exercises/math/calcul/fractions/fractionToPercentToDecimal.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionToPercentToDecimal.js +92 -38
- package/lib/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.d.ts.map +1 -1
- package/lib/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.js +5 -1
- package/lib/exercises/math/calcul/proportionality/isTableProportional.d.ts.map +1 -1
- package/lib/exercises/math/calcul/proportionality/isTableProportional.js +7 -1
- package/lib/exercises/math/calcul/proportionality/isTableProportionalNonInteger.d.ts.map +1 -1
- package/lib/exercises/math/calcul/proportionality/isTableProportionalNonInteger.js +5 -1
- package/lib/exercises/math/calcul/proportionality/proportionalityTable.d.ts.map +1 -1
- package/lib/exercises/math/calcul/proportionality/proportionalityTable.js +5 -1
- package/lib/exercises/math/calcul/proportionality/proportionalityTableCoefficient.d.ts.map +1 -1
- package/lib/exercises/math/calcul/proportionality/proportionalityTableCoefficient.js +8 -2
- 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/dataRepresentations/histogram/histogramIsSameData.d.ts.map +1 -1
- package/lib/exercises/math/dataRepresentations/histogram/histogramIsSameData.js +7 -0
- package/lib/exercises/math/dataRepresentations/tableReading.d.ts.map +1 -1
- package/lib/exercises/math/dataRepresentations/tableReading.js +7 -0
- package/lib/exercises/math/functions/affines/affineAdjustment.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/affineAdjustment.js +7 -1
- package/lib/exercises/math/functions/affines/affineAdjustmentComplete.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/affineAdjustmentComplete.js +7 -1
- package/lib/exercises/math/functions/affines/affineAdjustmentRsquared.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/affineAdjustmentRsquared.js +7 -1
- package/lib/exercises/math/functions/basics/inverseImageFunctionTable.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/inverseImageFunctionTable.js +7 -1
- package/lib/exercises/math/functions/basics/placePointsFromValueTable.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/placePointsFromValueTable.js +7 -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/basicProbas/calculateProbaFromProbaLaw.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/basicProbas/calculateProbaFromProbaLaw.js +7 -0
- package/lib/exercises/math/probaStat/basicProbas/getMissingProbabilityValue.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/basicProbas/getMissingProbabilityValue.js +7 -0
- package/lib/exercises/math/probaStat/basicProbas/getMissingProbabilityValueMiddleSchool.d.ts +9 -0
- package/lib/exercises/math/probaStat/basicProbas/getMissingProbabilityValueMiddleSchool.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/basicProbas/getMissingProbabilityValueMiddleSchool.js +120 -0
- package/lib/exercises/math/probaStat/basicProbas/index.d.ts +2 -0
- package/lib/exercises/math/probaStat/basicProbas/index.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/basicProbas/index.js +2 -0
- package/lib/exercises/math/probaStat/basicProbas/pickEquiprobableTo.d.ts +12 -0
- package/lib/exercises/math/probaStat/basicProbas/pickEquiprobableTo.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/basicProbas/pickEquiprobableTo.js +374 -0
- package/lib/exercises/math/probaStat/probaFromTableNoContext.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/probaFromTableNoContext.js +7 -0
- package/lib/exercises/math/probaStat/probaFromTableWithContext.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/probaFromTableWithContext.js +7 -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/averageWithTable.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/averageWithTable.js +7 -1
- 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/calculateMeanFromFrequencies.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/calculateMeanFromFrequencies.js +7 -0
- package/lib/exercises/math/probaStat/stats1var/cumulativeSum.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/cumulativeSum.js +7 -0
- package/lib/exercises/math/probaStat/stats1var/etendueTable.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/etendueTable.js +7 -1
- package/lib/exercises/math/probaStat/stats1var/getQuartileProportionQuestion.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/getQuartileProportionQuestion.js +7 -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/probaStat/stats1var/interquartilesTable.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/interquartilesTable.js +5 -1
- package/lib/exercises/math/probaStat/stats1var/marginalAndConditionalFrequency.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/marginalAndConditionalFrequency.js +7 -0
- package/lib/exercises/math/probaStat/stats1var/medianWithList.d.ts +2 -0
- package/lib/exercises/math/probaStat/stats1var/medianWithList.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/medianWithList.js +67 -14
- package/lib/exercises/math/probaStat/stats1var/medianWithTable.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/medianWithTable.js +7 -1
- package/lib/exercises/math/probaStat/stats1var/quartiles.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/quartiles.js +7 -1
- package/lib/exercises/math/probaStat/stats1var/standardDeviationTable.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/standardDeviationTable.js +5 -1
- package/lib/exercises/math/probaStat/stats1var/varianceTable.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/varianceTable.js +5 -1
- package/lib/exercises/math/probaStat/stats2var/averagePoint.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats2var/averagePoint.js +7 -1
- package/lib/exercises/math/probaStat/twoStepExperiments/headsOrTailsTwiceOutcomes.d.ts +7 -0
- package/lib/exercises/math/probaStat/twoStepExperiments/headsOrTailsTwiceOutcomes.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/twoStepExperiments/headsOrTailsTwiceOutcomes.js +171 -0
- package/lib/exercises/math/probaStat/twoStepExperiments/headsOrTailsTwiceProbas.d.ts +7 -0
- package/lib/exercises/math/probaStat/twoStepExperiments/headsOrTailsTwiceProbas.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/twoStepExperiments/headsOrTailsTwiceProbas.js +155 -0
- package/lib/exercises/math/probaStat/twoStepExperiments/index.d.ts +3 -0
- package/lib/exercises/math/probaStat/twoStepExperiments/index.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/twoStepExperiments/index.js +3 -0
- package/lib/exercises/math/probaStat/twoStepExperiments/numberPoolTwiceProbas.d.ts +7 -0
- package/lib/exercises/math/probaStat/twoStepExperiments/numberPoolTwiceProbas.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/twoStepExperiments/numberPoolTwiceProbas.js +189 -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 +198 -6
- 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,406 @@
|
|
|
1
|
+
import { GeneratorOptionType, GeneratorOptionTarget, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { toolBarConstructor } from "../../../../exercises/utils/geogebra/toolBarConstructor.js";
|
|
3
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
4
|
+
import { blueMain, greenMain, orange } from "../../../../geogebra/colors.js";
|
|
5
|
+
import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
|
|
6
|
+
import { ggbPointToCoords } from "../../../../geogebra/parsers/ggbPointToCoords.js";
|
|
7
|
+
import { parseGGBPoints } from "../../../../geogebra/parsers/parseGGBPoints.js";
|
|
8
|
+
import { Point, PointConstructor, } from "../../../../math/geometry/point.js";
|
|
9
|
+
import { Vector, VectorConstructor } from "../../../../math/geometry/vector.js";
|
|
10
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
11
|
+
import { round } from "../../../../math/utils/round.js";
|
|
12
|
+
import { PiNode } from "../../../../tree/nodes/numbers/piNode.js";
|
|
13
|
+
import { add } from "../../../../tree/nodes/operators/addNode.js";
|
|
14
|
+
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
15
|
+
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
16
|
+
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
17
|
+
import { probaFlip } from "../../../../utils/alea/probaFlip.js";
|
|
18
|
+
import { random, randomMany } from "../../../../utils/alea/random.js";
|
|
19
|
+
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
20
|
+
import { arrayRotation } from "../../../../utils/arrays/rotation.js";
|
|
21
|
+
function createSnowflakeDict(namesPool, angleInDegreesOffset = 0) {
|
|
22
|
+
function* generateNames(namesPool) {
|
|
23
|
+
let i = 0;
|
|
24
|
+
while (i < namesPool.length) {
|
|
25
|
+
yield namesPool[i];
|
|
26
|
+
i++;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
const nameGen = generateNames(namesPool);
|
|
30
|
+
const pointOrigin = new Point(nameGen.next().value, 0, 0);
|
|
31
|
+
const baseLength = 1;
|
|
32
|
+
const pointsRound1 = (() => {
|
|
33
|
+
const anglesInDegrees = [...Array(6).keys()].map((i) => 60 * i + 30 + angleInDegreesOffset);
|
|
34
|
+
const radius = baseLength;
|
|
35
|
+
return anglesInDegrees.map((angleInDegrees) => PointConstructor.fromPointRadiusAndAngle(nameGen.next().value, pointOrigin, radius, angleInDegrees));
|
|
36
|
+
})();
|
|
37
|
+
const pointsRound2 = (() => {
|
|
38
|
+
const anglesInDegrees = [...Array(6).keys()].map((i) => 60 * i + 0 + angleInDegreesOffset);
|
|
39
|
+
const radius = (2 * baseLength * (Math.sqrt(3) / 2.0)).toTree();
|
|
40
|
+
return anglesInDegrees.map((angleInDegrees) => PointConstructor.fromPointRadiusAndAngle(nameGen.next().value, pointOrigin, radius, angleInDegrees));
|
|
41
|
+
})();
|
|
42
|
+
const segmentsRound1 = pointsRound1.map((pointRound1) => [
|
|
43
|
+
pointOrigin,
|
|
44
|
+
pointRound1,
|
|
45
|
+
]);
|
|
46
|
+
const pointsRound2Rotated1 = arrayRotation(pointsRound2, 1);
|
|
47
|
+
const segmentsRound2 = pointsRound1.flatMap((pointRound1, i) => [
|
|
48
|
+
[pointRound1, pointsRound2[i]],
|
|
49
|
+
[pointRound1, pointsRound2Rotated1[i]],
|
|
50
|
+
]);
|
|
51
|
+
return {
|
|
52
|
+
points: [pointOrigin, ...pointsRound1, ...pointsRound2],
|
|
53
|
+
segments: [...segmentsRound1, ...segmentsRound2],
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
const createVector = (from, to, name, precision = 8) => {
|
|
57
|
+
return new Vector(name, round(substract(to.x, from.x).evaluate(), precision).toTree(), round(substract(to.y, from.y).evaluate(), precision).toTree());
|
|
58
|
+
};
|
|
59
|
+
const createPoint = (x, y, name, precision = 8) => {
|
|
60
|
+
return new Point(name, round(x, precision), round(y, precision));
|
|
61
|
+
};
|
|
62
|
+
const rotatePoint = (target, angle, center, name, precision = 8) => {
|
|
63
|
+
const vSrc = createVector(center, target, "vSrc", precision);
|
|
64
|
+
const vRotated = vSrc.rotate(angle, "vRotated");
|
|
65
|
+
return createPoint(add(center.x, vRotated.x).evaluate(), add(center.y, vRotated.y).evaluate(), name, precision);
|
|
66
|
+
};
|
|
67
|
+
const getGGBCoreCommands = (identifiers) => {
|
|
68
|
+
const { pointsDict, segments } = identifiers;
|
|
69
|
+
const points = Object.values(pointsDict).map((pointIds) => PointConstructor.fromIdentifiers(pointIds));
|
|
70
|
+
return [
|
|
71
|
+
...points.flatMap((point) => [
|
|
72
|
+
...point.toGGBCommand(),
|
|
73
|
+
`SetVisibleInView(${point.name}, 1, false)`,
|
|
74
|
+
`T_{${point.name}} = Text("${point.name}", (${point.x.evaluate() + 0.15},${point.y.evaluate() + 0.15}), false, true, 0, 0)`,
|
|
75
|
+
]),
|
|
76
|
+
...segments.flatMap((segment) => {
|
|
77
|
+
const [A, B] = segment.split("");
|
|
78
|
+
return [
|
|
79
|
+
`S_{${segment}} = Segment(${A}, ${B})`,
|
|
80
|
+
`SetLineThickness(S_{${segment}},3)`,
|
|
81
|
+
];
|
|
82
|
+
}),
|
|
83
|
+
];
|
|
84
|
+
};
|
|
85
|
+
const getStrForTransformation = (transformationIds) => {
|
|
86
|
+
switch (transformationIds.type) {
|
|
87
|
+
case "axial": {
|
|
88
|
+
return `la symétrie axiale d'axe $(${transformationIds.point1.name}${transformationIds.point2.name})$`;
|
|
89
|
+
}
|
|
90
|
+
case "central": {
|
|
91
|
+
return `la symétrie centrale de centre $${transformationIds.point1.name}$`;
|
|
92
|
+
}
|
|
93
|
+
default:
|
|
94
|
+
throw new Error("Unsupported transformation type: " + transformationIds.type);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
const getInstruction = (identifiers) => {
|
|
98
|
+
const { namePointSrc, transformationIds } = identifiers;
|
|
99
|
+
return `Sur la figure ci-dessous, tous les losanges sont superposables.
|
|
100
|
+
Placer l'image du point $${namePointSrc}$ par ${getStrForTransformation(transformationIds)}.`;
|
|
101
|
+
};
|
|
102
|
+
const getHint = (identifiers) => {
|
|
103
|
+
const { namePointSrc, transformationIds } = identifiers;
|
|
104
|
+
switch (transformationIds.type) {
|
|
105
|
+
case "axial": {
|
|
106
|
+
return `Visualise mentalement la droite $(${transformationIds.point1.name}${transformationIds.point2.name})$.
|
|
107
|
+
Est-ce que $${namePointSrc}$ appartient à cette droite ?`;
|
|
108
|
+
}
|
|
109
|
+
case "central": {
|
|
110
|
+
return `Visualise les points $${namePointSrc}$ et $${transformationIds.point1.name}$. Sont-ils confondus ?`;
|
|
111
|
+
}
|
|
112
|
+
default:
|
|
113
|
+
throw new Error("Unsupported transformation type: " + transformationIds.type);
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
const getCorrection = (identifiers) => {
|
|
117
|
+
const { namePointSrc, namePointDst, transformationIds } = identifiers;
|
|
118
|
+
switch (transformationIds.type) {
|
|
119
|
+
case "axial": {
|
|
120
|
+
if (namePointSrc === namePointDst) {
|
|
121
|
+
return `On trace $(${transformationIds.point1.name}${transformationIds.point2.name})$.
|
|
122
|
+
$${namePointSrc}$ appartient à $(${transformationIds.point1.name}${transformationIds.point2.name})$.
|
|
123
|
+
Le symétrique est $${namePointSrc}$ lui-même.
|
|
124
|
+
`;
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
return `On trace $(${transformationIds.point1.name}${transformationIds.point2.name})$.
|
|
128
|
+
Si on note $${namePointSrc}'$ le symétrique de $${namePointSrc}$, alors $(${transformationIds.point1.name}${transformationIds.point2.name})$ est la médiatrice de $[${namePointSrc}${namePointSrc}']$.
|
|
129
|
+
Le symétrique de $${namePointSrc}$ est donc $${namePointDst}$.`;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
case "central": {
|
|
133
|
+
if (namePointSrc === namePointDst) {
|
|
134
|
+
return `$${namePointSrc}$ et $${transformationIds.point1.name}$ sont confondus. Le symétrique est $${namePointSrc}$ lui-même.`;
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
return `Si on note $${namePointSrc}'$ le symétrique de $${namePointSrc}$, alors $${transformationIds.point1.name}$ est le milieu de $[${namePointSrc}${namePointSrc}']$.
|
|
138
|
+
Le symétrique de $${namePointSrc}$ est donc $${namePointDst}$.`;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
default:
|
|
142
|
+
throw new Error("Unsupported transformation type: " + transformationIds.type);
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
const getAnswerPoint = (identifiers) => {
|
|
146
|
+
const { namePointDst, pointsDict } = identifiers;
|
|
147
|
+
const pointDst = PointConstructor.fromIdentifiers(pointsDict[namePointDst]);
|
|
148
|
+
return pointDst;
|
|
149
|
+
};
|
|
150
|
+
const getGGBAnswer = (identifiers) => {
|
|
151
|
+
const { transformationIds, namePointSrc, pointsDict } = identifiers;
|
|
152
|
+
const answerPoint = getAnswerPoint(identifiers);
|
|
153
|
+
const pointSrc = PointConstructor.fromIdentifiers(pointsDict[namePointSrc]);
|
|
154
|
+
const ggbAnswer = [
|
|
155
|
+
...getGGBCoreCommands(identifiers),
|
|
156
|
+
//pointSrc
|
|
157
|
+
`SetVisibleInView(T_${pointSrc.name}, 1, false)`,
|
|
158
|
+
`SetVisibleInView(${pointSrc.name}, 1, true)`,
|
|
159
|
+
...pointSrc.toGGBCommand({ color: `${blueMain}`, size: 5 }),
|
|
160
|
+
//transformation
|
|
161
|
+
...(() => {
|
|
162
|
+
switch (transformationIds.type) {
|
|
163
|
+
case "axial":
|
|
164
|
+
{
|
|
165
|
+
const [point1, point2] = [
|
|
166
|
+
transformationIds.point1,
|
|
167
|
+
transformationIds.point2,
|
|
168
|
+
].map((pointIds) => PointConstructor.fromIdentifiers(pointIds));
|
|
169
|
+
return [
|
|
170
|
+
//point1
|
|
171
|
+
`SetVisibleInView(T_${point1.name}, 1, false)`,
|
|
172
|
+
`SetVisibleInView(${point1.name}, 1, true)`,
|
|
173
|
+
...point1.toGGBCommand({ color: `${orange}`, size: 5 }),
|
|
174
|
+
//point2
|
|
175
|
+
`SetVisibleInView(T_${point2.name}, 1, false)`,
|
|
176
|
+
`SetVisibleInView(${point2.name}, 1, true)`,
|
|
177
|
+
...point2.toGGBCommand({ color: `${orange}`, size: 5 }),
|
|
178
|
+
//line
|
|
179
|
+
`L_{${point1.name}${point2.name}} = Line(${point1.name},${point2.name})`,
|
|
180
|
+
`SetColor(L_{${point1.name}${point2.name}}, "${orange}")`,
|
|
181
|
+
];
|
|
182
|
+
}
|
|
183
|
+
break;
|
|
184
|
+
case "central":
|
|
185
|
+
{
|
|
186
|
+
const pointCenter = PointConstructor.fromIdentifiers(transformationIds.point1);
|
|
187
|
+
return [
|
|
188
|
+
//pointCenter
|
|
189
|
+
`SetVisibleInView(T_${pointCenter.name}, 1, false)`,
|
|
190
|
+
`SetVisibleInView(${pointCenter.name}, 1, true)`,
|
|
191
|
+
...pointCenter.toGGBCommand({ color: `${orange}`, size: 5 }),
|
|
192
|
+
];
|
|
193
|
+
}
|
|
194
|
+
break;
|
|
195
|
+
default:
|
|
196
|
+
throw new Error("Unsupported transformation type: " + transformationIds.type);
|
|
197
|
+
}
|
|
198
|
+
})(),
|
|
199
|
+
//answer point
|
|
200
|
+
`SetVisibleInView(T_${answerPoint.name}, 1, false)`,
|
|
201
|
+
`SetVisibleInView(${answerPoint.name}, 1, true)`,
|
|
202
|
+
...answerPoint.toGGBCommand({ color: `${greenMain}`, size: 10 }),
|
|
203
|
+
];
|
|
204
|
+
return ggbAnswer;
|
|
205
|
+
};
|
|
206
|
+
const getCorrectionGGBOptions = (identifiers) => {
|
|
207
|
+
const points = Object.values(identifiers.pointsDict).map((p) => PointConstructor.fromIdentifiers(p));
|
|
208
|
+
const ggb = new GeogebraConstructor({
|
|
209
|
+
hideAxes: true,
|
|
210
|
+
isGridSimple: true,
|
|
211
|
+
commands: getGGBAnswer(identifiers),
|
|
212
|
+
fontSize: 16,
|
|
213
|
+
});
|
|
214
|
+
return ggb.getOptions({
|
|
215
|
+
coords: ggb.getCoordsForPoints(points),
|
|
216
|
+
});
|
|
217
|
+
};
|
|
218
|
+
const getStudentGGBOptions = (identifiers) => {
|
|
219
|
+
const points = Object.values(identifiers.pointsDict).map((p) => PointConstructor.fromIdentifiers(p));
|
|
220
|
+
const studentGGB = new GeogebraConstructor({
|
|
221
|
+
commands: getGGBCoreCommands(identifiers),
|
|
222
|
+
hideGrid: true,
|
|
223
|
+
hideAxes: true,
|
|
224
|
+
customToolBar: toolBarConstructor({
|
|
225
|
+
point: true,
|
|
226
|
+
}),
|
|
227
|
+
forbidShiftDragZoom: true,
|
|
228
|
+
});
|
|
229
|
+
return studentGGB.getOptions({
|
|
230
|
+
coords: studentGGB.getCoordsForPoints(points),
|
|
231
|
+
});
|
|
232
|
+
};
|
|
233
|
+
const isGGBAnswerValid = (ans, { ggbAnswer, ...identifiers }) => {
|
|
234
|
+
const isPointValid = () => {
|
|
235
|
+
const points = parseGGBPoints(ans)
|
|
236
|
+
.map((p) => ggbPointToCoords(p))
|
|
237
|
+
.map((coords, i) => new Point(`K_${i}`, coords.x, coords.y));
|
|
238
|
+
const answerPoint = getAnswerPoint(identifiers);
|
|
239
|
+
return points.some((point) => point.distanceTo(answerPoint) < 0.1);
|
|
240
|
+
};
|
|
241
|
+
return isPointValid();
|
|
242
|
+
};
|
|
243
|
+
const getPinPointFromAxialOrCentralSymmetryQuestion = (optsIn) => {
|
|
244
|
+
const opts = optsIn ?? optsDefault;
|
|
245
|
+
const namesPool = shuffle("ABCDEFGHIJKLMNPQRST".split(""));
|
|
246
|
+
const snowflakeDict = createSnowflakeDict(namesPool, randint(-30, 30));
|
|
247
|
+
const pointsDict = Object.fromEntries(snowflakeDict.points.map((point) => [point.name, point.toIdentifiers()]));
|
|
248
|
+
const segments = snowflakeDict.segments.map(([pointA, pointB]) => `${pointA.name}${pointB.name}`);
|
|
249
|
+
function createRandomTransformationIds(points) {
|
|
250
|
+
return random([
|
|
251
|
+
...(opts.typeTransformation.includes("axiale")
|
|
252
|
+
? [createRandomAxialTransformationIds]
|
|
253
|
+
: []),
|
|
254
|
+
...(opts.typeTransformation.includes("centrale")
|
|
255
|
+
? [createRandomCentralTransformationIds]
|
|
256
|
+
: []),
|
|
257
|
+
])(points);
|
|
258
|
+
}
|
|
259
|
+
function createRandomAxialTransformationIds(points) {
|
|
260
|
+
const [point1, point2] = randomMany(points, 2).map((point) => point.toIdentifiers());
|
|
261
|
+
return {
|
|
262
|
+
type: "axial",
|
|
263
|
+
point1,
|
|
264
|
+
point2,
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
function createRandomCentralTransformationIds(points) {
|
|
268
|
+
const point1 = random(points).toIdentifiers();
|
|
269
|
+
return {
|
|
270
|
+
type: "central",
|
|
271
|
+
point1,
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
function applyTransformation(transformationIds, pointSrc) {
|
|
275
|
+
switch (transformationIds.type) {
|
|
276
|
+
case "axial":
|
|
277
|
+
{
|
|
278
|
+
const [point1, point2] = [
|
|
279
|
+
transformationIds.point1,
|
|
280
|
+
transformationIds.point2,
|
|
281
|
+
].map((pointIds) => PointConstructor.fromIdentifiers(pointIds));
|
|
282
|
+
const vecURaw = VectorConstructor.fromPoints(point1, point2);
|
|
283
|
+
const vecUUnit = vecURaw.times(frac(1, vecURaw.getNorm().evaluate()).evaluate().toTree());
|
|
284
|
+
const vecVRaw = VectorConstructor.fromPoints(point1, rotatePoint(point2, frac(PiNode, 2).evaluate(), point1, "N"));
|
|
285
|
+
const vecVUnit = vecVRaw.times(frac(1, vecVRaw.getNorm().evaluate()).evaluate().toTree());
|
|
286
|
+
const vecSrc = VectorConstructor.fromPoints(point1, pointSrc);
|
|
287
|
+
const dotAx = vecSrc.scalarProduct(vecUUnit);
|
|
288
|
+
const dotPerp = vecSrc.scalarProduct(vecVUnit);
|
|
289
|
+
const vecDst = vecUUnit
|
|
290
|
+
.times(dotAx)
|
|
291
|
+
.add(vecVUnit.times(multiply(-1, dotPerp)));
|
|
292
|
+
const pointDst = vecDst.getEndPoint(point1, `${pointSrc}'`);
|
|
293
|
+
return pointDst;
|
|
294
|
+
}
|
|
295
|
+
break;
|
|
296
|
+
case "central":
|
|
297
|
+
{
|
|
298
|
+
const pointCenter = PointConstructor.fromIdentifiers(transformationIds.point1);
|
|
299
|
+
const vec = VectorConstructor.fromPoints(pointSrc, pointCenter);
|
|
300
|
+
return vec.getEndPoint(pointCenter, `${pointSrc}'`);
|
|
301
|
+
}
|
|
302
|
+
break;
|
|
303
|
+
default:
|
|
304
|
+
throw new Error("Unsupported transformation type: " + transformationIds.type);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
let transformationIdsCandidate;
|
|
308
|
+
let pointSrc;
|
|
309
|
+
let pointDst;
|
|
310
|
+
let counter = -1;
|
|
311
|
+
let isValidTransformationIds = false;
|
|
312
|
+
while (!isValidTransformationIds && counter < 100) {
|
|
313
|
+
counter++;
|
|
314
|
+
transformationIdsCandidate = createRandomTransformationIds(snowflakeDict.points);
|
|
315
|
+
const randomPointFresh = () => random(snowflakeDict.points.filter((point) => point.name !== transformationIdsCandidate.point1.name &&
|
|
316
|
+
point.name !== transformationIdsCandidate.point2?.name));
|
|
317
|
+
const randomPoint = () => random(snowflakeDict.points);
|
|
318
|
+
pointSrc = probaFlip(0.8) ? randomPointFresh() : randomPoint();
|
|
319
|
+
const pointDstFromTransformation = applyTransformation(transformationIdsCandidate, pointSrc);
|
|
320
|
+
const pointDstWrtExistingPoints = snowflakeDict.points.find((point) => {
|
|
321
|
+
const distance = point.distanceTo(pointDstFromTransformation);
|
|
322
|
+
return distance < 0.0001;
|
|
323
|
+
});
|
|
324
|
+
if (pointDstWrtExistingPoints) {
|
|
325
|
+
pointDst = pointDstWrtExistingPoints;
|
|
326
|
+
const isPointDstDifferentFromPointSrc = pointDst.name !== pointSrc.name;
|
|
327
|
+
if (opts.isForceDstDifferentFromSrc) {
|
|
328
|
+
isValidTransformationIds = isPointDstDifferentFromPointSrc;
|
|
329
|
+
}
|
|
330
|
+
else {
|
|
331
|
+
isValidTransformationIds = probaFlip(0.6)
|
|
332
|
+
? isPointDstDifferentFromPointSrc
|
|
333
|
+
: true;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
if (!isValidTransformationIds) {
|
|
338
|
+
const defaultTransformationIds = {
|
|
339
|
+
type: "central",
|
|
340
|
+
point1: snowflakeDict.points[0].toIdentifiers(),
|
|
341
|
+
};
|
|
342
|
+
transformationIdsCandidate = defaultTransformationIds;
|
|
343
|
+
pointSrc = snowflakeDict.points[1];
|
|
344
|
+
pointDst = snowflakeDict.points[4];
|
|
345
|
+
}
|
|
346
|
+
const identifiers = {
|
|
347
|
+
pointsDict,
|
|
348
|
+
segments,
|
|
349
|
+
transformationIds: transformationIdsCandidate,
|
|
350
|
+
namePointSrc: pointSrc.name,
|
|
351
|
+
namePointDst: pointDst.name,
|
|
352
|
+
};
|
|
353
|
+
return getQuestionFromIdentifiers(identifiers, opts);
|
|
354
|
+
};
|
|
355
|
+
const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
356
|
+
const question = {
|
|
357
|
+
ggbAnswer: getGGBAnswer(identifiers),
|
|
358
|
+
instruction: getInstruction(identifiers),
|
|
359
|
+
keys: [],
|
|
360
|
+
answerFormat: "tex",
|
|
361
|
+
identifiers,
|
|
362
|
+
studentGgbOptions: getStudentGGBOptions(identifiers),
|
|
363
|
+
hint: getHint(identifiers),
|
|
364
|
+
correction: getCorrection(identifiers),
|
|
365
|
+
correctionGgbOptions: getCorrectionGGBOptions(identifiers),
|
|
366
|
+
options: opts,
|
|
367
|
+
};
|
|
368
|
+
return question;
|
|
369
|
+
};
|
|
370
|
+
const options = [
|
|
371
|
+
{
|
|
372
|
+
id: "isForceDstDifferentFromSrc",
|
|
373
|
+
label: "Symétrique différent du point de départ",
|
|
374
|
+
type: GeneratorOptionType.checkbox,
|
|
375
|
+
target: GeneratorOptionTarget.generation,
|
|
376
|
+
defaultValue: false,
|
|
377
|
+
},
|
|
378
|
+
{
|
|
379
|
+
id: "typeTransformation",
|
|
380
|
+
label: "Type de symétrie",
|
|
381
|
+
type: GeneratorOptionType.multiselect,
|
|
382
|
+
target: GeneratorOptionTarget.generation,
|
|
383
|
+
values: ["axiale", "centrale"],
|
|
384
|
+
defaultValue: ["axiale", "centrale"],
|
|
385
|
+
},
|
|
386
|
+
];
|
|
387
|
+
const optsDefault = {
|
|
388
|
+
isForceDstDifferentFromSrc: false,
|
|
389
|
+
typeTransformation: ["axiale", "centrale"],
|
|
390
|
+
};
|
|
391
|
+
export const pinPointFromAxialOrCentralSymmetry = {
|
|
392
|
+
id: "pinPointFromAxialOrCentralSymmetry",
|
|
393
|
+
connector: "=",
|
|
394
|
+
label: "Placer l'image d'un point par une symétrie (axiale ou centrale)",
|
|
395
|
+
isSingleStep: true,
|
|
396
|
+
generator: (nb, opts) => getDistinctQuestions(() => getPinPointFromAxialOrCentralSymmetryQuestion(opts), nb),
|
|
397
|
+
options,
|
|
398
|
+
ggbTimer: 60,
|
|
399
|
+
isGGBAnswerValid,
|
|
400
|
+
subject: "Mathématiques",
|
|
401
|
+
answerType: "GGB",
|
|
402
|
+
getQuestionFromIdentifiers,
|
|
403
|
+
getHint,
|
|
404
|
+
getCorrection,
|
|
405
|
+
hasHintAndCorrection: true,
|
|
406
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { PointIdentifiers } from "../../../../math/geometry/point.js";
|
|
3
|
+
import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
|
|
4
|
+
type TransformationIdentifiers = {
|
|
5
|
+
type: string;
|
|
6
|
+
point1: PointIdentifiers;
|
|
7
|
+
angleInDegrees: NodeIdentifiers;
|
|
8
|
+
};
|
|
9
|
+
type Identifiers = {
|
|
10
|
+
pointsDict: Record<string, PointIdentifiers>;
|
|
11
|
+
segments: string[];
|
|
12
|
+
transformationIds: TransformationIdentifiers;
|
|
13
|
+
namePointSrc: string;
|
|
14
|
+
namePointDst: string;
|
|
15
|
+
};
|
|
16
|
+
export declare const pinPointFromRotation: Exercise<Identifiers>;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=pinPointFromRotation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pinPointFromRotation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/euclidian/pinPointFromRotation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AAOrC,OAAO,EAGL,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AAMtC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AA4J7C,KAAK,yBAAyB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,gBAAgB,CAAC;IACzB,cAAc,EAAE,eAAe,CAAC;CACjC,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAC7C,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,iBAAiB,EAAE,yBAAyB,CAAC;IAC7C,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAqSF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAetD,CAAC"}
|