Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
349 lines (339 loc) · 18.9 KB
/
Copy pathindex.html
File metadata and controls
349 lines (339 loc) · 18.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">
<title>可视化教学工具</title>
<link rel="stylesheet" href="css/style.css?v=10">
<script src="vendor/three.min.js"></script>
<script>
// Three.js 加载失败时回退到 CDN(优先国内可达的镜像)
if (typeof THREE === 'undefined') {
document.write('<script src="https://registry.npmmirror.com/three/0.128.0/files/build/three.min.js"><\/script>');
}
</script>
<script src="vendor/OrbitControls.min.js"></script>
<script>
if (typeof THREE === 'undefined' || typeof THREE.OrbitControls === 'undefined') {
document.write('<script src="https://registry.npmmirror.com/three/0.128.0/files/examples/js/controls/OrbitControls.min.js"><\/script>');
}
</script>
</head>
<body>
<div class="container">
<div class="controls">
<div class="control-group">
<label for="length">长:</label>
<div class="slider-container">
<input type="range" id="length" min="0.1" max="1500" value="8" step="0.1">
<input type="number" id="length-num" min="0.1" max="1500" value="8" step="0.1">
</div>
<div class="unit-selector">
<select id="length-unit">
<option value="0.000001">微米</option>
<option value="0.001">毫米</option>
<option value="1" selected>厘米</option>
<option value="10">分米</option>
<option value="100">米</option>
</select>
</div>
</div>
<div class="control-group">
<label for="width">宽:</label>
<div class="slider-container">
<input type="range" id="width" min="0.1" max="1500" value="3" step="0.1">
<input type="number" id="width-num" min="0.1" max="1500" value="3" step="0.1">
</div>
<div class="unit-selector">
<select id="width-unit">
<option value="0.000001">微米</option>
<option value="0.001">毫米</option>
<option value="1" selected>厘米</option>
<option value="10">分米</option>
<option value="100">米</option>
</select>
</div>
</div>
<div class="control-group">
<label for="height">高:</label>
<div class="slider-container">
<input type="range" id="height" min="0.1" max="1500" value="5" step="0.1">
<input type="number" id="height-num" min="0.1" max="1500" value="5" step="0.1">
</div>
<div class="unit-selector">
<select id="height-unit">
<option value="0.000001">微米</option>
<option value="0.001">毫米</option>
<option value="1" selected>厘米</option>
<option value="10">分米</option>
<option value="100">米</option>
</select>
</div>
</div>
<div class="buttons">
<button id="note" class="note-btn" title="给当前标注的目标加备注(选中模型/小方块优先,否则函数3D,否则主体)">备注</button>
<button id="reset">还原</button>
<button id="clear">清空</button>
<button id="layer-view">分层</button>
<button id="marker-mode">标记模式</button>
<button id="function-mode">函数可视化</button>
<button id="developer-mode">开发者模式</button>
<button id="math-problems">数学题目</button>
<button id="fullscreen">全屏</button>
</div>
<div class="settings-group">
<div class="settings-header">设置</div>
<label class="settings-item"><input type="checkbox" id="set-show-axes" checked> 显示 XYZ 轴</label>
<label class="settings-item"><input type="checkbox" id="set-show-ticks" checked> 显示刻度数字</label>
<label class="settings-item"><input type="checkbox" id="set-show-grid" checked> 显示网格</label>
<label class="settings-item">文字大小 <input type="range" id="set-text-scale" min="0.5" max="2" step="0.1" value="1"></label>
<div class="settings-sub">主体颜色(整体一键改全六面)</div>
<label class="settings-item"><input type="color" id="set-body-color" value="#4caf50"> 整体</label>
<div class="settings-sub">六面单独配色</div>
<div class="settings-colors">
<label title="正面(+Z)"><span>前</span><input type="color" id="face-front" value="#9e9e9e"></label>
<label title="背面(-Z)"><span>后</span><input type="color" id="face-back" value="#9e9e9e"></label>
<label title="左面(-X)"><span>左</span><input type="color" id="face-left" value="#2196f3"></label>
<label title="右面(+X)"><span>右</span><input type="color" id="face-right" value="#4caf50"></label>
<label title="顶面(+Y)"><span>上</span><input type="color" id="face-top" value="#9e9e9e"></label>
<label title="底面(-Y)"><span>下</span><input type="color" id="face-bottom" value="#9e9e9e"></label>
</div>
</div>
</div>
<div class="visualization">
<div class="volume-display">
体积 = <span id="volume">120</span> 立方厘米
</div>
<div id="cube-container">
<!-- 标记模式工具栏 -->
<div id="marker-controls" class="marker-controls" style="display:none;">
<span id="marker-count" class="marker-count">未选中</span>
<button class="marker-tool-btn active" data-tool="select" title="鼠标选择模式">选择</button>
<button class="marker-tool-btn" data-tool="move">移动</button>
<button class="marker-tool-btn" data-tool="resize">缩放</button>
<button class="marker-tool-btn" data-tool="rotate">旋转</button>
<input id="marker-size-input" type="number" class="marker-size-input" value="1" step="0.1" min="0.1" placeholder="尺寸">
<button id="marker-apply" class="marker-action-btn" title="应用尺寸">应用</button>
<span class="marker-angle-group">
<input id="marker-angle-input" type="number" class="marker-size-input" value="45" step="5" placeholder="角度">
<button id="marker-rotate-btn" class="marker-action-btn" title="按角度旋转选中">旋转</button>
</span>
<button id="marker-delete" class="marker-action-btn" title="删除选中">删除</button>
<button id="marker-note" class="marker-action-btn" title="添加备注">备注</button>
<button id="marker-clear" class="marker-action-btn" title="清空全部">清空</button>
<button id="marker-select-confirm" class="marker-action-btn" title="保存所有更改并退出标记模式">确定</button>
<button id="marker-notes-toggle" class="marker-action-btn" title="显示/隐藏备注浮层">显示备注</button>
</div>
</div>
</div>
</div>
<!-- 调试面板开关(三个点):默认收起,点击呼出/隐藏调试面板 -->
<button id="debug-dots" title="打开/收起调试面板" aria-label="调试面板">⋮</button>
<!-- 函数可视化模态窗口 -->
<div id="function-modal" class="modal">
<div class="modal-content">
<div class="modal-header">
<h3>函数可视化工具</h3>
<span class="close-modal">×</span>
</div>
<input type="text" class="function-input" id="function-expression" placeholder="输入函数表达式,如: sin(x)、2^n、π、√x、x^2+y" value="sin(x) * cos(z)">
<div class="common-functions">
<button class="function-btn" data-func="Math.sin(x)">sin(x)</button>
<button class="function-btn" data-func="Math.cos(x)">cos(x)</button>
<button class="function-btn" data-func="x*x">x²</button>
<button class="function-btn" data-func="Math.sqrt(x)">√x</button>
<button class="function-btn" data-func="Math.exp(x)">e^x</button>
<button class="function-btn" data-func="Math.log(x)">ln(x)</button>
<button class="function-btn" data-func="x*x + z*z">x² + z²</button>
<button class="function-btn" data-func="Math.sin(x) * Math.cos(z)">sin(x)·cos(z)</button>
<button class="function-btn" data-func="Math.sin(Math.sqrt(x*x+z*z))">sin(√(x²+z²))</button>
<button class="function-btn" data-func="Math.exp(-(x*x+z*z)/10)">e^(-(x²+z²)/10)</button>
<button class="function-btn" data-func="Math.atan2(x,z)">atan2(x,z)</button>
<button class="function-btn" data-func="Math.hypot(x,z)">√(x²+z²)</button>
</div>
<div class="buttons">
<button id="plot-2d">绘制2D图像</button>
<button id="plot-3d">绘制3D图像</button>
<button id="clear-function">清除函数</button>
</div>
<div class="hint">
求解鸡二面:2D 沿 x 轴绘制 y=f(x,0);点击"绘制2D"后在右下角浮动画布可拖动、缩放显示。
</div>
</div>
</div>
<!-- 2D 函数浮动画布 -->
<div id="plot2d-panel" class="plot2d-panel" style="display:none;">
<div class="plot2d-header">
<span class="plot2d-title">2D 函数图像</span>
<span class="plot2d-close">×</span>
</div>
<canvas id="plot2d-canvas" width="560" height="420"></canvas>
</div>
<!-- 开发者模式模态窗口 -->
<div id="developer-modal" class="modal">
<div class="modal-content">
<div class="modal-header">
<h3>开发者模式 - 创建几何体</h3>
<span class="close-modal">×</span>
</div>
<div class="geometry-selector">
<button class="geometry-btn active" data-type="box">长方体</button>
<button class="geometry-btn" data-type="sphere">球体</button>
<button class="geometry-btn" data-type="cylinder">圆柱体</button>
<button class="geometry-btn" data-type="cone">圆锥体</button>
<button class="geometry-btn" data-type="pyramid">金字塔</button>
<button class="geometry-btn" data-type="prism">棱柱</button>
<button class="geometry-btn" data-type="torus">圆环</button>
<button class="geometry-btn" data-type="plane">平面</button>
</div>
<div class="control-group" id="sides-group" style="display:none;">
<label for="geo-sides">边数 (棱柱/金字塔):</label>
<input type="range" id="geo-sides" min="3" max="32" value="6" step="1">
<span id="geo-sides-value">6</span>
</div>
<div class="geo-num-row">
<div class="control-group">
<label>宽(X) <input type="number" id="geo-size-x" value="5" step="0.1" min="0.1"></label>
</div>
<div class="control-group">
<label>高(Y) <input type="number" id="geo-size-y" value="5" step="0.1" min="0.1"></label>
</div>
<div class="control-group">
<label>深(Z) <input type="number" id="geo-size-z" value="5" step="0.1" min="0.1"></label>
</div>
</div>
<div class="control-group">
<label for="geo-color">颜色:</label>
<input type="color" id="geo-color" value="#3498db">
</div>
<details class="geo-advanced">
<summary>位置 / 旋转(可选,默认自动落地)</summary>
<div class="geo-num-row">
<div class="control-group">
<label>X <input type="number" id="geo-pos-x" value="0" step="1"></label>
</div>
<div class="control-group">
<label>Y <input type="number" id="geo-pos-y" value="0" step="1" placeholder="留空自动落地"></label>
</div>
<div class="control-group">
<label>Z <input type="number" id="geo-pos-z" value="0" step="1"></label>
</div>
</div>
<div class="geo-num-row">
<div class="control-group">
<label>旋转X° <input type="number" id="geo-rot-x" value="0" step="5"></label>
</div>
<div class="control-group">
<label>旋转Y° <input type="number" id="geo-rot-y" value="0" step="5"></label>
</div>
<div class="control-group">
<label>旋转Z° <input type="number" id="geo-rot-z" value="0" step="5"></label>
</div>
</div>
</details>
<div class="buttons">
<button id="add-geometry">添加到场景</button>
<button id="clear-geometry">清空几何体</button>
</div>
<hr class="geo-divider">
<div id="define-model-section">
<p class="scan-hint"><b>添加/定义模型</b>:上传三视图图片(正面/上面/左面),自动分析并生成立体,可选中后移动坐标、改大小、上色、添加备注。</p>
<div class="define-row">
<input type="file" id="define-model-input" accept="image/*">
<button id="define-model-btn">分析并定义</button>
</div>
<img id="define-preview" class="note-preview" style="display:none;">
<div id="define-result" class="scan-result"></div>
</div>
</div>
</div>
<!-- 数学题目模态窗口 -->
<div id="math-problems-modal" class="modal">
<div class="modal-content">
<div class="modal-header">
<h3>数学题目练习</h3>
<span class="close-modal">×</span>
</div>
<div class="problem-tabs">
<button class="problem-tab active" data-level="base">基础</button>
<button class="problem-tab" data-level="mid">进阶</button>
<button class="problem-tab" data-level="hard">挑战</button>
</div>
<div id="problem-answer" class="problem-answer" style="display:none;"></div>
<div class="math-problem-list" id="math-problem-list">
</div>
</div>
</div>
<!-- 注释画布模态窗口 -->
<div id="annotation-modal" class="modal">
<div class="modal-content">
<div class="modal-header">
<h3>添加注释</h3>
<span class="close-modal">×</span>
</div>
<div class="toolbar">
<button class="tool-btn active" data-tool="pen">画笔</button>
<button class="tool-btn" data-tool="eraser">橡皮擦</button>
<button class="tool-btn" data-tool="text">文字</button>
</div>
<canvas id="annotation-canvas" class="annotation-canvas" width="400" height="300"></canvas>
<div class="buttons" style="margin-top: 15px;">
<button id="save-annotation">保存注释</button>
<button id="clear-annotation">清除画布</button>
</div>
</div>
</div>
<!-- 备注模态窗口 -->
<!-- 模型编辑面板:选中自定义几何体后可移动/改大小/上色/备注 -->
<div id="model-editor" style="display:none;">
<div class="me-title"><span id="me-name">模型</span><button id="me-close">×</button></div>
<div class="me-row">
<label>X <input type="number" id="me-pos-x" step="0.5"></label>
<label>Y <input type="number" id="me-pos-y" step="0.5"></label>
<label>Z <input type="number" id="me-pos-z" step="0.5"></label>
</div>
<div class="me-row">
<label>宽 <input type="number" id="me-size-w" step="0.5" min="0.1"></label>
<label>高 <input type="number" id="me-size-h" step="0.5" min="0.1"></label>
<label>深 <input type="number" id="me-size-d" step="0.5" min="0.1"></label>
</div>
<div class="me-row">
<label>颜色 <input type="color" id="me-color" value="#3498db"></label>
</div>
<div class="me-row">
<button id="me-note">备注</button>
<button id="me-delete">删除</button>
<span id="me-tip">拖动模型可移动</span>
</div>
</div>
<div id="note-modal" class="modal">
<div class="modal-content">
<div class="modal-header">
<h3>添加备注</h3>
<span class="close-modal" onclick="document.getElementById('note-modal').style.display='none'">×</span>
</div>
<div class="note-editor">
<label>文字备注:</label>
<textarea id="note-text" rows="4" placeholder="输入文字备注..."></textarea>
<label>添加图片:</label>
<input type="file" id="note-image-input" accept="image/*">
<img id="note-image-preview" class="note-preview" style="display:none;">
<div class="buttons" style="margin-top: 15px;">
<button id="note-save">保存</button>
<button id="note-cancel">取消</button>
</div>
</div>
</div>
</div>
<script src="js/cubic.js?v=10"></script>
<script src="js/functions.js?v=10"></script>
<script src="js/developer.js?v=10"></script>
<script src="js/math.js?v=10"></script>
<script src="js/annotation.js?v=10"></script>
<script src="js/recognize.js?v=10"></script>
<script src="js/app.js?v=10"></script>
</body>
</html>