Files
Robot_Arm/web/view_lingxi.html
T

49 lines
336 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="three_inline.js"></script>
<style>
body { margin: 0; background: #12151b; overflow: hidden; font-family: sans-serif; }
#c { width: 100vw; height: 100vh; }
#info { position: absolute; top: 10px; left: 10px; color: #fff; font-size: 14px; background: rgba(0,0,0,0.7); padding: 8px 12px; border-radius: 6px; }
</style>
</head>
<body>
<div id="info">智元灵犀X1 关节03固定法兰 (6DUUEG)</div>
<canvas id="c"></canvas>
<script>
const d = {"v": [[-175.64, -57.9, -37.3], [-175.64, -57.94, -37.3], [-175.64, -57.97, -37.3], [-175.65, -58.01, -37.3], [-175.14, -57.9, -36.8], [-175.16, -58.11, -36.8], [-175.15, -58.04, -36.8], [-175.14, -57.97, -36.8], [-234.36, -57.9, -29.2], [-234.36, -57.94, -29.2], [-234.36, -57.97, -29.2], [-234.35, -58.01, -29.2], [-234.86, -57.9, -29.7], [-234.84, -58.11, -29.7], [-234.85, -58.04, -29.7], [-234.86, -57.97, -29.7], [-212.75, -51.8, -36.3], [-213.75, -51.8, -37.3], [-213.45, -54.06, -37.3], [-212.58, -56.17, -37.3], [-211.19, -57.99, -37.3], [-209.37, -59.38, -37.3], [-207.26, -60.25, -37.3], [-205.0, -60.55, -37.3], [-202.74, -60.25, -37.3], [-200.62, -59.38, -37.3], [-198.81, -57.99, -37.3], [-197.42, -56.17, -37.3], [-196.55, -54.06, -37.3], [-196.25, -51.8, -37.3], [-197.25, -51.8, -36.3], [-197.51, -53.81, -36.3], [-198.29, -55.68, -36.3], [-199.52, -57.28, -36.3], [-201.12, -58.51, -36.3], [-202.99, -59.29, -36.3], [-205.0, -59.55, -36.3], [-207.01, -59.29, -36.3], [-208.87, -58.51, -36.3], [-210.48, -57.28, -36.3], [-211.71, -55.68, -36.3], [-212.49, -53.81, -36.3], [-197.25, -51.8, -32.3], [-196.25, -51.8, -31.3], [-196.55, -54.06, -31.3], [-197.42, -56.18, -31.3], [-198.81, -57.99, -31.3], [-200.62, -59.38, -31.3], [-202.74, -60.25, -31.3], [-205.0, -60.55, -31.3], [-207.26, -60.25, -31.3], [-209.38, -59.38, -31.3], [-211.19, -57.99, -31.3], [-212.58, -56.18, -31.3], [-213.45, -54.06, -31.3], [-213.75, -51.8, -31.3], [-212.75, -51.8, -32.3], [-212.49, -53.81, -32.3], [-211.71, -55.68, -32.3], [-210.48, -57.28, -32.3], [-208.87, -58.51, -32.3], [-207.01, -59.29, -32.3], [-205.0, -59.55, -32.3], [-202.99, -59.29, -32.3], [-201.12, -58.51, -32.3], [-199.52, -57.28, -32.3], [-198.29, -55.68, -32.3], [-197.51, -53.81, -32.3], [-234.84, -58.11, -29.7], [-234.85, -58.04, -29.7], [-234.86, -57.97, -29.7], [-234.86, -57.9, -29.7], [-234.86, -57.9, -36.8], [-234.86, -57.97, -36.8], [-234.85, -58.04, -36.8], [-234.84, -58.11, -36.8], [-231.85, -128.85, -0.6], [-231.3, -128.85, -0.05], [-235.7, -128.85, -0.05], [-235.63, -129.42, -0.05], [-235.41, -129.95, -0.05], [-235.06, -130.41, -0.05], [-234.6, -130.76, -0.05], [-234.07, -130.98, -0.05], [-233.5, -131.05, -0.05], [-232.93, -130.98, -0.05], [-232.4, -130.76, -0.05], [-231.94, -130.41, -0.05], [-231.59, -129.95, -0.05], [-231.37, -129.42, -0.05], [-235.15, -128.85, -0.6], [-235.09, -129.28, -0.6], [-234.93, -129.68, -0.6], [-234.67, -130.02, -0.6], [-234.32, -130.28, -0.6], [-233.93, -130.44, -0.6], [-233.5, -130.5, -0.6], [-233.07, -130.44, -0.6], [-232.67, -130.28, -0.6], [-232.33, -130.02, -0.6], [-232.07, -129.68, -0.6], [-231.91, -129.28, -0.6], [-231.85, -128.85, -10.15], [-231.89, -128.51, -10.15], [-231.99, -128.18, -10.15], [-232.17, -127.88, -10.15], [-232.11, -128.85, -10.3], [-232.12, -128.36, -10.26], [-233.29, -130.49, -6.39], [-233.32, -130.49, -6.28], [-233.38, -130.5, -6.19], [-233.46, -130.5, -6.11], [-233.56, -130.5, -6.05], [-233.66, -130.49, -6.01], [-233.77, -130.48, -6.0], [-232.78, -130.34, -8.32], [-232.45, -130.12, -9.36], [-232.17, -129.82, -10.15], [-231.99, -129.52, -10.15], [-231.89, -129.19, -10.15], [-231.85, -128.85, -10.15], [-231.85, -128.85, -0.6], [-235.15, -128.85, -0.6], [-235.09, -129.28, -0.6], [-234.93, -129.68, -0.6], [-234.67, -130.02, -0.6], [-234.32, -130.28, -0.6], [-233.93, -130.44, -0.6], [-233.5, -130.5, -0.6], [-233.07, -130.44, -0.6], [-232.67, -130.28, -0.6], [-232.33, -130.02, -0.6], [-232.07, -129.68, -0.6], [-231.91, -129.28, -0.6], [-235.15, -128.85, -6.0], [-234.14, -130.37, -6.0], [-234.48, -130.18, -6.0], [-234.76, -129.92, -6.0], [-234.97, -129.59, -6.0], [-235.11, -129.23, -6.0], [-231.85, -138.85, -0.6], [-231.3, -138.85, -0.05], [-235.7, -138.85, -0.05], [-235.63, -139.42, -0.05], [-235.41, -139.95, -0.05], [-235.06, -140.41, -0.05], [-234.6, -140.76, -0.05], [-234.07, -140.98, -0.05], [-233.5, -141.05, -0.05], [-232.93, -140.98, -0.05], [-232.4, -140.76, -0.05], [-231.94, -140.41, -0.05], [-231.59, -139.95, -0.05], [-231.37, -139.42, -0.05], [-235.15, -138.85, -0.6], [-235.09, -139.28, -0.6], [-23
const cv = document.getElementById('c');
const rend = new THREE.WebGLRenderer({canvas: cv, antialias: true});
rend.setSize(1000, 750);
const sc = new THREE.Scene(); sc.background = new THREE.Color(0x12151b);
const cam = new THREE.PerspectiveCamera(40, 1000 / 750, 1, 1000);
sc.add(new THREE.HemisphereLight(0xffffff, 0x444444, 1.2));
const l1 = new THREE.DirectionalLight(0xffffff, 1.5); l1.position.set(200, 300, 400); sc.add(l1);
const l2 = new THREE.DirectionalLight(0x88bbff, 0.8); l2.position.set(-200, -100, -200); sc.add(l2);
const grid = new THREE.GridHelper(300, 20, 0x334455, 0x222b36); sc.add(grid);
const geo = new THREE.BufferGeometry();
const pos = new Float32Array(d.v.length * 3);
for (let i = 0; i < d.v.length; i++) { pos[i*3] = d.v[i][0]; pos[i*3+1] = d.v[i][1]; pos[i*3+2] = d.v[i][2]; }
const idx = new Uint32Array(d.t.length * 3);
for (let i = 0; i < d.t.length; i++) { idx[i*3] = d.t[i][0]; idx[i*3+1] = d.t[i][1]; idx[i*3+2] = d.t[i][2]; }
geo.setAttribute('position', new THREE.BufferAttribute(pos, 3));
geo.setIndex(new THREE.BufferAttribute(idx, 1));
geo.computeVertexNormals();
const mat = new THREE.MeshStandardMaterial({color: 0x2a75d3, metalness: 0.4, roughness: 0.4});
const m = new THREE.Mesh(geo, mat);
geo.computeBoundingSphere();
const bs = geo.boundingSphere;
m.position.sub(bs.center);
sc.add(m);
cam.position.set(bs.radius * 1.5, bs.radius * 1.3, bs.radius * 1.7);
cam.lookAt(0, 0, 0);
rend.render(sc, cam);
</script>
</body>
</html>