chili调试笔记13 工程图模块 mesh渲染 mesh共享边显示实现
把模型投影到工程图要用什么模块当工程图的画板,最后要导出dxf的
three是怎么读取他的3d数据的
mesh不是三角形吗怎么渲染出四边形面的
我想看到三角形的边怎么设置
ai让我干嘛我就干嘛
static getAllEdges(face: { positions: Float32Array; indices: Uint16Array | Uint32Array }) {const pointsMap = new Map<string, { count: number; points: number[] }>();for (let i = 0; i < face.indices.length; i += 3) {this.addEdge(pointsMap, face, face.indices[i], face.indices[i + 1]);this.addEdge(pointsMap, face, face.indices[i + 1], face.indices[i + 2]);this.addEdge(pointsMap, face, face.indices[i + 2], face.indices[i]);}return {outlineEdges: new Float32Array(Array.from(pointsMap.values()).filter((v) => v.count === 1).flatMap((entry) => entry.points),),sharedEdges: new Float32Array(Array.from(pointsMap.values()).filter((v) => v.count > 1).flatMap((entry) => entry.points),),};}
private generateShape() {const mesh = this.geometryNode.mesh;if (mesh?.faces?.positions.length) {this.initFaces(mesh.faces);// 获取所有边const allEdges = MeshUtils.getAllEdges(mesh.faces);// 创建并添加共享边if (allEdges.sharedEdges.length > 0) {const sharedEdgesMeshData: EdgeMeshData = {positions: allEdges.sharedEdges,groups: [],lineType: LineType.Solid,lineWidth: 0.5,color: 0x888888,};const buff = ThreeGeometryFactory.createEdgeBufferGeometry(sharedEdgesMeshData);const sharedEdgesMaterial = new LineMaterial({linewidth: sharedEdgesMeshData.lineWidth,color: 0xff0000,polygonOffset: true,polygonOffsetFactor: -3,polygonOffsetUnits: -3,});const sharedEdges = new LineSegments2(buff, sharedEdgesMaterial);this.add(sharedEdges);}}if (mesh?.edges?.positions.length) this.initEdges(mesh.edges);}
nb,这个deepwikiai在我认识的ai里面排名能排前三
能做布尔切除的mesh就是brep