/* Js for , Version=1785139387 */
 if(typeof(v) != "object") v = {};v.pageID = 82;;
;
        const container = document.getElementById('canvas-container');
        // 初始化场景
        const scene = new THREE.Scene();
        scene.background = new THREE.Color(0xffffff);
        // 相机调整：增大视角以适配纵向屏幕
        const camera = new THREE.PerspectiveCamera(50, container.clientWidth / container.clientHeight, 0.1, 1000);
        camera.position.set(0, 1, 8); 
        const renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true });
        renderer.setPixelRatio(window.devicePixelRatio); // 适配视网膜高分屏
        container.appendChild(renderer.domElement);
        const labelRenderer = new THREE.CSS2DRenderer();
        labelRenderer.domElement.className = 'css-label-renderer';
        container.appendChild(labelRenderer.domElement);
        // 灯光
        const ambientLight = new THREE.AmbientLight(0xffffff, 0.7);
        scene.add(ambientLight);
        const dirLight = new THREE.DirectionalLight(0xffffff, 0.6);
        dirLight.position.set(5, 10, 7);
        scene.add(dirLight);
        // 材质定义
        const siMaterial = new THREE.MeshStandardMaterial({ color: 0x2196F3, roughness: 0.3, metalness: 0.2 });
        const hMaterial = new THREE.MeshStandardMaterial({ color: 0xcccccc, roughness: 0.3 });
        const clMaterial = new THREE.MeshStandardMaterial({ color: 0x28a745, roughness: 0.3 });
        const bondMaterial = new THREE.MeshStandardMaterial({ color: 0xdddddd });
        const moleculeGroup = new THREE.Group();
        scene.add(moleculeGroup);
        // 几何参数
        const siRadius = 0.9;
        const hRadius = 0.45;
        const clRadius = 0.75; 
        const bondRadius = 0.12;
        const bondLength = 2.0; 
        // 创建硅原子
        const siAtom = new THREE.Mesh(new THREE.SphereGeometry(siRadius, 32, 32), siMaterial);
        moleculeGroup.add(siAtom);
        addLabel(siAtom, 'Si', 'si-label');
        // 原子坐标 (四面体结构)
        const posData = [
            { pos: new THREE.Vector3(1.2, -0.8, 1.2), mat: clMaterial, rad: clRadius, lab: 'Cl', cls: 'cl-label' },
            { pos: new THREE.Vector3(-1.2, -0.8, -1.2), mat: clMaterial, rad: clRadius, lab: 'Cl', cls: 'cl-label' },
            { pos: new THREE.Vector3(0.8, 1.4, -0.8), mat: hMaterial, rad: hRadius, lab: 'H', cls: 'h-label' },
            { pos: new THREE.Vector3(-0.8, 1.4, 0.8), mat: hMaterial, rad: hRadius, lab: 'H', cls: 'h-label' }
        ];
        posData.forEach(data => {
            // 原子
            const atom = new THREE.Mesh(new THREE.SphereGeometry(data.rad, 32, 32), data.mat);
            atom.position.copy(data.pos);
            moleculeGroup.add(atom);
            addLabel(atom, data.lab, data.cls);
            // 化学键
            const dist = data.pos.length();
            const bondGeom = new THREE.CylinderGeometry(bondRadius, bondRadius, dist, 12);
            const bond = new THREE.Mesh(bondGeom, bondMaterial);
            bond.position.copy(data.pos).multiplyScalar(0.5);
            bond.quaternion.setFromUnitVectors(new THREE.Vector3(0, 1, 0), data.pos.clone().normalize());
            moleculeGroup.add(bond);
        });
        function addLabel(object, text, className) {
            const div = document.createElement('div');
            div.className = `atom-label ${className}`;
            div.textContent = text;
            const label = new THREE.CSS2DObject(div);
            object.add(label);
        }
        // 交互控制优化
        const controls = new THREE.OrbitControls(camera, renderer.domElement);
        controls.enableDamping = true;
        controls.autoRotate = true;
        controls.autoRotateSpeed = 1.0;
        controls.enablePan = false; // 手机端关闭平移，防止单指误操作
        // 响应式尺寸更新函数
        function resize() {
            const w = container.clientWidth;
            const h = container.clientHeight;
            renderer.setSize(w, h);
            labelRenderer.setSize(w, h);
            camera.aspect = w / h;
            camera.updateProjectionMatrix();
        }
        window.addEventListener('resize', resize);
        resize(); // 初始化尺寸
        function animate() {
            requestAnimationFrame(animate);
            controls.update();
            renderer.render(scene, camera);
            labelRenderer.render(scene, camera);
        }
        animate();
    