diff --git a/src/modules/amr/cc/cc5/CC53DGraphics.ts b/src/modules/amr/cc/cc5/CC53DGraphics.ts index d6e6798..18bd113 100644 --- a/src/modules/amr/cc/cc5/CC53DGraphics.ts +++ b/src/modules/amr/cc/cc5/CC53DGraphics.ts @@ -1,42 +1,37 @@ import * as THREE from "three"; import {CSG} from "three-csg-ts"; //@ts-ignore -import { mergeGeometries } from 'three/addons/utils/BufferGeometryUtils.js' +import {mergeGeometries} from 'three/addons/utils/BufferGeometryUtils.js' export default class CC53DGraphics { // 创建cc5的底座 static createCC5Pedestal(): THREE.BufferGeometry { - const width = 1.65 - const depth = 1.65 + const width = 2.15 + const lw = 0.2 + const rw = width - lw + const depth = 1.5 const dd = 0.05 - const bd = 0.175 + const bd = 0.15 const shape = new THREE.Shape() - shape.moveTo(-width / 2, -depth / 2 + bd) - shape.lineTo(-width / 2 + bd, -depth / 2) - shape.lineTo(width / 2 - bd, -depth / 2) - shape.lineTo(width / 2, -depth / 2 + bd) - - shape.lineTo(width / 2, -0.285) - shape.lineTo(-0.475, -0.285) - shape.lineTo(-0.475, -0.125) - shape.lineTo(width / 2, -0.125) - shape.lineTo(width / 2, 0.125) - shape.lineTo(-0.475, 0.125) - shape.lineTo(-0.475, 0.285) - shape.lineTo(width / 2, 0.285) - - shape.lineTo(width / 2, depth / 2 - bd) - shape.lineTo(width / 2 - bd, depth / 2) - shape.lineTo(-width / 2 + bd, depth / 2) - shape.lineTo(-width / 2, depth / 2 - bd) + + shape.moveTo(-lw, -depth / 2) + shape.lineTo(rw - bd, -depth / 2) + + shape.moveTo(rw - bd, -depth / 2 + bd) // 起点在圆心 + shape.absarc(rw - bd, -depth / 2 + bd, bd, Math.PI / 2 * 3, Math.PI * 2, false) + shape.moveTo(rw, -depth / 2 + bd) + shape.lineTo(rw, depth / 2 - bd) + shape.moveTo(rw - bd, depth / 2 - bd) // 起点在圆心 + shape.absarc(rw - bd, depth / 2 - bd, bd, 0, Math.PI / 2, false) // 从0到π绘制半圆 + shape.lineTo(-lw, depth / 2) shape.closePath() // 闭合路径 // 拉伸轨迹线 const curve = new THREE.CatmullRomCurve3( - [new THREE.Vector3(0, 0.02, 0), new THREE.Vector3(0, 0.22, 0)], + [new THREE.Vector3(0, 0.04, 0), new THREE.Vector3(0, 0.43, 0)], false, // 闭合曲线 'catmullrom', 0 @@ -76,15 +71,15 @@ export default class CC53DGraphics { const positionDs: THREE.Vector3[] = [ - new THREE.Vector3(-width / 2, 0.20, -depth / 2 + bd), - new THREE.Vector3(-width / 2 + bd, 0.20, -depth / 2), - new THREE.Vector3(width / 2 - bd, 0.20, -depth / 2), - new THREE.Vector3(width / 2, 0.20, -depth / 2 + bd), - new THREE.Vector3(width / 2, 0.20, depth / 2 - bd), - new THREE.Vector3(width / 2 - bd, 0.20, depth / 2), - new THREE.Vector3(-width / 2 + bd, 0.20, depth / 2), - new THREE.Vector3(-width / 2, 0.20, depth / 2 - bd), - new THREE.Vector3(-width / 2, 0.20, -depth / 2 + bd) + new THREE.Vector3(-lw, 0.20, -depth / 2 + bd), + new THREE.Vector3(-lw + bd, 0.20, -depth / 2), + new THREE.Vector3(rw - bd, 0.20, -depth / 2), + new THREE.Vector3(rw, 0.20, -depth / 2 + bd), + new THREE.Vector3(rw, 0.20, depth / 2 - bd), + new THREE.Vector3(rw - bd, 0.20, depth / 2), + new THREE.Vector3(-lw + bd, 0.20, depth / 2), + new THREE.Vector3(-lw, 0.20, depth / 2 - bd), + new THREE.Vector3(-lw, 0.20, -depth / 2 + bd) ] let result: THREE.Mesh = mesh @@ -112,36 +107,37 @@ export default class CC53DGraphics { meshD.updateMatrix() result = CSG.subtract(result, meshD) } + result.geometry.rotateY(-Math.PI / 2) return result.geometry } // 创建cc5的立柱 static createCC5Pillar(): THREE.BufferGeometry { // 606.5 - const width = 0.3 - const depth = 1.188 + const width = 0.46 + const depth = 1.45 const dd = 0.05 const shape = new THREE.Shape() - shape.moveTo(-0.744, -0.594 + dd) - shape.lineTo(-0.744 + dd, -0.594) - shape.lineTo(-0.744 + width - dd, -0.594) - shape.lineTo(-0.744 + width, -0.594 + dd) - - shape.lineTo(-0.744 + width, -0.4) - shape.lineTo(-0.744 + width - 0.08, -0.4) - shape.lineTo(-0.744 + width - 0.08, 0.4) - shape.lineTo(-0.744 + width, 0.4) - - shape.lineTo(-0.744 + width, -0.594 + depth - dd) - shape.lineTo(-0.744 + width - dd, -0.594 + depth) - shape.lineTo(-0.744 + dd, -0.594 + depth) - shape.lineTo(-0.744, -0.594 + depth - dd) - // shape.lineTo(-0.728, -0.594 + dd); + shape.moveTo(-0.04, -depth / 2 + dd) + shape.lineTo(-0.04 + dd, -depth / 2) + shape.lineTo(-0.04 + width - dd, -depth / 2) + shape.lineTo(-0.04 + width, -depth / 2 + dd) + + shape.lineTo(-0.04 + width, -0.4) + shape.lineTo(-0.04 + width - 0.08, -0.4) + shape.lineTo(-0.04 + width - 0.08, 0.4) + shape.lineTo(-0.04 + width, 0.4) + + shape.lineTo(-0.04 + width, -depth / 2 + depth - dd) + shape.lineTo(-0.04 + width - dd, -depth / 2 + depth) + shape.lineTo(-0.04 + dd, -depth / 2 + depth) + shape.lineTo(-0.04, -depth / 2 + depth - dd) + // shape.lineTo(-0.728, -depth / 2 + dd); // shape.closePath() // 拉伸轨迹线 const curve = new THREE.CatmullRomCurve3( - [new THREE.Vector3(0, 0.22, 0), new THREE.Vector3(0, 3.357, 0)], + [new THREE.Vector3(0, 0.43, 0), new THREE.Vector3(0, 4.922, 0)], false, // 闭合曲线 'catmullrom', 0 @@ -157,42 +153,46 @@ export default class CC53DGraphics { // 创建挤出几何体 // const material = new THREE.MeshBasicMaterial({color: 0xffdddbca}); // const mesh = new THREE.Mesh(geometry, material); - return new THREE.ExtrudeGeometry(shape, options) + const geometry = new THREE.ExtrudeGeometry(shape, options) + geometry.rotateY(-Math.PI / 2) + return geometry } // 创建cc5的叉 static createCC5Fork(): THREE.BufferGeometry { // 606.5 - const width = 0.3 - const depth = 1.188 + const width = 0.46 + const depth = 1.45 const dd = 0.05 const fdx = 0.06 const fdy = 0.03 const shape = new THREE.Shape() - shape.moveTo(-0.744 + width - 0.08, -0.4) - shape.lineTo(-0.744 + width + 0.02, -0.4) - shape.lineTo(-0.744 + width + 0.02, -0.275) - shape.lineTo(-0.744 + width + 0.02 + 1.24 - fdx, -0.275) - shape.lineTo(-0.744 + width + 0.02 + 1.24, -0.275 + fdy) - shape.lineTo(-0.744 + width + 0.02 + 1.24, -0.135 - fdy) - shape.lineTo(-0.744 + width + 0.02 + 1.24 - fdx, -0.135) - shape.lineTo(-0.744 + width + 0.02, -0.135) - shape.lineTo(-0.744 + width + 0.02, 0.135) - shape.lineTo(-0.744 + width + 0.02 + 1.24 - fdx, 0.135) - shape.lineTo(-0.744 + width + 0.02 + 1.24, 0.135 + fdy) - shape.lineTo(-0.744 + width + 0.02 + 1.24, 0.275 - fdy) - shape.lineTo(-0.744 + width + 0.02 + 1.24 - fdx, 0.275) - shape.lineTo(-0.744 + width + 0.02, 0.275) - shape.lineTo(-0.744 + width + 0.02, 0.4) - shape.lineTo(-0.744 + width - 0.08, 0.4) + const dx = 1.24 + + shape.moveTo(-0.04 + width - 0.08, -0.4) + shape.lineTo(-0.04 + width + 0.02, -0.4) + shape.lineTo(-0.04 + width + 0.02, -0.275) + shape.lineTo(-0.04 + width + 0.02 + 1.24 - fdx, -0.275) + shape.lineTo(-0.04 + width + 0.02 + 1.24, -0.275 + fdy) + shape.lineTo(-0.04 + width + 0.02 + 1.24, -0.135 - fdy) + shape.lineTo(-0.04 + width + 0.02 + 1.24 - fdx, -0.135) + shape.lineTo(-0.04 + width + 0.02, -0.135) + shape.lineTo(-0.04 + width + 0.02, 0.135) + shape.lineTo(-0.04 + width + 0.02 + 1.24 - fdx, 0.135) + shape.lineTo(-0.04 + width + 0.02 + 1.24, 0.135 + fdy) + shape.lineTo(-0.04 + width + 0.02 + 1.24, 0.275 - fdy) + shape.lineTo(-0.04 + width + 0.02 + 1.24 - fdx, 0.275) + shape.lineTo(-0.04 + width + 0.02, 0.275) + shape.lineTo(-0.04 + width + 0.02, 0.4) + shape.lineTo(-0.04 + width - 0.08, 0.4) shape.closePath() // 拉伸轨迹线 const curve = new THREE.CatmullRomCurve3( - [new THREE.Vector3(0, 0.02, 0), new THREE.Vector3(0, 1.287, 0)], + [new THREE.Vector3(dx, 0.45, 0), new THREE.Vector3(dx, 1.287, 0)], false, // 闭合曲线 'catmullrom', 0 @@ -214,15 +214,15 @@ export default class CC53DGraphics { const shapeD = new THREE.Shape() - shapeD.moveTo(-0.744 + width + 0.02, -0.3) - shapeD.lineTo(-0.744 + width + 0.02 + 1.3, -0.3) - shapeD.lineTo(-0.744 + width + 0.02 + 1.3, 0.3) - shapeD.lineTo(-0.744 + width + 0.02, 0.3) + shapeD.moveTo(-0.04 + width + 0.02, -0.3) + shapeD.lineTo(-0.04 + width + 0.02 + 1.3, -0.3) + shapeD.lineTo(-0.04 + width + 0.02 + 1.3, 0.3) + shapeD.lineTo(-0.04 + width + 0.02, 0.3) shape.closePath() // 拉伸轨迹线 const curveD = new THREE.CatmullRomCurve3( - [new THREE.Vector3(0, 0.07, 0), new THREE.Vector3(0, 1.3, 0)], + [new THREE.Vector3(dx, 0.5, 0), new THREE.Vector3(dx, 1.3, 0)], false, // 闭合曲线 'catmullrom', 0 @@ -252,6 +252,7 @@ export default class CC53DGraphics { const width = 0.08 const depth = 0.9 const dd = 0.02 + const dx = 1.24 const shape = new THREE.Shape() shape.moveTo(-width / 2, -depth / 2 + dd) shape.lineTo(-width / 2 + dd, -depth / 2) @@ -271,25 +272,25 @@ export default class CC53DGraphics { const geometries: THREE.BufferGeometry[] = [] const curveL1 = new THREE.CatmullRomCurve3( - [new THREE.Vector3(-0.35 + (isLeft ? 0.05 : 0), 0, 0), new THREE.Vector3(-0.30 + (isLeft ? 0.05 : 0), 0, 0)], + [new THREE.Vector3(-0.35 + (isLeft ? 0.05 : 0) + dx, 0, 0), new THREE.Vector3(-0.30 + (isLeft ? 0.05 : 0) + dx, 0, 0)], false, // 闭合曲线 'catmullrom', 0 ) const curveL2 = new THREE.CatmullRomCurve3( - [new THREE.Vector3(-0.15 + (isLeft ? 0.05 : 0), 0, 0), new THREE.Vector3(-0.1 + (isLeft ? 0.05 : 0), 0, 0)], + [new THREE.Vector3(-0.15 + (isLeft ? 0.05 : 0) + dx, 0, 0), new THREE.Vector3(-0.1 + (isLeft ? 0.05 : 0) + dx, 0, 0)], false, // 闭合曲线 'catmullrom', 0 ) const curveL3 = new THREE.CatmullRomCurve3( - [new THREE.Vector3(0.15 - (isLeft ? 0.05 : 0), 0, 0), new THREE.Vector3(0.1 - (isLeft ? 0.05 : 0), 0, 0)], + [new THREE.Vector3(0.15 - (isLeft ? 0.05 : 0) + dx, 0, 0), new THREE.Vector3(0.1 - (isLeft ? 0.05 : 0) + dx, 0, 0)], false, // 闭合曲线 'catmullrom', 0 ) const curveL4 = new THREE.CatmullRomCurve3( - [new THREE.Vector3(0.30 - (isLeft ? 0.05 : 0), 0, 0), new THREE.Vector3(0.35 - (isLeft ? 0.05 : 0), 0, 0)], + [new THREE.Vector3(0.30 - (isLeft ? 0.05 : 0) + dx, 0, 0), new THREE.Vector3(0.35 - (isLeft ? 0.05 : 0) + dx, 0, 0)], false, // 闭合曲线 'catmullrom', 0 @@ -297,19 +298,19 @@ export default class CC53DGraphics { if (!isLeft) { const curveBar1 = new THREE.CatmullRomCurve3( - [new THREE.Vector3(-0.36, -0.4, 0), new THREE.Vector3(0.36, -0.4, 0)], + [new THREE.Vector3(-0.36 + dx, -0.4, 0), new THREE.Vector3(0.36 + dx, -0.4, 0)], false, // 闭合曲线 'catmullrom', 0 ) const curveBar2 = new THREE.CatmullRomCurve3( - [new THREE.Vector3(-0.36, 0, 0), new THREE.Vector3(0.36, 0, 0)], + [new THREE.Vector3(-0.36 + dx, 0, 0), new THREE.Vector3(0.36 + dx, 0, 0)], false, // 闭合曲线 'catmullrom', 0 ) const curveBar3 = new THREE.CatmullRomCurve3( - [new THREE.Vector3(-0.36, 0.4, 0), new THREE.Vector3(0.36, 0.4, 0)], + [new THREE.Vector3(-0.36 + dx, 0.4, 0), new THREE.Vector3(0.36 + dx, 0.4, 0)], false, // 闭合曲线 'catmullrom', 0 @@ -368,16 +369,17 @@ export default class CC53DGraphics { const dd = 0.05 const fdx = 0.06 const fdy = 0.03 + const dx = 1.24 const shape = new THREE.Shape(); - shape.moveTo(-0.744 + 0.1, -0.5); - shape.lineTo(-0.744 + 0.1, 0.5); - shape.lineTo(-0.744 + 0.2, 0.5); - shape.lineTo(-0.744 + 0.2, -0.5); + shape.moveTo(-0.04 + 0.1, -0.5); + shape.lineTo(-0.04 + 0.1, 0.5); + shape.lineTo(-0.04 + 0.2, 0.5); + shape.lineTo(-0.04 + 0.2, -0.5); shape.closePath() const curve = new THREE.CatmullRomCurve3( - [new THREE.Vector3(0, -1.5/*0.02*/, 0), new THREE.Vector3(0, 1.287, 0)], + [new THREE.Vector3(dx, -1.5/*0.02*/, 0), new THREE.Vector3(dx, 1.287, 0)], false, // 闭合曲线 'catmullrom', 0