math-exercises 2.2.77 → 2.2.78
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/buildPointFromAxialSymetry.d.ts +10 -0
- package/lib/exercises/math/geometry/euclidianConstructions/buildPointFromAxialSymetry.d.ts.map +1 -0
- package/lib/exercises/math/geometry/euclidianConstructions/buildPointFromAxialSymetry.js +107 -0
- package/lib/exercises/math/geometry/euclidianConstructions/index.d.ts +1 -0
- package/lib/exercises/math/geometry/euclidianConstructions/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/euclidianConstructions/index.js +1 -0
- package/lib/exercises/utils/geogebra/toGGBCommandsProps.d.ts +1 -0
- package/lib/exercises/utils/geogebra/toGGBCommandsProps.d.ts.map +1 -1
- package/lib/exercises/utils/geogebra/toolBarConstructor.js +2 -2
- package/lib/geogebra/parsers/parseGGBPoints.js +1 -1
- package/lib/index.d.ts +3 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/math/geometry/circle.d.ts +10 -0
- package/lib/math/geometry/circle.d.ts.map +1 -0
- package/lib/math/geometry/circle.js +33 -0
- package/lib/math/geometry/line.d.ts +1 -1
- package/lib/math/geometry/line.d.ts.map +1 -1
- package/lib/math/geometry/line.js +10 -7
- package/lib/math/geometry/point.d.ts +3 -0
- package/lib/math/geometry/point.d.ts.map +1 -1
- package/lib/math/geometry/point.js +11 -12
- package/package.json +1 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise";
|
|
2
|
+
import { LineIdentifiers } from "../../../../math/geometry/line";
|
|
3
|
+
import { PointIdentifiers } from "../../../../math/geometry/point";
|
|
4
|
+
type Identifiers = {
|
|
5
|
+
point: PointIdentifiers;
|
|
6
|
+
line: LineIdentifiers;
|
|
7
|
+
};
|
|
8
|
+
export declare const buildPointFromAxialSymetry: Exercise<Identifiers>;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=buildPointFromAxialSymetry.d.ts.map
|
package/lib/exercises/math/geometry/euclidianConstructions/buildPointFromAxialSymetry.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildPointFromAxialSymetry.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/euclidianConstructions/buildPointFromAxialSymetry.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAOlC,OAAO,EAGL,eAAe,EAChB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAGL,gBAAgB,EACjB,MAAM,2BAA2B,CAAC;AAEnC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,gBAAgB,CAAC;IACxB,IAAI,EAAE,eAAe,CAAC;CACvB,CAAC;AAiGF,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,WAAW,CAe5D,CAAC"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildPointFromAxialSymetry = void 0;
|
|
4
|
+
const toolBarConstructor_1 = require("../../../../exercises/utils/geogebra/toolBarConstructor");
|
|
5
|
+
const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
|
|
6
|
+
const geogebraConstructor_1 = require("../../../../geogebra/geogebraConstructor");
|
|
7
|
+
const ggbPointToCoords_1 = require("../../../../geogebra/parsers/ggbPointToCoords");
|
|
8
|
+
const parseGGBPoints_1 = require("../../../../geogebra/parsers/parseGGBPoints");
|
|
9
|
+
const circle_1 = require("../../../../math/geometry/circle");
|
|
10
|
+
const line_1 = require("../../../../math/geometry/line");
|
|
11
|
+
const point_1 = require("../../../../math/geometry/point");
|
|
12
|
+
const getInstruction = (identifiers) => {
|
|
13
|
+
return `Placer le point $A'$, symétrique du point $A$ par rapport à la droite $d$.`;
|
|
14
|
+
};
|
|
15
|
+
// const getHint : GetHint<Identifiers> = (identifiers)=>{
|
|
16
|
+
// }
|
|
17
|
+
// const getCorrection : GetCorrection<Identifiers> = (identifiers)=>{
|
|
18
|
+
// }
|
|
19
|
+
const getSolutionPoint = (identifiers) => {
|
|
20
|
+
const point = point_1.PointConstructor.fromIdentifiers(identifiers.point);
|
|
21
|
+
const line = line_1.LineConstructor.fromIdentifiers(identifiers.line);
|
|
22
|
+
return point.axialSymetric(line, "A'");
|
|
23
|
+
};
|
|
24
|
+
const getGGBAnswer = (identifiers) => {
|
|
25
|
+
const point = point_1.PointConstructor.fromIdentifiers(identifiers.point);
|
|
26
|
+
const sol = getSolutionPoint(identifiers);
|
|
27
|
+
const perp = new line_1.Line(point, sol);
|
|
28
|
+
const center = point.midpoint(sol);
|
|
29
|
+
const circle = new circle_1.Circle(center, point, "C");
|
|
30
|
+
return [
|
|
31
|
+
...sol.toGGBCommand(),
|
|
32
|
+
...perp.toGGBCommands(false),
|
|
33
|
+
...circle.toGGBCommands(false),
|
|
34
|
+
];
|
|
35
|
+
};
|
|
36
|
+
const getStudentGGBOptions = (identifiers) => {
|
|
37
|
+
const point = point_1.PointConstructor.fromIdentifiers(identifiers.point);
|
|
38
|
+
const line = line_1.LineConstructor.fromIdentifiers(identifiers.line);
|
|
39
|
+
const commands = [
|
|
40
|
+
...point.toGGBCommand(),
|
|
41
|
+
...line.toGGBCommands(false, {
|
|
42
|
+
showLabel: true,
|
|
43
|
+
}),
|
|
44
|
+
];
|
|
45
|
+
const sol = getSolutionPoint(identifiers);
|
|
46
|
+
const ggb = new geogebraConstructor_1.GeogebraConstructor({
|
|
47
|
+
commands,
|
|
48
|
+
hideAxes: true,
|
|
49
|
+
hideGrid: true,
|
|
50
|
+
customToolBar: (0, toolBarConstructor_1.toolBarConstructor)({
|
|
51
|
+
orthogonal: true,
|
|
52
|
+
circleTwoPoints: true,
|
|
53
|
+
point: true,
|
|
54
|
+
intersect: true,
|
|
55
|
+
}),
|
|
56
|
+
});
|
|
57
|
+
return ggb.getOptions({
|
|
58
|
+
coords: ggb.getCoordsForPoints([point, sol]),
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
const isGGBAnswerValid = (ans, { ggbAnswer, ...identifiers }) => {
|
|
62
|
+
const studentAns = ans.filter((c) => !["A"].includes(c[0]));
|
|
63
|
+
const points = (0, parseGGBPoints_1.parseGGBPoints)(studentAns)
|
|
64
|
+
.map((p) => (0, ggbPointToCoords_1.ggbPointToCoords)(p))
|
|
65
|
+
.map((coords) => new point_1.Point("K", coords.x, coords.y));
|
|
66
|
+
if (!points.length)
|
|
67
|
+
return false;
|
|
68
|
+
const solution = getSolutionPoint(identifiers);
|
|
69
|
+
if (points.some((p) => p.distanceTo(solution) < 0.001))
|
|
70
|
+
return true;
|
|
71
|
+
return false;
|
|
72
|
+
};
|
|
73
|
+
const getBuildPointFromAxialSymetryQuestion = () => {
|
|
74
|
+
const linePoints = point_1.PointConstructor.randomDifferent(2, {
|
|
75
|
+
names: ["B", "C"],
|
|
76
|
+
});
|
|
77
|
+
const line = new line_1.Line(linePoints[0], linePoints[1], "d");
|
|
78
|
+
const point = point_1.PointConstructor.random("A");
|
|
79
|
+
const identifiers = {
|
|
80
|
+
point: point.toIdentifiers(),
|
|
81
|
+
line: line.toIdentifiers(),
|
|
82
|
+
};
|
|
83
|
+
const question = {
|
|
84
|
+
ggbAnswer: getGGBAnswer(identifiers),
|
|
85
|
+
instruction: getInstruction(identifiers),
|
|
86
|
+
studentGgbOptions: getStudentGGBOptions(identifiers),
|
|
87
|
+
identifiers,
|
|
88
|
+
// hint: getHint(identifiers),
|
|
89
|
+
// correction: getCorrection(identifiers)
|
|
90
|
+
};
|
|
91
|
+
return question;
|
|
92
|
+
};
|
|
93
|
+
exports.buildPointFromAxialSymetry = {
|
|
94
|
+
id: "buildPointFromAxialSymetry",
|
|
95
|
+
label: "Construire le symétrique d'un point par rapport à une droite",
|
|
96
|
+
isSingleStep: true,
|
|
97
|
+
generator: (nb, opts) => (0, getDistinctQuestions_1.getDistinctQuestions)(() => getBuildPointFromAxialSymetryQuestion(opts), nb),
|
|
98
|
+
ggbTimer: 60,
|
|
99
|
+
isGGBAnswerValid,
|
|
100
|
+
subject: "Mathématiques",
|
|
101
|
+
// getHint,
|
|
102
|
+
getInstruction,
|
|
103
|
+
// getCorrection,
|
|
104
|
+
getGGBAnswer,
|
|
105
|
+
getStudentGGBOptions,
|
|
106
|
+
answerType: "GGB",
|
|
107
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/euclidianConstructions/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/euclidianConstructions/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC"}
|
|
@@ -17,3 +17,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./buildMediatriceWithCompass"), exports);
|
|
18
18
|
__exportStar(require("./buildTriangleWithSizes"), exports);
|
|
19
19
|
__exportStar(require("./pointImageFromTranslation"), exports);
|
|
20
|
+
__exportStar(require("./buildPointFromAxialSymetry"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toGGBCommandsProps.d.ts","sourceRoot":"","sources":["../../../../src/exercises/utils/geogebra/toGGBCommandsProps.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC"}
|
|
1
|
+
{"version":3,"file":"toGGBCommandsProps.d.ts","sourceRoot":"","sources":["../../../../src/exercises/utils/geogebra/toGGBCommandsProps.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC"}
|
|
@@ -5,14 +5,14 @@ const toolBarConstructor = (options) => {
|
|
|
5
5
|
let customToolBar = "0||6";
|
|
6
6
|
if (options.point)
|
|
7
7
|
customToolBar += "||1";
|
|
8
|
+
if (options.intersect)
|
|
9
|
+
customToolBar += "||5";
|
|
8
10
|
if (options.join)
|
|
9
11
|
customToolBar += "||2";
|
|
10
12
|
if (options.parallel)
|
|
11
13
|
customToolBar += "||3";
|
|
12
14
|
if (options.orthogonal)
|
|
13
15
|
customToolBar += "||4";
|
|
14
|
-
if (options.intersect)
|
|
15
|
-
customToolBar += "||5";
|
|
16
16
|
if (options.vector)
|
|
17
17
|
customToolBar += "||7";
|
|
18
18
|
if (options.circleTwoPoints)
|
|
@@ -4,7 +4,7 @@ exports.parseGGBPoints = void 0;
|
|
|
4
4
|
const deleteObjectNamesFromAnswer_1 = require("../deleteObjectNamesFromAnswer");
|
|
5
5
|
const parseGGBPoints = (commands) => {
|
|
6
6
|
const unnamed = (0, deleteObjectNamesFromAnswer_1.deleteObjectNamesFromAnswer)(commands);
|
|
7
|
-
const re =
|
|
7
|
+
const re = /^\([^,]*,[^)]*\)/;
|
|
8
8
|
return unnamed.filter((cmd) => !!cmd.match(re)?.length);
|
|
9
9
|
};
|
|
10
10
|
exports.parseGGBPoints = parseGGBPoints;
|
package/lib/index.d.ts
CHANGED
|
@@ -1186,6 +1186,9 @@ declare const mathExercises: (Exercise<{
|
|
|
1186
1186
|
}, {
|
|
1187
1187
|
useVector: boolean;
|
|
1188
1188
|
}> | Exercise<{
|
|
1189
|
+
point: import("./math/geometry/point").PointIdentifiers;
|
|
1190
|
+
line: import("./math/geometry/line").LineIdentifiers;
|
|
1191
|
+
}, {}> | Exercise<{
|
|
1189
1192
|
type: number;
|
|
1190
1193
|
commands: string[];
|
|
1191
1194
|
}, {}> | Exercise<{
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAG1D,OAAO,yBAAyB,CAAC;AAEjC,QAAA,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAG1D,OAAO,yBAAyB,CAAC;AAEjC,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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BCommandsProps } from "../../exercises/utils/geogebra/toGGBCommandsProps";
|
|
2
|
+
import { Point } from "./point";
|
|
3
|
+
export declare class Circle {
|
|
4
|
+
center: Point;
|
|
5
|
+
point: Point;
|
|
6
|
+
name: string;
|
|
7
|
+
constructor(center: Point, point: Point, name?: string);
|
|
8
|
+
toGGBCommands(shouldBuildPoints: boolean, { isFixed, showLabel, showUnderlyingPointsLabel, showUnderlyingPoints, }?: ToGGBCommandsProps): string[];
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=circle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"circle.d.ts","sourceRoot":"","sources":["../../../src/math/geometry/circle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mDAAmD,CAAC;AACvF,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,qBAAa,MAAM;IACjB,MAAM,EAAE,KAAK,CAAC;IACd,KAAK,EAAE,KAAK,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;gBACD,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,MAAM;IAMtD,aAAa,CACX,iBAAiB,EAAE,OAAO,EAC1B,EACE,OAAc,EACd,SAAiB,EACjB,yBAAgC,EAChC,oBAA2B,GAC5B,GAAE,kBAAuB;CAkC7B"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Circle = void 0;
|
|
4
|
+
class Circle {
|
|
5
|
+
constructor(center, point, name) {
|
|
6
|
+
this.center = center;
|
|
7
|
+
this.point = point;
|
|
8
|
+
this.name = name ?? "C";
|
|
9
|
+
}
|
|
10
|
+
toGGBCommands(shouldBuildPoints, { isFixed = true, showLabel = false, showUnderlyingPointsLabel = true, showUnderlyingPoints = true, } = {}) {
|
|
11
|
+
const commands = [];
|
|
12
|
+
if (shouldBuildPoints) {
|
|
13
|
+
const ACommands = this.center.toGGBCommand({
|
|
14
|
+
isFixed,
|
|
15
|
+
showLabel: showUnderlyingPointsLabel,
|
|
16
|
+
});
|
|
17
|
+
const BCommands = this.point.toGGBCommand({
|
|
18
|
+
isFixed,
|
|
19
|
+
showLabel: showUnderlyingPointsLabel,
|
|
20
|
+
});
|
|
21
|
+
commands.push(...ACommands, ...BCommands, `${this.name}=Circle(${this.center.name},${this.point.name})`);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
commands.push(`${this.name}=Circle(${this.center.toMathString()},${this.point.toMathString()})`);
|
|
25
|
+
}
|
|
26
|
+
commands.push(...[
|
|
27
|
+
`SetFixed(${this.name},${isFixed ? "true" : "false"})`,
|
|
28
|
+
`ShowLabel(${this.name},${showLabel ? "true" : "false"})`,
|
|
29
|
+
]);
|
|
30
|
+
return commands;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.Circle = Circle;
|
|
@@ -49,7 +49,7 @@ export declare class Line {
|
|
|
49
49
|
};
|
|
50
50
|
toTex(): string;
|
|
51
51
|
toTexNoLeftRight(): string;
|
|
52
|
-
toGGBCommands(shouldBuildPoints: boolean, { isFixed, showLabel, showUnderlyingPointsLabel, }?: ToGGBCommandsProps): string[];
|
|
52
|
+
toGGBCommands(shouldBuildPoints: boolean, { isFixed, showLabel, showUnderlyingPointsLabel, showUnderlyingPoints, }?: ToGGBCommandsProps): string[];
|
|
53
53
|
intersect(line: Line, intersectName?: string): Point;
|
|
54
54
|
}
|
|
55
55
|
//# sourceMappingURL=line.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"line.d.ts","sourceRoot":"","sources":["../../../src/math/geometry/line.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mDAAmD,CAAC;AAEvF,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,SAAS,EA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;IACd,MAAM,EAAE,KAAK,CAAC;IACd,UAAU,EAAE,OAAO,CAAC;IACpB,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC;IAC7B,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;gBACJ,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,MAAM;IAsBvD,aAAa;;;;;IAOb,WAAW,CAAC,IAAI,EAAE,IAAI;IAYtB,iBAAiB;IAIjB,YAAY,CAAC,KAAK,EAAE,KAAK;IAYzB,gBAAgB,CAAC,KAAK,EAAE,KAAK;IAW7B,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,WAAW,GAAE,OAAe;IAgBnD,aAAa,CAAC,CAAC,EAAE,aAAa,EAAE,IAAI,CAAC,EAAE,MAAM;IAK7C,aAAa,CAAC,CAAC,EAAE,aAAa,EAAE,IAAI,CAAC,EAAE,MAAM;IAW7C,cAAc,CAAC,IAAI,CAAC,EAAE,MAAM;IAa5B,WAAW,MAAO,MAAM,KAAK,KAAK,KAAG,SAAS,CAmB5C;IAEF,oBAAoB,IAAI,SAAS;IAuBjC,WAAW;IAMX,iBAAiB;;;;;IAcjB,KAAK;IAGL,gBAAgB;IAIhB,aAAa,CACX,iBAAiB,EAAE,OAAO,EAC1B,EACE,OAAc,EACd,SAAiB,EACjB,yBAAgC,EAChC,oBAA2B,GAC5B,GAAE,kBAAuB;IAmC5B,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,aAAa,CAAC,EAAE,MAAM;CAW7C"}
|
|
@@ -172,12 +172,8 @@ class Line {
|
|
|
172
172
|
toTexNoLeftRight() {
|
|
173
173
|
return this.name.replace("\\left", "").replace("\\right", "");
|
|
174
174
|
}
|
|
175
|
-
toGGBCommands(shouldBuildPoints, { isFixed = true, showLabel = false, showUnderlyingPointsLabel = true, } = {}) {
|
|
176
|
-
const commands = [
|
|
177
|
-
`${this.ggbName}=Line(${this.pointA.name},${this.pointB.name})`,
|
|
178
|
-
`SetFixed(${this.ggbName},${isFixed ? "true" : "false"})`,
|
|
179
|
-
`ShowLabel(${this.ggbName},${showLabel ? "true" : "false"})`,
|
|
180
|
-
];
|
|
175
|
+
toGGBCommands(shouldBuildPoints, { isFixed = true, showLabel = false, showUnderlyingPointsLabel = true, showUnderlyingPoints = true, } = {}) {
|
|
176
|
+
const commands = [];
|
|
181
177
|
if (shouldBuildPoints) {
|
|
182
178
|
const ACommands = this.pointA.toGGBCommand({
|
|
183
179
|
isFixed,
|
|
@@ -187,8 +183,15 @@ class Line {
|
|
|
187
183
|
isFixed,
|
|
188
184
|
showLabel: showUnderlyingPointsLabel,
|
|
189
185
|
});
|
|
190
|
-
commands.
|
|
186
|
+
commands.push(...ACommands, ...BCommands, `${this.ggbName}=Line(${this.pointA.name},${this.pointB.name})`);
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
commands.push(`${this.ggbName}=Line(${this.pointA.toMathString()},${this.pointB.toMathString()})`);
|
|
191
190
|
}
|
|
191
|
+
commands.push(...[
|
|
192
|
+
`SetFixed(${this.ggbName},${isFixed ? "true" : "false"})`,
|
|
193
|
+
`ShowLabel(${this.ggbName},${showLabel ? "true" : "false"})`,
|
|
194
|
+
]);
|
|
192
195
|
return commands;
|
|
193
196
|
}
|
|
194
197
|
intersect(line, intersectName) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AlgebraicNode } from "../../tree/nodes/algebraicNode";
|
|
2
2
|
import { ToGGBCommandsProps } from "../../exercises/utils/geogebra/toGGBCommandsProps";
|
|
3
3
|
import { NodeIdentifiers } from "../../tree/nodes/nodeConstructor";
|
|
4
|
+
import { Line } from "./line";
|
|
4
5
|
export type PointIdentifiers = {
|
|
5
6
|
id: "point";
|
|
6
7
|
name: string;
|
|
@@ -43,5 +44,7 @@ export declare class Point {
|
|
|
43
44
|
toGGBCommand({ isFixed, showLabel, style, size, color, }?: ToGGBCommandsProps): string[];
|
|
44
45
|
rotate(angle: number, center: Point): Point;
|
|
45
46
|
centralSymetric(center: Point, name?: string): Point;
|
|
47
|
+
project(line: Line, name?: string): Point;
|
|
48
|
+
axialSymetric(line: Line, name?: string): Point;
|
|
46
49
|
}
|
|
47
50
|
//# sourceMappingURL=point.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"point.d.ts","sourceRoot":"","sources":["../../../src/math/geometry/point.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAG/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,mDAAmD,CAAC;AACvF,OAAO,EAEL,eAAe,EAChB,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"point.d.ts","sourceRoot":"","sources":["../../../src/math/geometry/point.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAG/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,mDAAmD,CAAC;AACvF,OAAO,EAEL,eAAe,EAChB,MAAM,kCAAkC,CAAC;AAO1C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAG9B,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,EAAE,OAAO,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,eAAe,CAAC;IACnB,CAAC,EAAE,eAAe,CAAC;CACpB,CAAC;AACF,8BAAsB,gBAAgB;IACpC,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE;IAGrC,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,MAAM;IAKhC,MAAM,CAAC,MAAM,CAAC,IAAI,SAAM;IAGxB,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,SAAM,EAAE,GAAG,SAAK,GAAG,KAA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,kBAAuB;IAiB1B,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK;IAiBnC,eAAe,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,SAAkB;IAIrD,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,SAAkB;IAI1C,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,SAAkB;CAIjD"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Point = exports.PointConstructor = void 0;
|
|
4
|
-
const node_1 = require("../../tree/nodes/node");
|
|
5
4
|
const numberNode_1 = require("../../tree/nodes/numbers/numberNode");
|
|
6
|
-
const rational_1 = require("../numbers/rationals/rational");
|
|
7
5
|
const vector_1 = require("./vector");
|
|
8
6
|
const randint_1 = require("../utils/random/randint");
|
|
9
7
|
const nodeConstructor_1 = require("../../tree/nodes/nodeConstructor");
|
|
@@ -12,6 +10,7 @@ const substractNode_1 = require("../../tree/nodes/operators/substractNode");
|
|
|
12
10
|
const multiplyNode_1 = require("../../tree/nodes/operators/multiplyNode");
|
|
13
11
|
const addNode_1 = require("../../tree/nodes/operators/addNode");
|
|
14
12
|
const randomLetter_1 = require("../../utils/strings/randomLetter");
|
|
13
|
+
const fractionNode_1 = require("../../tree/nodes/operators/fractionNode");
|
|
15
14
|
class PointConstructor {
|
|
16
15
|
static randomName(excludes) {
|
|
17
16
|
return (0, randomLetter_1.randomLetter)(true, ["O", ...(excludes ?? [])]);
|
|
@@ -97,15 +96,7 @@ class Point {
|
|
|
97
96
|
return this.y.evaluate();
|
|
98
97
|
}
|
|
99
98
|
midpoint(B, name = "I") {
|
|
100
|
-
|
|
101
|
-
if (types.some((type) => type !== node_1.NodeType.number)) {
|
|
102
|
-
throw Error("general midpoint not implemented yet");
|
|
103
|
-
}
|
|
104
|
-
return new Point(name, new rational_1.Rational(this.x.value + B.x.value, 2)
|
|
105
|
-
.simplify()
|
|
106
|
-
.toTree(), new rational_1.Rational(this.y.value + B.y.value, 2)
|
|
107
|
-
.simplify()
|
|
108
|
-
.toTree());
|
|
99
|
+
return new Point(name, (0, fractionNode_1.frac)((0, addNode_1.add)(this.x, B.x), 2).simplify(), (0, fractionNode_1.frac)((0, addNode_1.add)(this.y, B.y), 2).simplify());
|
|
109
100
|
}
|
|
110
101
|
distanceTo(B) {
|
|
111
102
|
const dx = this.getXnumber() - B.getXnumber();
|
|
@@ -148,8 +139,16 @@ class Point {
|
|
|
148
139
|
return new Point(this.name, (0, substractNode_1.substract)((0, multiplyNode_1.multiply)(cos, this.x).simplify(), (0, multiplyNode_1.multiply)(sin, this.y).simplify()).simplify(), (0, addNode_1.add)((0, multiplyNode_1.multiply)(sin, this.x).simplify(), (0, multiplyNode_1.multiply)(cos, this.y).simplify()).simplify());
|
|
149
140
|
}
|
|
150
141
|
centralSymetric(center, name = this.name + "'") {
|
|
151
|
-
const vec = vector_1.VectorConstructor.fromPoints(this, center)
|
|
142
|
+
const vec = vector_1.VectorConstructor.fromPoints(this, center);
|
|
152
143
|
return vec.getEndPoint(center, name);
|
|
153
144
|
}
|
|
145
|
+
project(line, name = this.name + "'") {
|
|
146
|
+
const perp = line.getPerpendicular(this);
|
|
147
|
+
return perp.intersect(line, name);
|
|
148
|
+
}
|
|
149
|
+
axialSymetric(line, name = this.name + "'") {
|
|
150
|
+
const projOrtho = this.project(line);
|
|
151
|
+
return this.centralSymetric(projOrtho, name);
|
|
152
|
+
}
|
|
154
153
|
}
|
|
155
154
|
exports.Point = Point;
|