@lydt/geogebra-studio 0.0.0-stage → 0.4.0-rc.2
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/.agents/plugins/marketplace.json +21 -0
- package/.codex-plugin/plugin.json +21 -0
- package/.mcp.json +18 -0
- package/LICENSE +339 -0
- package/LICENSE-MIT +21 -0
- package/README.md +108 -2
- package/README.zh-CN.md +89 -0
- package/THIRD_PARTY_NOTICES.md +35 -0
- package/dist/cli.d.ts +27 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +234 -0
- package/dist/cli.js.map +1 -0
- package/dist/export/files.d.ts +4 -0
- package/dist/export/files.d.ts.map +1 -0
- package/dist/export/files.js +44 -0
- package/dist/export/files.js.map +1 -0
- package/dist/export/gikz.d.ts +11 -0
- package/dist/export/gikz.d.ts.map +1 -0
- package/dist/export/gikz.js +28 -0
- package/dist/export/gikz.js.map +1 -0
- package/dist/export/html.d.ts +14 -0
- package/dist/export/html.d.ts.map +1 -0
- package/dist/export/html.js +97 -0
- package/dist/export/html.js.map +1 -0
- package/dist/export/semantic.d.ts +43 -0
- package/dist/export/semantic.d.ts.map +1 -0
- package/dist/export/semantic.js +212 -0
- package/dist/export/semantic.js.map +1 -0
- package/dist/export/viewer-themes.d.ts +76 -0
- package/dist/export/viewer-themes.d.ts.map +1 -0
- package/dist/export/viewer-themes.js +169 -0
- package/dist/export/viewer-themes.js.map +1 -0
- package/dist/export/workspace.d.ts +4 -0
- package/dist/export/workspace.d.ts.map +1 -0
- package/dist/export/workspace.js +25 -0
- package/dist/export/workspace.js.map +1 -0
- package/dist/gikz-browser.js +770 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +84 -0
- package/dist/index.js.map +1 -0
- package/dist/server.d.ts +35 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +187 -0
- package/dist/server.js.map +1 -0
- package/dist/studio/artifact.d.ts +37 -0
- package/dist/studio/artifact.d.ts.map +1 -0
- package/dist/studio/artifact.js +61 -0
- package/dist/studio/artifact.js.map +1 -0
- package/dist/studio/browser.d.ts +7 -0
- package/dist/studio/browser.d.ts.map +1 -0
- package/dist/studio/browser.js +67 -0
- package/dist/studio/browser.js.map +1 -0
- package/dist/studio/install.d.ts +4 -0
- package/dist/studio/install.d.ts.map +1 -0
- package/dist/studio/install.js +60 -0
- package/dist/studio/install.js.map +1 -0
- package/dist/tools/apps-api-tools.d.ts +4 -0
- package/dist/tools/apps-api-tools.d.ts.map +1 -0
- package/dist/tools/apps-api-tools.js +96 -0
- package/dist/tools/apps-api-tools.js.map +1 -0
- package/dist/tools/educational-templates.d.ts +33 -0
- package/dist/tools/educational-templates.d.ts.map +1 -0
- package/dist/tools/educational-templates.js +261 -0
- package/dist/tools/educational-templates.js.map +1 -0
- package/dist/tools/export-tools.d.ts +3 -0
- package/dist/tools/export-tools.d.ts.map +1 -0
- package/dist/tools/export-tools.js +118 -0
- package/dist/tools/export-tools.js.map +1 -0
- package/dist/tools/geogebra-tools.d.ts +15 -0
- package/dist/tools/geogebra-tools.d.ts.map +1 -0
- package/dist/tools/geogebra-tools.js +3442 -0
- package/dist/tools/geogebra-tools.js.map +1 -0
- package/dist/tools/index.d.ts +43 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +183 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/performance-tools.d.ts +7 -0
- package/dist/tools/performance-tools.d.ts.map +1 -0
- package/dist/tools/performance-tools.js +312 -0
- package/dist/tools/performance-tools.js.map +1 -0
- package/dist/tools/templates/algebra-templates.d.ts +7 -0
- package/dist/tools/templates/algebra-templates.d.ts.map +1 -0
- package/dist/tools/templates/algebra-templates.js +568 -0
- package/dist/tools/templates/algebra-templates.js.map +1 -0
- package/dist/tools/templates/geometry-templates.d.ts +7 -0
- package/dist/tools/templates/geometry-templates.d.ts.map +1 -0
- package/dist/tools/templates/geometry-templates.js +492 -0
- package/dist/tools/templates/geometry-templates.js.map +1 -0
- package/dist/types/geogebra.d.ts +103 -0
- package/dist/types/geogebra.d.ts.map +1 -0
- package/dist/types/geogebra.js +34 -0
- package/dist/types/geogebra.js.map +1 -0
- package/dist/types/mcp.d.ts +125 -0
- package/dist/types/mcp.d.ts.map +1 -0
- package/dist/types/mcp.js +19 -0
- package/dist/types/mcp.js.map +1 -0
- package/dist/utils/app-info.d.ts +12 -0
- package/dist/utils/app-info.d.ts.map +1 -0
- package/dist/utils/app-info.js +30 -0
- package/dist/utils/app-info.js.map +1 -0
- package/dist/utils/errors.d.ts +37 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +72 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/gemini-compatibility.d.ts +39 -0
- package/dist/utils/gemini-compatibility.d.ts.map +1 -0
- package/dist/utils/gemini-compatibility.js +154 -0
- package/dist/utils/gemini-compatibility.js.map +1 -0
- package/dist/utils/geogebra-instance.d.ts +252 -0
- package/dist/utils/geogebra-instance.d.ts.map +1 -0
- package/dist/utils/geogebra-instance.js +1560 -0
- package/dist/utils/geogebra-instance.js.map +1 -0
- package/dist/utils/geogebra-mock.d.ts +172 -0
- package/dist/utils/geogebra-mock.d.ts.map +1 -0
- package/dist/utils/geogebra-mock.js +732 -0
- package/dist/utils/geogebra-mock.js.map +1 -0
- package/dist/utils/logger.d.ts +4 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +46 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/performance/index.d.ts +76 -0
- package/dist/utils/performance/index.d.ts.map +1 -0
- package/dist/utils/performance/index.js +163 -0
- package/dist/utils/performance/index.js.map +1 -0
- package/dist/utils/performance/instance-pool.d.ts +78 -0
- package/dist/utils/performance/instance-pool.d.ts.map +1 -0
- package/dist/utils/performance/instance-pool.js +268 -0
- package/dist/utils/performance/instance-pool.js.map +1 -0
- package/dist/utils/validation.d.ts +92 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +557 -0
- package/dist/utils/validation.js.map +1 -0
- package/dist/widget.html +110 -0
- package/docs/APPS-API-BRIDGE.md +28 -0
- package/docs/MODERNIZATION.md +15 -0
- package/docs/TANGENT-REGRESSION.md +34 -0
- package/docs/VALIDATION.md +26 -0
- package/docs/VISUAL-STANDARD.md +26 -0
- package/docs/images/native-construction.png +0 -0
- package/examples/tangent-construction.json +26 -0
- package/gikz/LICENSE +339 -0
- package/gikz/PROVENANCE.md +8 -0
- package/gikz/browser.cjs +2 -0
- package/gikz/cli.cjs +195 -0
- package/gikz/core.cjs +806 -0
- package/mcp.json +20 -0
- package/package.json +107 -4
- package/plugin.json +35 -0
- package/runtime/package.json +4 -0
- package/scripts/build-plugin.cjs +15 -0
- package/scripts/build-widget.cjs +7 -0
- package/skills/geogebra-construct/SKILL.md +40 -0
- package/skills/geogebra-setup/SKILL.md +37 -0
- package/skills/geometry-export/SKILL.md +31 -0
- package/src/cli.ts +212 -0
- package/src/export/files.ts +26 -0
- package/src/export/gikz.ts +22 -0
- package/src/export/html.ts +108 -0
- package/src/export/semantic.ts +180 -0
- package/src/export/viewer-themes.ts +165 -0
- package/src/export/workspace.ts +15 -0
- package/src/index.ts +71 -0
- package/src/server.ts +168 -0
- package/src/studio/artifact.ts +50 -0
- package/src/studio/browser.ts +38 -0
- package/src/studio/install.ts +43 -0
- package/src/tools/apps-api-tools.ts +96 -0
- package/src/tools/educational-templates.ts +299 -0
- package/src/tools/export-tools.ts +110 -0
- package/src/tools/geogebra-tools.ts +3836 -0
- package/src/tools/index.ts +192 -0
- package/src/tools/performance-tools.ts +322 -0
- package/src/tools/templates/algebra-templates.ts +619 -0
- package/src/tools/templates/geometry-templates.ts +550 -0
- package/src/types/geogebra.ts +140 -0
- package/src/types/global.d.ts +31 -0
- package/src/types/mcp.ts +141 -0
- package/src/utils/app-info.ts +35 -0
- package/src/utils/errors.ts +97 -0
- package/src/utils/gemini-compatibility.ts +193 -0
- package/src/utils/geogebra-instance.ts +1712 -0
- package/src/utils/geogebra-mock.ts +867 -0
- package/src/utils/logger.ts +60 -0
- package/src/utils/performance/index.ts +211 -0
- package/src/utils/performance/instance-pool.ts +323 -0
- package/src/utils/validation.ts +647 -0
- package/tsconfig.json +35 -0
- package/widget/main.ts +12 -0
|
@@ -0,0 +1,550 @@
|
|
|
1
|
+
import { EducationalTemplate } from '../educational-templates';
|
|
2
|
+
import { toolRegistry } from '../index';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Geometry Educational Templates
|
|
6
|
+
* Pre-built geometric scenarios for common educational use cases
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export const geometryTemplates: EducationalTemplate[] = [
|
|
10
|
+
{
|
|
11
|
+
id: 'triangle_basics',
|
|
12
|
+
name: 'Triangle Fundamentals',
|
|
13
|
+
category: 'geometry',
|
|
14
|
+
description: 'Interactive exploration of triangle properties, including angles, sides, and basic relationships',
|
|
15
|
+
gradeLevel: '6-8',
|
|
16
|
+
objectives: [
|
|
17
|
+
'Understand triangle angle sum property',
|
|
18
|
+
'Explore relationship between side lengths and angles',
|
|
19
|
+
'Classify triangles by sides and angles'
|
|
20
|
+
],
|
|
21
|
+
prerequisites: ['Basic angle concepts', 'Measurement skills'],
|
|
22
|
+
estimatedTime: 15,
|
|
23
|
+
setup: async () => {
|
|
24
|
+
// Create three points for a triangle
|
|
25
|
+
await toolRegistry.executeTool('geogebra_create_point', {
|
|
26
|
+
name: 'A',
|
|
27
|
+
x: 0,
|
|
28
|
+
y: 0,
|
|
29
|
+
color: '#FF0000',
|
|
30
|
+
size: 4
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
await toolRegistry.executeTool('geogebra_create_point', {
|
|
34
|
+
name: 'B',
|
|
35
|
+
x: 4,
|
|
36
|
+
y: 0,
|
|
37
|
+
color: '#FF0000',
|
|
38
|
+
size: 4
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
await toolRegistry.executeTool('geogebra_create_point', {
|
|
42
|
+
name: 'C',
|
|
43
|
+
x: 2,
|
|
44
|
+
y: 3,
|
|
45
|
+
color: '#FF0000',
|
|
46
|
+
size: 4,
|
|
47
|
+
moveable: true
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
// Create triangle sides
|
|
51
|
+
await toolRegistry.executeTool('geogebra_create_line_segment', {
|
|
52
|
+
name: 'AB',
|
|
53
|
+
point1: 'A',
|
|
54
|
+
point2: 'B',
|
|
55
|
+
color: '#0000FF',
|
|
56
|
+
thickness: 2
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
await toolRegistry.executeTool('geogebra_create_line_segment', {
|
|
60
|
+
name: 'BC',
|
|
61
|
+
point1: 'B',
|
|
62
|
+
point2: 'C',
|
|
63
|
+
color: '#0000FF',
|
|
64
|
+
thickness: 2
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
await toolRegistry.executeTool('geogebra_create_line_segment', {
|
|
68
|
+
name: 'CA',
|
|
69
|
+
point1: 'C',
|
|
70
|
+
point2: 'A',
|
|
71
|
+
color: '#0000FF',
|
|
72
|
+
thickness: 2
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
// Create angle measurements
|
|
76
|
+
await toolRegistry.executeTool('geogebra_eval_command', {command: 'angleA = Angle(B, A, C)'});
|
|
77
|
+
|
|
78
|
+
await toolRegistry.executeTool('geogebra_eval_command', {command: 'angleB = Angle(C, B, A)'});
|
|
79
|
+
|
|
80
|
+
await toolRegistry.executeTool('geogebra_eval_command', {command: 'angleC = Angle(A, C, B)'});
|
|
81
|
+
|
|
82
|
+
// Add dynamic text showing angle sum
|
|
83
|
+
await toolRegistry.executeTool('geogebra_create_text', {
|
|
84
|
+
text: '"Angle Sum: " + angleA + angleB + angleC',
|
|
85
|
+
x: 5,
|
|
86
|
+
y: 2,
|
|
87
|
+
fontSize: 16,
|
|
88
|
+
color: '#AA0000'
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
return {
|
|
92
|
+
construction: 'Triangle with interactive point C and angle measurements',
|
|
93
|
+
interactivity: 'Drag point C to see how angles change while sum remains 180°',
|
|
94
|
+
learningPoints: [
|
|
95
|
+
'Triangle angle sum is always 180°',
|
|
96
|
+
'Larger angles are opposite longer sides',
|
|
97
|
+
'Moving vertices changes individual angles but not their sum'
|
|
98
|
+
]
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
{
|
|
104
|
+
id: 'circle_theorems',
|
|
105
|
+
name: 'Circle Theorems Explorer',
|
|
106
|
+
category: 'geometry',
|
|
107
|
+
description: 'Interactive demonstration of fundamental circle theorems including inscribed angles and tangent properties',
|
|
108
|
+
gradeLevel: '9-12',
|
|
109
|
+
objectives: [
|
|
110
|
+
'Understand inscribed angle theorem',
|
|
111
|
+
'Explore tangent-chord relationships',
|
|
112
|
+
'Investigate central vs inscribed angles'
|
|
113
|
+
],
|
|
114
|
+
prerequisites: ['Circle basics', 'Angle measurement', 'Basic proofs'],
|
|
115
|
+
estimatedTime: 20,
|
|
116
|
+
setup: async () => {
|
|
117
|
+
// Create center and circle
|
|
118
|
+
await toolRegistry.executeTool('geogebra_create_point', {
|
|
119
|
+
name: 'O',
|
|
120
|
+
x: 0,
|
|
121
|
+
y: 0,
|
|
122
|
+
color: '#000000',
|
|
123
|
+
size: 4,
|
|
124
|
+
label: 'Center'
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
await toolRegistry.executeTool('geogebra_create_circle', {
|
|
128
|
+
name: 'circle',
|
|
129
|
+
center: 'O',
|
|
130
|
+
radius: 3,
|
|
131
|
+
color: '#0000FF',
|
|
132
|
+
thickness: 2
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
// Create points on circle for inscribed angle
|
|
136
|
+
await toolRegistry.executeTool('geogebra_create_point_on_object', {
|
|
137
|
+
name: 'A',
|
|
138
|
+
object: 'circle',
|
|
139
|
+
color: '#FF0000',
|
|
140
|
+
size: 4,
|
|
141
|
+
moveable: true
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
await toolRegistry.executeTool('geogebra_create_point_on_object', {
|
|
145
|
+
name: 'B',
|
|
146
|
+
object: 'circle',
|
|
147
|
+
color: '#FF0000',
|
|
148
|
+
size: 4,
|
|
149
|
+
moveable: true
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
await toolRegistry.executeTool('geogebra_create_point_on_object', {
|
|
153
|
+
name: 'C',
|
|
154
|
+
object: 'circle',
|
|
155
|
+
color: '#FF0000',
|
|
156
|
+
size: 4,
|
|
157
|
+
moveable: true
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
// Create chords
|
|
161
|
+
await toolRegistry.executeTool('geogebra_create_line_segment', {
|
|
162
|
+
name: 'AB',
|
|
163
|
+
point1: 'A',
|
|
164
|
+
point2: 'B',
|
|
165
|
+
color: '#00AA00',
|
|
166
|
+
thickness: 2
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
await toolRegistry.executeTool('geogebra_create_line_segment', {
|
|
170
|
+
name: 'AC',
|
|
171
|
+
point1: 'A',
|
|
172
|
+
point2: 'C',
|
|
173
|
+
color: '#00AA00',
|
|
174
|
+
thickness: 2
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
await toolRegistry.executeTool('geogebra_create_line_segment', {
|
|
178
|
+
name: 'BC',
|
|
179
|
+
point1: 'B',
|
|
180
|
+
point2: 'C',
|
|
181
|
+
color: '#00AA00',
|
|
182
|
+
thickness: 2
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
// Create central angle
|
|
186
|
+
await toolRegistry.executeTool('geogebra_create_line_segment', {
|
|
187
|
+
name: 'OB',
|
|
188
|
+
point1: 'O',
|
|
189
|
+
point2: 'B',
|
|
190
|
+
color: '#AA00AA',
|
|
191
|
+
thickness: 1,
|
|
192
|
+
style: 'dashed'
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
await toolRegistry.executeTool('geogebra_create_line_segment', {
|
|
196
|
+
name: 'OC',
|
|
197
|
+
point1: 'O',
|
|
198
|
+
point2: 'C',
|
|
199
|
+
color: '#AA00AA',
|
|
200
|
+
thickness: 1,
|
|
201
|
+
style: 'dashed'
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
// Create angles
|
|
205
|
+
await toolRegistry.executeTool('geogebra_eval_command', {command: 'inscribedAngle = Angle(B, A, C)'});
|
|
206
|
+
|
|
207
|
+
await toolRegistry.executeTool('geogebra_eval_command', {command: 'centralAngle = Angle(B, O, C)'});
|
|
208
|
+
|
|
209
|
+
// Add relationship text
|
|
210
|
+
await toolRegistry.executeTool('geogebra_create_text', {
|
|
211
|
+
text: '"Inscribed: " + inscribedAngle + " Central: " + centralAngle + " Ratio: " + centralAngle/inscribedAngle',
|
|
212
|
+
x: 4,
|
|
213
|
+
y: 2,
|
|
214
|
+
fontSize: 14,
|
|
215
|
+
color: '#000000'
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
return {
|
|
219
|
+
construction: 'Circle with inscribed and central angles',
|
|
220
|
+
interactivity: 'Move points A, B, C around the circle to see angle relationships',
|
|
221
|
+
theorems: [
|
|
222
|
+
'Inscribed angle = 1/2 × Central angle (for same arc)',
|
|
223
|
+
'Inscribed angles subtending same arc are equal',
|
|
224
|
+
'Angle in semicircle is 90°'
|
|
225
|
+
]
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
|
|
230
|
+
{
|
|
231
|
+
id: 'pythagorean_proof',
|
|
232
|
+
name: 'Pythagorean Theorem Visual Proof',
|
|
233
|
+
category: 'geometry',
|
|
234
|
+
description: 'Interactive visual proof of the Pythagorean theorem using area relationships',
|
|
235
|
+
gradeLevel: '8-10',
|
|
236
|
+
objectives: [
|
|
237
|
+
'Understand Pythagorean theorem relationship',
|
|
238
|
+
'Visualize proof through area',
|
|
239
|
+
'Apply theorem to solve problems'
|
|
240
|
+
],
|
|
241
|
+
prerequisites: ['Area of squares and triangles', 'Right angle recognition'],
|
|
242
|
+
estimatedTime: 25,
|
|
243
|
+
setup: async () => {
|
|
244
|
+
// Create right triangle
|
|
245
|
+
await toolRegistry.executeTool('geogebra_create_point', {
|
|
246
|
+
name: 'A',
|
|
247
|
+
x: 0,
|
|
248
|
+
y: 0,
|
|
249
|
+
color: '#FF0000',
|
|
250
|
+
size: 4
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
await toolRegistry.executeTool('geogebra_create_point', {
|
|
254
|
+
name: 'B',
|
|
255
|
+
x: 3,
|
|
256
|
+
y: 0,
|
|
257
|
+
color: '#FF0000',
|
|
258
|
+
size: 4
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
await toolRegistry.executeTool('geogebra_create_point', {
|
|
262
|
+
name: 'C',
|
|
263
|
+
x: 0,
|
|
264
|
+
y: 4,
|
|
265
|
+
color: '#FF0000',
|
|
266
|
+
size: 4,
|
|
267
|
+
moveable: true
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
// Create triangle
|
|
271
|
+
await toolRegistry.executeTool('geogebra_create_polygon', {
|
|
272
|
+
name: 'triangle',
|
|
273
|
+
points: ['A', 'B', 'C'],
|
|
274
|
+
color: '#CCCCCC',
|
|
275
|
+
fillOpacity: 0.3
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
// Create squares on each side
|
|
279
|
+
// Square on side AB (horizontal)
|
|
280
|
+
await toolRegistry.executeTool('geogebra_create_point', {
|
|
281
|
+
name: 'B1',
|
|
282
|
+
x: 3,
|
|
283
|
+
y: -3,
|
|
284
|
+
color: '#0000FF',
|
|
285
|
+
size: 3
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
await toolRegistry.executeTool('geogebra_create_point', {
|
|
289
|
+
name: 'A1',
|
|
290
|
+
x: 0,
|
|
291
|
+
y: -3,
|
|
292
|
+
color: '#0000FF',
|
|
293
|
+
size: 3
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
await toolRegistry.executeTool('geogebra_create_polygon', {
|
|
297
|
+
name: 'squareAB',
|
|
298
|
+
points: ['A', 'B', 'B1', 'A1'],
|
|
299
|
+
color: '#CCDDFF',
|
|
300
|
+
fillOpacity: 0.5
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
// Square on side AC (vertical)
|
|
304
|
+
await toolRegistry.executeTool('geogebra_create_point', {
|
|
305
|
+
name: 'A2',
|
|
306
|
+
x: -4,
|
|
307
|
+
y: 0,
|
|
308
|
+
color: '#00AA00',
|
|
309
|
+
size: 3
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
await toolRegistry.executeTool('geogebra_create_point', {
|
|
313
|
+
name: 'C2',
|
|
314
|
+
x: -4,
|
|
315
|
+
y: 4,
|
|
316
|
+
color: '#00AA00',
|
|
317
|
+
size: 3
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
await toolRegistry.executeTool('geogebra_create_polygon', {
|
|
321
|
+
name: 'squareAC',
|
|
322
|
+
points: ['A', 'C', 'C2', 'A2'],
|
|
323
|
+
color: '#CCFFCC',
|
|
324
|
+
fillOpacity: 0.5
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
// Square on hypotenuse BC
|
|
328
|
+
// Calculate perpendicular direction
|
|
329
|
+
await toolRegistry.executeTool('geogebra_create_point', {
|
|
330
|
+
name: 'C3',
|
|
331
|
+
x: 5.4,
|
|
332
|
+
y: 6.8,
|
|
333
|
+
color: '#AA0000',
|
|
334
|
+
size: 3
|
|
335
|
+
});
|
|
336
|
+
|
|
337
|
+
await toolRegistry.executeTool('geogebra_create_point', {
|
|
338
|
+
name: 'B3',
|
|
339
|
+
x: 1.4,
|
|
340
|
+
y: 2.8,
|
|
341
|
+
color: '#AA0000',
|
|
342
|
+
size: 3
|
|
343
|
+
});
|
|
344
|
+
|
|
345
|
+
await toolRegistry.executeTool('geogebra_create_polygon', {
|
|
346
|
+
name: 'squareBC',
|
|
347
|
+
points: ['B', 'C', 'C3', 'B3'],
|
|
348
|
+
color: '#FFCCCC',
|
|
349
|
+
fillOpacity: 0.5
|
|
350
|
+
});
|
|
351
|
+
|
|
352
|
+
// Add measurements and calculations
|
|
353
|
+
await toolRegistry.executeTool('geogebra_create_text', {
|
|
354
|
+
text: '"a = " + Length[AB] + ", a² = " + Length[AB]²',
|
|
355
|
+
x: 1.5,
|
|
356
|
+
y: -1.5,
|
|
357
|
+
fontSize: 12,
|
|
358
|
+
color: '#0000FF'
|
|
359
|
+
});
|
|
360
|
+
|
|
361
|
+
await toolRegistry.executeTool('geogebra_create_text', {
|
|
362
|
+
text: '"b = " + Length[AC] + ", b² = " + Length[AC]²',
|
|
363
|
+
x: -3,
|
|
364
|
+
y: 2,
|
|
365
|
+
fontSize: 12,
|
|
366
|
+
color: '#00AA00'
|
|
367
|
+
});
|
|
368
|
+
|
|
369
|
+
await toolRegistry.executeTool('geogebra_create_text', {
|
|
370
|
+
text: '"c = " + Length[BC] + ", c² = " + Length[BC]²',
|
|
371
|
+
x: 4,
|
|
372
|
+
y: 3,
|
|
373
|
+
fontSize: 12,
|
|
374
|
+
color: '#AA0000'
|
|
375
|
+
});
|
|
376
|
+
|
|
377
|
+
await toolRegistry.executeTool('geogebra_create_text', {
|
|
378
|
+
text: '"a² + b² = " + (Length[AB]² + Length[AC]²)',
|
|
379
|
+
x: 5,
|
|
380
|
+
y: 1,
|
|
381
|
+
fontSize: 14,
|
|
382
|
+
color: '#000000',
|
|
383
|
+
fontStyle: 'bold'
|
|
384
|
+
});
|
|
385
|
+
|
|
386
|
+
return {
|
|
387
|
+
construction: 'Right triangle with squares on all three sides',
|
|
388
|
+
interactivity: 'Move point C to change triangle dimensions',
|
|
389
|
+
proof: 'Visual demonstration that area of square on hypotenuse equals sum of areas on other two sides',
|
|
390
|
+
verification: 'Drag point C to verify a² + b² = c² for different right triangles'
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
},
|
|
394
|
+
|
|
395
|
+
{
|
|
396
|
+
id: 'similarity_triangles',
|
|
397
|
+
name: 'Triangle Similarity Explorer',
|
|
398
|
+
category: 'geometry',
|
|
399
|
+
description: 'Interactive exploration of similar triangles, scale factors, and corresponding parts',
|
|
400
|
+
gradeLevel: '9-12',
|
|
401
|
+
objectives: [
|
|
402
|
+
'Understand triangle similarity criteria (AA, SAS, SSS)',
|
|
403
|
+
'Calculate scale factors and corresponding measurements',
|
|
404
|
+
'Apply similarity in problem solving'
|
|
405
|
+
],
|
|
406
|
+
prerequisites: ['Angle measurement', 'Proportional reasoning', 'Basic triangle properties'],
|
|
407
|
+
estimatedTime: 18,
|
|
408
|
+
setup: async () => {
|
|
409
|
+
// Create original triangle
|
|
410
|
+
await toolRegistry.executeTool('geogebra_create_point', {
|
|
411
|
+
name: 'A',
|
|
412
|
+
x: 0,
|
|
413
|
+
y: 0,
|
|
414
|
+
color: '#FF0000',
|
|
415
|
+
size: 4
|
|
416
|
+
});
|
|
417
|
+
|
|
418
|
+
await toolRegistry.executeTool('geogebra_create_point', {
|
|
419
|
+
name: 'B',
|
|
420
|
+
x: 6,
|
|
421
|
+
y: 0,
|
|
422
|
+
color: '#FF0000',
|
|
423
|
+
size: 4
|
|
424
|
+
});
|
|
425
|
+
|
|
426
|
+
await toolRegistry.executeTool('geogebra_create_point', {
|
|
427
|
+
name: 'C',
|
|
428
|
+
x: 2,
|
|
429
|
+
y: 4,
|
|
430
|
+
color: '#FF0000',
|
|
431
|
+
size: 4,
|
|
432
|
+
moveable: true
|
|
433
|
+
});
|
|
434
|
+
|
|
435
|
+
await toolRegistry.executeTool('geogebra_create_polygon', {
|
|
436
|
+
name: 'originalTriangle',
|
|
437
|
+
points: ['A', 'B', 'C'],
|
|
438
|
+
color: '#FF6666',
|
|
439
|
+
fillOpacity: 0.3
|
|
440
|
+
});
|
|
441
|
+
|
|
442
|
+
// Create scale factor slider
|
|
443
|
+
await toolRegistry.executeTool('geogebra_create_slider', {
|
|
444
|
+
name: 'scaleFactor',
|
|
445
|
+
min: 0.3,
|
|
446
|
+
max: 2.0,
|
|
447
|
+
value: 0.7,
|
|
448
|
+
increment: 0.1,
|
|
449
|
+
x: 8,
|
|
450
|
+
y: 4,
|
|
451
|
+
width: 150,
|
|
452
|
+
caption: 'Scale Factor'
|
|
453
|
+
});
|
|
454
|
+
|
|
455
|
+
// Create similar triangle using scale factor
|
|
456
|
+
await toolRegistry.executeTool('geogebra_create_point', {
|
|
457
|
+
name: 'A2',
|
|
458
|
+
x: 8,
|
|
459
|
+
y: -2,
|
|
460
|
+
color: '#0000FF',
|
|
461
|
+
size: 4
|
|
462
|
+
});
|
|
463
|
+
|
|
464
|
+
// Note: In real implementation, these would use the scale factor
|
|
465
|
+
// For now, creating approximate similar triangle
|
|
466
|
+
await toolRegistry.executeTool('geogebra_create_point', {
|
|
467
|
+
name: 'B2',
|
|
468
|
+
x: 12.2,
|
|
469
|
+
y: -2,
|
|
470
|
+
color: '#0000FF',
|
|
471
|
+
size: 4
|
|
472
|
+
});
|
|
473
|
+
|
|
474
|
+
await toolRegistry.executeTool('geogebra_create_point', {
|
|
475
|
+
name: 'C2',
|
|
476
|
+
x: 9.4,
|
|
477
|
+
y: 0.8,
|
|
478
|
+
color: '#0000FF',
|
|
479
|
+
size: 4
|
|
480
|
+
});
|
|
481
|
+
|
|
482
|
+
await toolRegistry.executeTool('geogebra_create_polygon', {
|
|
483
|
+
name: 'similarTriangle',
|
|
484
|
+
points: ['A2', 'B2', 'C2'],
|
|
485
|
+
color: '#6666FF',
|
|
486
|
+
fillOpacity: 0.3
|
|
487
|
+
});
|
|
488
|
+
|
|
489
|
+
// Add corresponding angle markings
|
|
490
|
+
await toolRegistry.executeTool('geogebra_eval_command', {command: 'angleA1 = Angle(B, A, C)'});
|
|
491
|
+
|
|
492
|
+
await toolRegistry.executeTool('geogebra_eval_command', {command: 'angleA2 = Angle(B2, A2, C2)'});
|
|
493
|
+
|
|
494
|
+
// Add measurements and ratios
|
|
495
|
+
await toolRegistry.executeTool('geogebra_create_text', {
|
|
496
|
+
text: '"Original Triangle ABC"',
|
|
497
|
+
x: 1,
|
|
498
|
+
y: 5,
|
|
499
|
+
fontSize: 14,
|
|
500
|
+
color: '#FF0000',
|
|
501
|
+
fontStyle: 'bold'
|
|
502
|
+
});
|
|
503
|
+
|
|
504
|
+
await toolRegistry.executeTool('geogebra_create_text', {
|
|
505
|
+
text: '"Similar Triangle A\'B\'C\'"',
|
|
506
|
+
x: 8,
|
|
507
|
+
y: 2,
|
|
508
|
+
fontSize: 14,
|
|
509
|
+
color: '#0000FF',
|
|
510
|
+
fontStyle: 'bold'
|
|
511
|
+
});
|
|
512
|
+
|
|
513
|
+
await toolRegistry.executeTool('geogebra_create_text', {
|
|
514
|
+
text: '"AB = " + Length[AB] + ", A\'B\' = " + Length[A2B2]',
|
|
515
|
+
x: 1,
|
|
516
|
+
y: -3,
|
|
517
|
+
fontSize: 12,
|
|
518
|
+
color: '#000000'
|
|
519
|
+
});
|
|
520
|
+
|
|
521
|
+
await toolRegistry.executeTool('geogebra_create_text', {
|
|
522
|
+
text: '"Scale Factor = " + scaleFactor',
|
|
523
|
+
x: 8,
|
|
524
|
+
y: 1,
|
|
525
|
+
fontSize: 14,
|
|
526
|
+
color: '#AA00AA',
|
|
527
|
+
fontStyle: 'bold'
|
|
528
|
+
});
|
|
529
|
+
|
|
530
|
+
await toolRegistry.executeTool('geogebra_create_text', {
|
|
531
|
+
text: '"Ratio Check: A\'B\'/AB = " + Length[A2B2]/Length[AB]',
|
|
532
|
+
x: 1,
|
|
533
|
+
y: -4,
|
|
534
|
+
fontSize: 12,
|
|
535
|
+
color: '#AA00AA'
|
|
536
|
+
});
|
|
537
|
+
|
|
538
|
+
return {
|
|
539
|
+
construction: 'Two similar triangles with adjustable scale factor',
|
|
540
|
+
interactivity: 'Move point C and adjust scale factor to explore similarity',
|
|
541
|
+
concepts: [
|
|
542
|
+
'Similar triangles have equal corresponding angles',
|
|
543
|
+
'Corresponding sides are proportional',
|
|
544
|
+
'Scale factor applies to all linear measurements',
|
|
545
|
+
'Areas scale by square of the scale factor'
|
|
546
|
+
]
|
|
547
|
+
};
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
];
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GeoGebra Integration Types
|
|
3
|
+
* Type definitions for GeoGebra Apps API integration
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// GeoGebra Instance Configuration
|
|
7
|
+
export interface GeoGebraConfig {
|
|
8
|
+
appName?: 'graphing' | 'geometry' | '3d' | 'classic' | 'suite' | 'evaluator' | 'scientific' | 'notes';
|
|
9
|
+
width?: number;
|
|
10
|
+
height?: number;
|
|
11
|
+
showMenuBar?: boolean;
|
|
12
|
+
showToolBar?: boolean;
|
|
13
|
+
showAlgebraInput?: boolean;
|
|
14
|
+
showResetIcon?: boolean;
|
|
15
|
+
enableRightClick?: boolean;
|
|
16
|
+
enableLabelDrags?: boolean;
|
|
17
|
+
enableShiftDragZoom?: boolean;
|
|
18
|
+
language?: string;
|
|
19
|
+
material_id?: string;
|
|
20
|
+
filename?: string;
|
|
21
|
+
ggbBase64?: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// GeoGebra Command Result
|
|
25
|
+
export interface GeoGebraCommandResult {
|
|
26
|
+
success: boolean;
|
|
27
|
+
result?: string | number | boolean;
|
|
28
|
+
labels?: string[];
|
|
29
|
+
error?: string;
|
|
30
|
+
objects?: string[];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// GeoGebra Object Information
|
|
34
|
+
export interface GeoGebraObject {
|
|
35
|
+
name: string;
|
|
36
|
+
type: string;
|
|
37
|
+
value?: string | number;
|
|
38
|
+
visible: boolean;
|
|
39
|
+
defined: boolean;
|
|
40
|
+
x?: number;
|
|
41
|
+
y?: number;
|
|
42
|
+
z?: number;
|
|
43
|
+
color?: string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// GeoGebra Instance State
|
|
47
|
+
export interface GeoGebraInstanceState {
|
|
48
|
+
id: string;
|
|
49
|
+
isReady: boolean;
|
|
50
|
+
objectCount: number;
|
|
51
|
+
lastActivity: Date;
|
|
52
|
+
config: GeoGebraConfig;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// GeoGebra Pool Configuration
|
|
56
|
+
export interface GeoGebraPoolConfig {
|
|
57
|
+
maxInstances: number;
|
|
58
|
+
instanceTimeout: number; // milliseconds
|
|
59
|
+
maxIdleTime: number; // milliseconds
|
|
60
|
+
headless: boolean;
|
|
61
|
+
browserArgs?: string[];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// GeoGebra API Methods Interface
|
|
65
|
+
export interface GeoGebraAPI {
|
|
66
|
+
// Core command execution
|
|
67
|
+
evalCommand(command: string): Promise<GeoGebraCommandResult>;
|
|
68
|
+
evalCommandGetLabels(command: string): Promise<string[]>;
|
|
69
|
+
|
|
70
|
+
// Object management
|
|
71
|
+
deleteObject(objName: string): Promise<boolean>;
|
|
72
|
+
exists(objName: string): Promise<boolean>;
|
|
73
|
+
isDefined(objName: string): Promise<boolean>;
|
|
74
|
+
getAllObjectNames(type?: string): Promise<string[]>;
|
|
75
|
+
getObjectInfo(objName: string): Promise<GeoGebraObject | null>;
|
|
76
|
+
|
|
77
|
+
// Coordinate and value operations
|
|
78
|
+
getXcoord(objName: string): Promise<number>;
|
|
79
|
+
getYcoord(objName: string): Promise<number>;
|
|
80
|
+
getZcoord(objName: string): Promise<number>;
|
|
81
|
+
getValue(objName: string): Promise<number>;
|
|
82
|
+
getValueString(objName: string): Promise<string>;
|
|
83
|
+
|
|
84
|
+
// Construction management
|
|
85
|
+
newConstruction(): Promise<void>;
|
|
86
|
+
reset(): Promise<void>;
|
|
87
|
+
refreshViews(): Promise<void>;
|
|
88
|
+
|
|
89
|
+
// View configuration
|
|
90
|
+
setCoordSystem(xmin: number, xmax: number, ymin: number, ymax: number): Promise<void>;
|
|
91
|
+
setAxesVisible(xAxis: boolean, yAxis: boolean): Promise<void>;
|
|
92
|
+
setGridVisible(visible: boolean): Promise<void>;
|
|
93
|
+
|
|
94
|
+
// Animation methods
|
|
95
|
+
setAnimating(objName: string, animate: boolean): Promise<void>;
|
|
96
|
+
setAnimationSpeed(objName: string, speed: number): Promise<void>;
|
|
97
|
+
startAnimation(): Promise<void>;
|
|
98
|
+
stopAnimation(): Promise<void>;
|
|
99
|
+
isAnimationRunning(): Promise<boolean>;
|
|
100
|
+
setTrace(objName: string, flag: boolean): Promise<void>;
|
|
101
|
+
setValue(objName: string, value: number): Promise<void>;
|
|
102
|
+
|
|
103
|
+
// Instance management
|
|
104
|
+
isReady(): Promise<boolean>;
|
|
105
|
+
cleanup(): Promise<void>;
|
|
106
|
+
|
|
107
|
+
// Export capabilities
|
|
108
|
+
exportPNG(scale?: number, transparent?: boolean, dpi?: number, width?: number, height?: number): Promise<string>;
|
|
109
|
+
exportSVG(): Promise<string>;
|
|
110
|
+
exportPDF(): Promise<string>;
|
|
111
|
+
exportAnimation(options?: {
|
|
112
|
+
duration?: number;
|
|
113
|
+
frameRate?: number;
|
|
114
|
+
format?: 'gif' | 'frames';
|
|
115
|
+
width?: number;
|
|
116
|
+
height?: number;
|
|
117
|
+
}): Promise<string | string[]>;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Error types
|
|
121
|
+
export class GeoGebraError extends Error {
|
|
122
|
+
constructor(message: string, public code?: string) {
|
|
123
|
+
super(message);
|
|
124
|
+
this.name = 'GeoGebraError';
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export class GeoGebraConnectionError extends GeoGebraError {
|
|
129
|
+
constructor(message: string) {
|
|
130
|
+
super(message, 'CONNECTION_ERROR');
|
|
131
|
+
this.name = 'GeoGebraConnectionError';
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export class GeoGebraCommandError extends GeoGebraError {
|
|
136
|
+
constructor(message: string, public command?: string) {
|
|
137
|
+
super(message, 'COMMAND_ERROR');
|
|
138
|
+
this.name = 'GeoGebraCommandError';
|
|
139
|
+
}
|
|
140
|
+
}
|