ss-component-new 1.2.89 → 1.2.90
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{animationData-BceOYz3t.cjs → animationData-ChnEQcWN.cjs} +1 -1
- package/dist/{animationData-cz9yaraV.js → animationData-R5RUbyuY.js} +1 -1
- package/dist/{index-DnWV9aik.js → index-43r-KEgN.js} +1 -1
- package/dist/{index-gEhfvrw9.js → index-945YmMLJ.js} +1 -1
- package/dist/{index-BBedBiu1.js → index-B3hVexQF.js} +3 -3
- package/dist/{index-CZ6HZJE2.js → index-B67-PgYw.js} +1 -1
- package/dist/{index-Ckha_JO6.js → index-BRVn_EF1.js} +2 -2
- package/dist/{index-Cx6WbHc4.cjs → index-BW7_3RoD.cjs} +1 -1
- package/dist/{index-HaBsmo21.js → index-BhhFLASG.js} +5 -5
- package/dist/{index-CrJ-2GSh.cjs → index-CGhvoFIh.cjs} +1 -1
- package/dist/{index-DlmzYZjv.js → index-CIL8wLzQ.js} +2 -2
- package/dist/{index-VAIyDbcT.js → index-CKzD8tit.js} +1 -1
- package/dist/{index-DHSqydCb.js → index-CNKc5GU4.js} +1 -1
- package/dist/{index-kJYCjFRC.cjs → index-CRBj0IE1.cjs} +1 -1
- package/dist/{index-Cx0e9wI7.cjs → index-CSASPaZP.cjs} +1 -1
- package/dist/{index-CvNF7UrX.cjs → index-Cj-t-GUv.cjs} +1 -1
- package/dist/{index-Do55CjH4.cjs → index-ClxM8xCG.cjs} +1 -1
- package/dist/{index-DLF-rZp-.js → index-CmPnaCqr.js} +12 -12
- package/dist/{index-BMd3PTaa.cjs → index-CpGj9jjq.cjs} +1 -1
- package/dist/{index-C3TG-567.js → index-CxuGIbhq.js} +1 -1
- package/dist/{index-TvxCcWL3.cjs → index-D5VkPezA.cjs} +1 -1
- package/dist/{index-DGA9Umxw.cjs → index-DBndBAmi.cjs} +1 -1
- package/dist/{index-D4L62Ng5.cjs → index-DLShoBAD.cjs} +1 -1
- package/dist/{index-Cui0eEum.cjs → index-DNWalfgy.cjs} +1 -1
- package/dist/{index-7pAPxJKA.js → index-DP_i5ftZ.js} +1 -1
- package/dist/{index-XAGbFQyj.cjs → index-DRxhdO38.cjs} +1 -1
- package/dist/{index-BIFWKFgy.cjs → index-DfghibBM.cjs} +1 -1
- package/dist/{index-CF3EDmxa.js → index-Dm2K00uW.js} +4 -4
- package/dist/{index-DwP4dBya.js → index-DsLShQZL.js} +2 -2
- package/dist/{index-DmWD_94x.cjs → index-DvSKjwnE.cjs} +1 -1
- package/dist/{index-CZQcTyH7.cjs → index-H5zWVryT.cjs} +1 -1
- package/dist/{index-BBcGTAcF.js → index-PsB2VFdd.js} +2 -2
- package/dist/{index-KosCsYsR.cjs → index-XW9cdt8O.cjs} +1 -1
- package/dist/{index-Bs_LoZjG.js → index-_PqtVmB5.js} +3 -3
- package/dist/{index-BMsn8UNC.cjs → index-bFdNa8aj.cjs} +1 -1
- package/dist/{index-_NRJBGmA.js → index-pziqfdAa.js} +1 -1
- package/dist/{index-pPR2Vmk4.js → index-s_rVCHvs.js} +1 -1
- package/dist/{index-Go9mCE8z.cjs → index-wZjCbQV_.cjs} +1 -1
- package/dist/{index.vue_vue_type_style_index_0_scoped_0b6f1a18_lang-Dsh8O5SA.js → index.vue_vue_type_style_index_0_scoped_0b6f1a18_lang-0MW1VRgy.js} +4 -4
- package/dist/{index.vue_vue_type_style_index_0_scoped_0b6f1a18_lang-D33Zn0tl.cjs → index.vue_vue_type_style_index_0_scoped_0b6f1a18_lang-1NUhtQk0.cjs} +1 -1
- package/dist/{index.vue_vue_type_style_index_0_scoped_92477073_lang-axNB8U_I.js → index.vue_vue_type_style_index_0_scoped_92477073_lang-BMKC5TVn.js} +2 -2
- package/dist/{index.vue_vue_type_style_index_0_scoped_92477073_lang-BrA_L4QZ.cjs → index.vue_vue_type_style_index_0_scoped_92477073_lang-C72Rr1SH.cjs} +1 -1
- package/dist/{index.vue_vue_type_style_index_1_lang-BLhks2a1.js → index.vue_vue_type_style_index_1_lang-C-2EhQeU.js} +1 -1
- package/dist/{index.vue_vue_type_style_index_1_lang-DmKFKo03.cjs → index.vue_vue_type_style_index_1_lang-Xo4JSq-J.cjs} +1 -1
- package/dist/{main-CtXTseBB.cjs → main-BE-iA6hW.cjs} +1 -1
- package/dist/{main-uXXF2UAJ.js → main-Bv7oX7Xn.js} +2 -2
- package/dist/ss-component.cjs +1 -1
- package/dist/ss-component.js +6 -6
- package/dist/ss-component2.cjs +1 -1
- package/dist/ss-component2.js +10 -10
- package/dist/{threeModel-CzOa_LSd.js → threeModel-BmkWoPdy.js} +2 -2
- package/dist/{threeModel-OGJISKHI.cjs → threeModel-cN3XeS9l.cjs} +1 -1
- package/dist/{threeSceneView-Fsu73EkI.cjs → threeSceneView-EIPGJRbv.cjs} +1 -1
- package/dist/{threeSceneView-Ct0gR37j.js → threeSceneView-afr3Fv7q.js} +3 -3
- package/dist/{threeSceneViewForCPMPIP-BEKYa0p7.cjs → threeSceneViewForCPMPIP-BxakXYgn.cjs} +1 -1
- package/dist/{threeSceneViewForCPMPIP-DgzzW1p5.js → threeSceneViewForCPMPIP-CR5y7Hzt.js} +3 -3
- package/dist/{threeTrackPathView-DejvRIf1.js → threeTrackPathView-CKhnsfKP.js} +4 -2
- package/dist/{threeTrackPathView-lhebTqR7.cjs → threeTrackPathView-WLhJTcJd.cjs} +2 -2
- package/dist/{threeViewerHost-BZOpA6mF.js → threeViewerHost-5yvNo1Ub.js} +1 -1
- package/dist/{threeViewerHost-cIBL_Tao.cjs → threeViewerHost-Ym_dg2DG.cjs} +1 -1
- package/dist/{workpieceTreePanel-CTj1J8en.cjs → workpieceTreePanel-CTOK6c6d.cjs} +1 -1
- package/dist/{workpieceTreePanel-UKomlBEL.js → workpieceTreePanel-D3a0Vvh1.js} +2 -2
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),n=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-QzgaFA5S.cjs"),pe=require("./OrbitControls-CqIpswqa.cjs"),me=require("./index-kJYCjFRC.cjs"),fe=require("./index.vue_vue_type_style_index_1_lang-DmKFKo03.cjs"),oe=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),re=require("./index-C8qRkCgn.cjs");function ve(z){let g=null,u=null,d=null,h=null,x=null,_=null,c=null,C=null;const D=1e3/30;let S=0;const E=e.ref([]),r=e.ref(new n.Vector3),k=e.ref(new n.Vector3),y=()=>{if(!z.value)return;g=new n.Scene,g.background=new n.Color(15790320);const m=z.value;u=new n.PerspectiveCamera(75,m.clientWidth/m.clientHeight,.1,1e4),u.position.set(8,-8,6),u.up.set(0,0,1),u.lookAt(0,0,0),d=new n.WebGLRenderer({antialias:!0,alpha:!0}),d.setSize(m.clientWidth,m.clientHeight),d.localClippingEnabled=!0,d.shadowMap.enabled=!0,d.shadowMap.type=n.PCFSoftShadowMap,d.toneMapping=n.ACESFilmicToneMapping,d.toneMappingExposure=1,d.outputColorSpace=n.SRGBColorSpace,m.appendChild(d.domElement),h=new pe.OrbitControls(u,d.domElement),h.enableDamping=!0,h.dampingFactor=.05,h.mouseButtons={LEFT:null,MIDDLE:n.MOUSE.PAN,RIGHT:n.MOUSE.ROTATE},h.panSpeed=.7,x=new n.Xe(u,d,{container:m,type:"cube",placement:"top-right",offset:{top:10,right:10},background:{color:"#D1D1D1",opacity:1},front:{label:"Top"},bottom:{label:"Front"},left:{label:"Left"},right:{label:"Right"},top:{label:"Back"},back:{label:"Bottom"}}),x.attachControls(h),f(),P()},t=(m,l)=>{c&&(g.remove(c),c.dispose()),C&&(g.remove(C),C.geometry.dispose(),C.material.dispose());const b=Math.min(Math.max(Math.floor(m/20),30),40);c=new n.GridHelper(m,b,13421772,14540253),c.rotateX(Math.PI/2),c.position.copy(l),g.add(c);const B=new n.PlaneGeometry(m,m),O=new n.ShadowMaterial({opacity:.3,color:0});C=new n.Mesh(B,O),C.position.copy(l),C.position.z-=.01,C.receiveShadow=!0,g.add(C)},p=()=>{if(E.value.length===0)return;const m=new n.Box3;let l=!1;if(E.value.forEach(X=>{if(X.userData.boundingBox)m.union(X.userData.boundingBox),l=!0;else if(X.userData.modelId&&modelBoundingBoxes.has(X.userData.modelId)){const Z=modelBoundingBoxes.get(X.userData.modelId);m.union(Z.box),l=!0}else m.expandByObject(X),l=!0}),!l){console.warn("无法计算包围盒,网格更新失败");return}const b=m.getSize(new n.Vector3),B=m.getCenter(new n.Vector3),O=Math.max(b.x,b.y,b.z),j=Math.max(O*8,50),q=new n.Vector3(B.x,B.y,m.min.z);t(j,q)},f=()=>{const m=new n.AmbientLight(4210752,.6);g.add(m);const l=new n.DirectionalLight(16777215,2);l.position.set(10,10,8),l.castShadow=!0,l.shadow.mapSize.width=4096,l.shadow.mapSize.height=4096,l.shadow.camera.near=.5,l.shadow.camera.far=50,l.shadow.camera.left=-50,l.shadow.camera.right=50,l.shadow.camera.top=50,l.shadow.camera.bottom=-50,g.add(l);const b=new n.DirectionalLight(16777215,.8);b.position.set(-8,-8,6),g.add(b);const B=new n.DirectionalLight(16777215,.6);B.position.set(0,-15,2),g.add(B);const O=new n.HemisphereLight(16777215,4473924,.8);g.add(O);const j=new n.PointLight(16777215,1,50);j.position.set(15,15,15),g.add(j);const q=new n.PointLight(16777215,.5,50);q.position.set(-15,-15,15),g.add(q)},P=()=>{_=requestAnimationFrame(P),h&&h.update();const m=performance.now(),l=m-S;l<D||(S=m-l%D,d&&g&&u&&d.render(g,u),x&&x.render())},I=m=>{["map","normalMap","bumpMap","roughnessMap","metalnessMap","emissiveMap","specularMap","envMap","lightMap","aoMap","displacementMap"].forEach(b=>{m[b]&&m[b].dispose&&m[b].dispose()}),m.dispose&&m.dispose()},A=m=>{m==null||m.traverse(l=>{l.geometry&&l.geometry.dispose(),l.material&&(Array.isArray(l.material)?l.material.forEach(b=>{I(b)}):I(l.material))})};return{currentModels:E,initialCameraPosition:r,initialTargetPosition:k,initThreeJS:y,handleResize:()=>{if(!z.value||!u||!d||!x)return;const m=z.value,l=m.clientWidth,b=m.clientHeight;u.aspect=l/b,u.updateProjectionMatrix(),d.setSize(l,b),x.update()},fitCameraToAllModels:m=>{if(!u||!h||E.value.length===0)return;const l=new n.Box3;let b=!1;if(E.value.forEach(Z=>{if(Z.userData.boundingBox)l.union(Z.userData.boundingBox),b=!0;else if(Z.userData.modelId&&m.has(Z.userData.modelId)){const ee=m.get(Z.userData.modelId);l.union(ee.box),b=!0}else l.expandByObject(Z),b=!0}),!b){console.warn("无法计算包围盒");return}const B=l.getSize(new n.Vector3),O=l.getCenter(new n.Vector3),q=Math.max(B.x,B.y,B.z)*.8,X=new n.Vector3(O.x+q,O.y-q,O.z+q);u.position.copy(X),u.lookAt(O),h.target.copy(O),h.update(),r.value.copy(X),k.value.copy(O),p()},getThreeJSObjects:()=>({scene:g,camera:u,renderer:d,controls:h,gizmo:x}),clearAllModels:()=>{if(!g)return;E.value.forEach(l=>{g.remove(l),A(l)});const m=[];g.children.forEach(l=>{!l.isLight&&!l.isCamera&&l.type!=="GridHelper"&&l!==C&&m.push(l)}),m.forEach(l=>{g.remove(l),A(l)}),E.value=[],p()},cleanup:()=>{_&&cancelAnimationFrame(_),c&&c.dispose(),C&&(C.geometry.dispose(),C.material.dispose()),d&&d.dispose(),h&&h.dispose(),x&&x.dispose()},updateGridForModels:p}}function ge(z,g){const u=e.ref(!1);let d=null,h=12700,x=new n.Vector3,_=new n.Vector3,c=new n.Vector3,C=0,F=null;const D=t=>t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2,S=t=>{const p=new n.Vector3,f=C*1.2,P=new n.Vector3(c.x+f,c.y,c.z),I=new n.Vector3(c.x,c.y+f,c.z),A=new n.Vector3(c.x,c.y-f,c.z);if(t<=.567){const $=t/.567*Math.PI*2;p.x=c.x+Math.cos($)*f,p.z=c.z+Math.sin($)*f,p.y=c.y}else if(t<=.724){const L=(t-.567)/.157,$=D(L);p.lerpVectors(P,I,$)}else if(t<=.881){const L=(t-.724)/.157,J=D(L)*Math.PI;p.x=c.x+Math.sin(J)*f,p.y=c.y+Math.cos(J)*f,p.z=c.z}else{const L=(t-.881)/.119,$=D(L);p.lerpVectors(A,x,$)}return p},E=()=>{const{camera:t,controls:p}=z();if(!t||!p)return;d||(d=Date.now());const f=Date.now()-d,P=Math.min(f/h,1);if(P>=1){k();return}const I=S(P);t.position.copy(I),t.lookAt(c),p.target.copy(c),F=requestAnimationFrame(E)},r=()=>{if(g.value.length===0)return;const{camera:t,controls:p}=z();if(!t||!p)return;x.copy(t.position),_.copy(p.target);const f=new n.Box3;g.value.forEach(G=>{f.expandByObject(G)});const P=f.getSize(new n.Vector3);c=f.getCenter(new n.Vector3),C=Math.max(P.x,P.y,P.z)*1.2;const I=new n.Vector3(c.x+C*1.2,c.y,c.z);p.enabled=!1;const A=t.position.clone(),L=1e3,$=Date.now(),J=()=>{const G=Date.now()-$,Y=Math.min(G/L,1),m=D(Y);t.position.lerpVectors(A,I,m),t.lookAt(c),p.target.copy(c),Y<1?requestAnimationFrame(J):(u.value=!0,d=null,E())};J()},k=()=>{u.value=!1,d=null,F&&(cancelAnimationFrame(F),F=null);const{controls:t}=z();t&&(t.enabled=!0,t.target.copy(_))};return{isAnimating:u,toggleAnimation:()=>{if(u.value){u.value=!1,d=null,F&&(cancelAnimationFrame(F),F=null);const{camera:t,controls:p}=z();if(!t||!p)return;p.enabled=!0;const f=t.position.clone(),P=p.target.clone(),I=1500,A=Date.now(),L=()=>{const $=Date.now()-A,J=Math.min($/I,1),G=D(J);t.position.lerpVectors(f,x,G),p.target.lerpVectors(P,_,G),J<1&&requestAnimationFrame(L)};L()}else r()},startAnimation:r,stopAnimation:k}}function he(z,g){const u=e.ref(!1),d=e.ref("none");let h=[],x=[],_=new n.Box3,c=new n.Vector3;const C=()=>{h=[new n.Plane(new n.Vector3(1,0,0),0),new n.Plane(new n.Vector3(0,1,0),0),new n.Plane(new n.Vector3(0,0,1),0)]},F=()=>{_.makeEmpty(),g.value.forEach(y=>{_.expandByObject(y)}),c=_.getCenter(new n.Vector3)},D=y=>{const t=_.getSize(new n.Vector3);let p,f,P;y==="x"?(p=new n.PlaneGeometry(t.z*1.2,t.y*1.2),f=new n.Vector3(c.x,c.y,c.z),P=new n.Euler(0,Math.PI/2,0)):y==="y"?(p=new n.PlaneGeometry(t.x*1.2,t.z*1.2),f=new n.Vector3(c.x,c.y,c.z),P=new n.Euler(Math.PI/2,0,0)):y==="z"&&(p=new n.PlaneGeometry(t.x*1.2,t.y*1.2),f=new n.Vector3(c.x,c.y,c.z),P=new n.Euler(0,0,0));const I=new n.MeshPhongMaterial({color:8900331,transparent:!0,opacity:.3,side:n.DoubleSide,depthWrite:!1}),A=new n.Mesh(p,I);return A.position.copy(f),A.rotation.copy(P),A},S=()=>{if(E(),r(),d.value==="none")return;F();let y=null;if(d.value==="x"?(h[0].constant=-c.x,y=h[0]):d.value==="y"?(h[1].constant=-c.y,y=h[1]):d.value==="z"&&(h[2].constant=-c.z,y=h[2]),y){g.value.forEach(p=>{p.traverse(f=>{f.isMesh&&f.material&&(Array.isArray(f.material)?f.material.forEach(P=>{P.clippingPlanes=[y]}):f.material.clippingPlanes=[y])})});const{scene:t}=z();if(t){const p=D(d.value);t.add(p),x.push(p)}}},E=()=>{g.value.forEach(y=>{y.traverse(t=>{t.isMesh&&t.material&&(Array.isArray(t.material)?t.material.forEach(p=>{p.clippingPlanes=[]}):t.material.clippingPlanes=[])})})},r=()=>{const{scene:y}=z();y&&x.forEach(t=>{y.remove(t),t.geometry.dispose(),t.material.dispose()}),x=[]};return{isClipping:u,activeClippingAxis:d,toggleClipping:()=>{u.value=!u.value,u.value?(C(),g.value.length>0&&F()):(d.value="none",E(),r())},updateClippingPlanes:S,clearClippingPlanes:E,clearClippingMeshes:r}}const ye={class:"panel-content"},we={__name:"animationPanel",props:{animationData:Object,model:Object},setup(z){const g=z;e.ref();const u=e.ref();return e.watch(()=>[g==null?void 0:g.animationData],()=>{var h;let d=((h=re.cloneDeep(g==null?void 0:g.animationData))==null?void 0:h["输出(动画数据)Content"])??[];d&&(u.value=d)},{deep:!0,immediate:!0}),(d,h)=>{var x,_,c;return e.openBlock(),e.createElementBlock("div",ye,[(e.openBlock(),e.createBlock(me.ssTable,{itemData:(x=u.value)==null?void 0:x.compData,key:(_=u.value)==null?void 0:_.id,index:(c=u.value)==null?void 0:c.id,showHeader:!1},null,8,["itemData","index"]))])}}},xe=oe._export_sfc(we,[["__scopeId","data-v-2387536e"]]),Ve={class:"panel-content"},Me={key:0,class:"joints-list"},ke={class:"joint-info-row"},_e={class:"joint-left"},Pe={class:"joint-name"},Ce={class:"joint-range"},Ee={class:"joint-type"},be={key:0,class:"joint-control-row"},ze={class:"slider-container"},De=["min","max","value","onInput","disabled"],Ne={class:"value-display"},Se={class:"joint-value"},Be={class:"unit"},Ae={key:1,class:"empty-state"},ae=.001,Re=1e3,ue=60,Fe={__name:"jointPanel",props:{model:Object,scene:Object,animationData:Object},setup(z,{expose:g}){const u=z;e.ref(!0);const d=e.ref([]),h=e.ref(null),x=e.ref(null),_=e.ref(12.5),c=e.ref(),C=e.ref(1302),F=e.ref(30),D=e.ref(!1),S=e.ref(!1),E=e.ref(0),r=e.ref(0),k=e.ref(null),y=n.MathUtils.degToRad,t=e.ref(1),p=()=>Re/ue/t.value;let f=[];e.watch(()=>u.animationData,o=>{var i;C.value=o.extra.管长,_.value=o.extra.外径/2;let v=((i=re.cloneDeep(o))==null?void 0:i["输出(动画数据)"])??[];v&&v.length>0&&(f=v)},{deep:!0}),e.computed(()=>f.length>0);const P=(o,v=!1)=>o==="revolute"?v?Math.PI:-Math.PI:o==="prismatic"?v?1:-1:0,I=()=>{if(!h.value)return re.ElMessage.error("未加载 URDF"),!1;let o=null;return h.value.traverse(v=>{o||v.name==="Pipe_Link"&&v.traverse(i=>{i instanceof n.Mesh&&!o&&(o=i)})}),o?(o.position.y-=F.value*ae,c.value=o,o.material=new n.MeshPhongMaterial({color:11184810,shininess:80,side:n.DoubleSide}),!0):(re.ElMessage.error('在 "Pipe_Link" 内未找到任何 Mesh'),!1)},A=o=>{if(!o||!o.joints)return console.warn("URDF模型没有关节信息"),[];let v=null;if(o.traverse(V=>{V.name==="Pipe_Link"&&!v&&(v=V)}),v)c.value=v;else return console.warn("未找到管子模型"),[];const i=[];return Object.keys(o.joints).forEach(V=>{const s=o.joints[V];if(s._jointType==="fixed")return;const a=s.limit?{lower:s.limit.lower??P(s._jointType,!1),upper:s.limit.upper??P(s._jointType,!0)}:{lower:P(s._jointType,!1),upper:P(s._jointType,!0)};i.push({name:V,type:s._jointType||"unknown",limit:a,currentValue:s.angle||0,urdfJoint:s})}),i.sort((V,s)=>V.name.localeCompare(s.name))},L=(o,v)=>{const i=d.value.find(s=>s.name===o);if(!i)return;const V=parseFloat(v);if(i.limit){const s=Math.max(i.limit.lower,Math.min(i.limit.upper,V));i.currentValue=s}else i.currentValue=V;u.model&&u.model.setJointValue?u.model.setJointValue(o,i.currentValue):i.urdfJoint&&i.urdfJoint.setJointValue(i.currentValue)},$=o=>o.reduce((v,i)=>{let V=0;const s=i.Y??0,a=i.C??0,w=i.R??0;return s>0&&(V+=s),a>0&&w>0&&(V+=w*y(a)),v+V},0),J=o=>{const v=[],i=o.Y??0,V=o.B??0,s=o.C??0,a=o.R??0,w={pos:new n.Vector3(0,0,0),localY:new n.Vector3(0,1,0),localX:new n.Vector3(1,0,0),localZ:new n.Vector3(0,0,1)};if(!i&&!s)return v;if(v.push(w.pos.clone()),V!==0){const U=new n.Matrix4().makeRotationAxis(w.localY,y(V));w.localX.applyMatrix4(U),w.localZ.applyMatrix4(U)}if(i>0&&(w.pos.add(w.localY.clone().multiplyScalar(i*ae)),v.push(w.pos.clone())),s>0&&a>0){const U=y(s),T=a*ae,W=w.pos.clone().add(w.localX.clone().multiplyScalar(-T)),R=Math.max(16,Math.ceil(s/5));for(let M=1;M<=R;M++){const H=U*M/R,K=new n.Matrix4().makeRotationAxis(w.localZ,H),se=w.localX.clone().multiplyScalar(T).applyMatrix4(K),ie=W.clone().add(se);v.push(ie)}}return v},G=(o,v=0)=>{let i=f.slice(0,o+1);const V=f[o+1];if(V&&v>0){const R={...V,B:(V.B??0)*v,C:(V.C??0)*v};i.push(R)}const s=$(i),a=Math.max(0,C.value-s),w=[];w.push(new n.Vector3(0,0,0));const U=new n.Vector3(0,a*ae,0);a>0&&w.push(U);let T={pos:U.clone(),localY:new n.Vector3(0,1,0),localX:new n.Vector3(1,0,0),localZ:new n.Vector3(0,0,1)};const W=[];for(let R=i.length-1;R>=0;R--){const M=i[R],H=J(M);if(H.length>0){const K=H.map(Q=>{const ne=Q.clone(),de=new n.Matrix4;return de.makeBasis(T.localX,T.localY,T.localZ),ne.applyMatrix4(de),ne.add(T.pos)});W.push(K);const te=K[K.length-1];T.pos=te.clone();const se=M.B??0,ie=M.C??0;if(se!==0){const Q=new n.Matrix4().makeRotationAxis(T.localY,y(se));T.localX.applyMatrix4(Q),T.localZ.applyMatrix4(Q)}if(ie>0){const Q=y(ie),ne=new n.Matrix4().makeRotationAxis(T.localZ,Q);T.localY.applyMatrix4(ne),T.localX.applyMatrix4(ne)}}}for(const R of W)R.length>1&&w.push(...R.slice(1));w.length<2&&w.push(new n.Vector3(0,.001,0));try{const R=new n.CatmullRomCurve3(w,!1,"catmullrom",.01),M=new n.TubeGeometry(R,Math.max(2,w.length*4),_.value*ae,18,!1);c.value.geometry.dispose(),c.value.geometry=M}catch(R){console.error("管件更新失败",R)}},Y=(o,v,i=1)=>{o&&(Object.keys(o).forEach(V=>{const s=o[V],a=d.value.find(w=>w.name===V);a&&(a.currentValue=s,u.model&&u.model.setJointValue?u.model.setJointValue(V,s):a.urdfJoint&&a.urdfJoint.setJointValue(s))}),G(v,i))},m=(o,v,i)=>o+(v-o)*i,l=(o,v,i)=>{if(!o||!v)return o||v;const V={};return Object.keys(o).forEach(s=>{const a=o[s],w=v[s];V[s]=m(a,w||a,i)}),V},b=()=>{if(f.length===0){console.warn("没有动画数据");return}I(),D.value=!0,S.value=!1,E.value=0,r.value=0,B()},B=()=>{if(!D.value||S.value)return;const o=E.value;if(o>=f.length-1){const s=f[f.length-1];Y(s,f.length-1,1),j();return}const v=r.value/ue,i=f[o],V=f[o+1];if(V){const s=l(i,V,v);Y(s,o,v)}else Y(i,o);r.value++,r.value>ue&&(r.value=0,E.value++),k.value=setTimeout(B,p())},O=()=>{S.value=!0,k.value&&(clearTimeout(k.value),k.value=null)},j=()=>{D.value=!1,S.value=!1,t.value=1,k.value&&(clearTimeout(k.value),k.value=null)};g({startAnimation:b,pauseAnimation:O,stopAnimation:j,resetAll:()=>{j(),E.value=0,r.value=0,d.value.forEach(o=>{(o.type==="revolute"||o.type==="prismatic")&&L(o.name,0)}),G(-1,0)},fastForward:()=>{t.value<4&&(t.value=Math.min(4,t.value*2))},fastBackward:()=>{t.value>.25&&(t.value=Math.max(.25,t.value/2))}}),e.watch(()=>u.model,o=>{o?(h.value=o,d.value=A(o)):d.value=[]},{immediate:!0});const ee=()=>{!u.model||D.value&&!S.value||d.value.forEach(o=>{o.urdfJoint&&o.urdfJoint.angle!==void 0&&(o.currentValue=o.urdfJoint.angle)})},le=()=>{const o=()=>{ee(),x.value=requestAnimationFrame(o)};o()},ce=()=>{x.value&&(cancelAnimationFrame(x.value),x.value=null)};return e.onMounted(()=>{le()}),e.onUnmounted(()=>{ce(),j()}),(o,v)=>(e.openBlock(),e.createElementBlock("div",Ve,[d.value.length>0?(e.openBlock(),e.createElementBlock("div",Me,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,i=>{var V,s,a,w;return e.openBlock(),e.createElementBlock("div",{key:i.name,class:"joint-item"},[e.createElementVNode("div",ke,[e.createElementVNode("div",_e,[e.createElementVNode("span",Pe,e.toDisplayString(i.name),1),e.createElementVNode("span",Ce," ["+e.toDisplayString(((V=i.limit)==null?void 0:V.lower.toFixed(2))??(i.type==="revolute"?"-3.14":"-1.00"))+", "+e.toDisplayString(((s=i.limit)==null?void 0:s.upper.toFixed(2))??(i.type==="revolute"?"3.14":"1.00"))+"] ",1)]),e.createElementVNode("span",Ee,e.toDisplayString(i.type),1)]),i.type==="revolute"||i.type==="prismatic"?(e.openBlock(),e.createElementBlock("div",be,[e.createElementVNode("div",ze,[e.createElementVNode("input",{type:"range",min:((a=i.limit)==null?void 0:a.lower)??(i.type==="revolute"?-Math.PI:-1),max:((w=i.limit)==null?void 0:w.upper)??(i.type==="revolute"?Math.PI:1),step:.01,value:i.currentValue,onInput:U=>L(i.name,U.target.value),class:"joint-slider",disabled:D.value&&!S.value},null,40,De)]),e.createElementVNode("div",Ne,[e.createElementVNode("span",Se,e.toDisplayString(i.currentValue?Number(i.currentValue).toFixed(3):"0.000"),1),e.createElementVNode("span",Be,e.toDisplayString(i.type==="revolute"?"rad":"m"),1)])])):e.createCommentVNode("",!0)])}),128))])):(e.openBlock(),e.createElementBlock("div",Ae,v[0]||(v[0]=[e.createElementVNode("p",null,"未检测到可控制的关节",-1)])))]))}},Te=oe._export_sfc(Fe,[["__scopeId","data-v-035ae936"]]),Le={class:"panel-content"},Ie="id",$e={__name:"urdfTree",props:{model:Object,maxExpandCount:{type:Number,default:10},expandStrategy:{type:String,default:"breadth",validator:z=>["breadth","firstLevel"].includes(z)}},emits:["nodeClick"],setup(z,{emit:g}){const u=z,d=g,h=e.ref([]),x={children:"children",label:"label"},_=r=>{d("nodeClick",r)},c=(r,k=0)=>{const y=[];return Array.isArray(r)&&(r==null?void 0:r.length)>0&&r.forEach(t=>{if(!(t!=null&&t.isMesh)&&((t==null?void 0:t.type)==="URDFJoint"||(t==null?void 0:t.type)==="URDFLink")){const p={name:t==null?void 0:t.name,label:t==null?void 0:t.name,show:!0,level:k+1,isPenultimate:!1,type:t==null?void 0:t.type,id:t==null?void 0:t.id,limit:(t==null?void 0:t.limit)??"",children:c(t==null?void 0:t.children,k+1),path:t==null?void 0:t.name};y.push(p)}}),y},C=r=>r?[{name:r==null?void 0:r.name,label:r==null?void 0:r.name,show:!0,level:1,isPenultimate:!1,type:r==null?void 0:r.type,id:r==null?void 0:r.id,limit:(r==null?void 0:r.limit)??"",children:c(r==null?void 0:r.children,1),path:r==null?void 0:r.name}]:[],F=(r,k)=>{const y=[],t=[...r];for(;t.length>0&&y.length<k;){const p=t.shift();p.children&&p.children.length>0&&(y.push(p.id),t.push(...p.children))}return y},D=(r,k)=>{const y=[];return r.forEach(t=>{if(t.children&&t.children.length>0){y.push(t.id);const p=t.children.filter(f=>f.children&&f.children.length>0).slice(0,k).map(f=>f.id);y.push(...p)}}),y.slice(0,k+1)},S=e.computed(()=>!h.value||h.value.length===0?[]:u.expandStrategy==="firstLevel"?D(h.value,u.maxExpandCount):F(h.value,u.maxExpandCount)),E=e.computed(()=>u!=null&&u.model?C(u.model):[]);return e.watch(E,r=>{h.value=JSON.parse(JSON.stringify(r))},{immediate:!0}),(r,k)=>{const y=e.resolveComponent("el-tree");return e.openBlock(),e.createElementBlock("div",Le,[e.createVNode(y,{data:h.value,props:x,"default-expanded-keys":S.value,"node-key":Ie,onNodeClick:_},null,8,["data","default-expanded-keys"])])}}},Je=oe._export_sfc($e,[["__scopeId","data-v-290ff4e1"]]),Oe=["xlink:href"],Ue=e.defineComponent({__name:"svgIcon",props:{backgroundColor:{default:"#f0f0f0"},prefix:{default:"icon"},name:{},size:{default:16},spin:{type:Boolean,default:!1},active:{type:Boolean,default:!1}},setup(z){const g=z,u=e.computed(()=>({backgroundColor:g.backgroundColor})),d=e.computed(()=>`#${g.prefix}-${g.name}`),h=e.computed(()=>{const{size:x}=g;let _=`${x}`;return _=`${_.replace("px","")}px`,{width:_,height:_}});return(x,_)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["container",{active:x.active}]),style:e.normalizeStyle(u.value)},[(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["svg-icon",[x.$attrs.class,x.spin&&"svg-icon-spin"]]),style:e.normalizeStyle(h.value),"aria-hidden":"true"},[e.createElementVNode("use",{"xlink:href":d.value},null,8,Oe)],6))],6))}}),N=oe._export_sfc(Ue,[["__scopeId","data-v-3150a90b"]]),Ge={class:"obj-viewer-container"},je={class:"buttonGroup-top"},qe={class:"buttonGroup-topLeft"},Xe={class:"buttonGroup-left"},He={class:"buttonGroup-right"},Ye={class:"buttonGroup-bottom"},Ze={class:"left-panel"},We={class:"panel-header"},Ke={key:1,class:"clipping-content"},Qe={class:"radio-group"},et={class:"radio-label"},tt={class:"radio-label"},nt={class:"radio-label"},at={class:"radio-label"},ot={class:"right-panel"},lt={class:"panel-header"},st={key:0,class:"loading-overlay"},it={__name:"threeModel",props:{animationData:{type:Object,default:()=>{}}},emits:["getAnimationData"],setup(z,{expose:g,emit:u}){const d=u;let h=null,x=!1;const _=e.ref(null),c=e.ref(!1),C=e.ref("");e.ref(!1);const F=e.ref(!1),D=e.ref(!1),S=e.ref(""),E=e.ref(!1),r=e.ref(""),k=e.ref(),{currentModels:y,initialCameraPosition:t,initialTargetPosition:p,initThreeJS:f,handleResize:P,fitCameraToAllModels:I,getThreeJSObjects:A,clearAllModels:L,cleanup:$}=ve(_),{isAnimating:J,toggleAnimation:G,stopAnimation:Y}=ge(A,y),{isClipping:m,activeClippingAxis:l,toggleClipping:b,updateClippingPlanes:B}=he(A,y),{addModelsFromUrls:O,loadModelByDefaultPath:j,urdfModel:q,modelBoundingBoxes:X}=fe.useModelLoader(A,y,c,C,L),Z=()=>{if(F.value||y.value.length===0)return;F.value=!0,J.value&&Y();const{camera:s,controls:a}=A();if(!s||!a)return;a.enabled=!0;const w=H=>H<.5?4*H*H*H:1-Math.pow(-2*H+2,3)/2,U=s.position.clone(),T=a.target.clone(),W=1500,R=Date.now(),M=()=>{const H=Date.now()-R,K=Math.min(H/W,1),te=w(K);s.position.lerpVectors(U,t.value,te),a.target.lerpVectors(T,p.value,te),K<1?requestAnimationFrame(M):F.value=!1};M()},ee=async()=>x?Promise.resolve():new Promise(s=>{const a=()=>{x?s():requestAnimationFrame(a)};a()}),le=async(s,a)=>{try{await ee(),J.value&&Y(),m.value&&b();const w=await a(s);return I(X),w}catch(w){throw console.error("加载模型失败:",w),w}},ce=async s=>le(s,O),o=async s=>le(s,j),v=s=>{D.value=!0,S.value=s,s==="剖面视图"&&!m.value&&b()},i=s=>{E.value=!0,r.value=s,s==="动画仿真"&&d("getAnimationData")},V=()=>{e.nextTick(()=>{var s;(s=k.value)==null||s.startAnimation()})};return e.onMounted(async()=>{await e.nextTick();try{f(),h=A().scene,x=!0,window.addEventListener("resize",P)}catch(s){console.error("Three.js初始化失败:",s)}}),e.onBeforeUnmount(()=>{x=!1,S.value="",r.value="",window.removeEventListener("resize",P),J.value&&Y(),$()}),g({addModelsFromUrls:ce,loadModelByDefaultPath:o}),(s,a)=>{var U,T,W,R;const w=e.resolveComponent("el-scrollbar");return e.openBlock(),e.createElementBlock("div",Ge,[e.createElementVNode("div",{ref_key:"threejsContainer",ref:_,class:"threejs-container"},null,512),e.createElementVNode("div",je,[e.createVNode(N,{name:"guanjianjiexi",size:"34"}),e.createVNode(N,{name:"guanjiekongzhi",size:"34"}),e.createVNode(N,{name:"gongyishengcheng",size:"34"}),e.createVNode(N,{name:"buchangshezhi",size:"34"}),e.createVNode(N,{name:"shuchujiagongchengxu",size:"34"})]),e.createElementVNode("div",qe,[e.createVNode(N,{name:"viewReset",size:"24",onClick:Z,title:"重置"}),e.createVNode(N,{name:"fangda",size:"24",title:"放大"}),e.createVNode(N,{name:"suoxiao",size:"24",title:"缩小"}),e.createVNode(N,{name:"lookAround",size:"24",onClick:e.unref(G),title:e.unref(J)?"停止动画":"动画视图"},null,8,["onClick","title"])]),e.createElementVNode("div",Xe,[e.createVNode(N,{name:"jiegoushu",size:"24",onClick:a[0]||(a[0]=M=>v("场景树")),active:D.value&&S.value==="场景树",title:"场景树"},null,8,["active"]),e.createVNode(N,{name:"clipping",size:"24",onClick:a[1]||(a[1]=M=>v("剖面视图")),active:D.value&&S.value==="剖面视图",title:"剖面视图"},null,8,["active"]),e.createVNode(N,{name:"donghuafangzhen",size:"24",onClick:a[2]||(a[2]=M=>v("场景树3"))}),e.createVNode(N,{name:"donghuafangzhen",size:"24",onClick:a[3]||(a[3]=M=>v("场景4"))})]),e.createElementVNode("div",He,[e.createVNode(N,{name:"donghuafangzhen",size:"24"}),e.createVNode(N,{name:"donghuafangzhen",size:"24"}),e.createVNode(N,{name:"guanjiekongzhi",size:"24",onClick:a[4]||(a[4]=M=>i("关节控制")),active:E.value&&r.value==="关节控制",title:"关节控制"},null,8,["active"]),e.createVNode(N,{name:"donghuafangzhen",size:"24",title:"动画仿真",onClick:a[5]||(a[5]=M=>i("动画仿真")),active:E.value&&r.value==="动画仿真"},null,8,["active"]),e.createVNode(N,{name:"donghuafangzhen",size:"24"}),e.createVNode(N,{name:"donghuafangzhen",size:"24"})]),e.createElementVNode("div",Ye,[e.createVNode(N,{name:"kuaitui",size:"24",backgroundColor:"#ffffff",title:"快退",onClick:(U=k.value)==null?void 0:U.fastBackward},null,8,["onClick"]),e.createVNode(N,{name:"bofang",size:"24",backgroundColor:"#ffffff",title:"播放",onClick:V}),e.createVNode(N,{name:"kuaijin",size:"24",backgroundColor:"#ffffff",title:"快进",onClick:(T=k.value)==null?void 0:T.fastForward},null,8,["onClick"]),e.createVNode(N,{name:"zanting",size:"24",backgroundColor:"#ffffff",title:"暂停",onClick:(W=k.value)==null?void 0:W.pauseAnimation},null,8,["onClick"]),e.createVNode(N,{name:"zhongzhi",size:"24",backgroundColor:"#ffffff",title:"停止",onClick:(R=k.value)==null?void 0:R.resetAll},null,8,["onClick"])]),e.withDirectives(e.createElementVNode("div",Ze,[e.createElementVNode("div",We,[e.createElementVNode("span",null,e.toDisplayString(S.value),1),e.createElementVNode("span",{class:"close",onClick:a[6]||(a[6]=M=>D.value=!1)}," X ")]),e.createVNode(w,{"max-height":"650px"},{default:e.withCtx(()=>[S.value==="场景树"?(e.openBlock(),e.createBlock(Je,{key:0,model:e.unref(q)},null,8,["model"])):e.createCommentVNode("",!0),S.value==="剖面视图"?(e.openBlock(),e.createElementBlock("div",Ke,[e.createElementVNode("div",Qe,[e.createElementVNode("label",et,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"none","onUpdate:modelValue":a[7]||(a[7]=M=>e.isRef(l)?l.value=M:null),onChange:a[8]||(a[8]=(...M)=>e.unref(B)&&e.unref(B)(...M))},null,544),[[e.vModelRadio,e.unref(l)]]),a[16]||(a[16]=e.createElementVNode("span",{class:"radio-text"},"无切割",-1))]),e.createElementVNode("label",tt,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"x","onUpdate:modelValue":a[9]||(a[9]=M=>e.isRef(l)?l.value=M:null),onChange:a[10]||(a[10]=(...M)=>e.unref(B)&&e.unref(B)(...M))},null,544),[[e.vModelRadio,e.unref(l)]]),a[17]||(a[17]=e.createElementVNode("span",{class:"radio-text"},"X轴切割",-1))]),e.createElementVNode("label",nt,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"y","onUpdate:modelValue":a[11]||(a[11]=M=>e.isRef(l)?l.value=M:null),onChange:a[12]||(a[12]=(...M)=>e.unref(B)&&e.unref(B)(...M))},null,544),[[e.vModelRadio,e.unref(l)]]),a[18]||(a[18]=e.createElementVNode("span",{class:"radio-text"},"Y轴切割",-1))]),e.createElementVNode("label",at,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"z","onUpdate:modelValue":a[13]||(a[13]=M=>e.isRef(l)?l.value=M:null),onChange:a[14]||(a[14]=(...M)=>e.unref(B)&&e.unref(B)(...M))},null,544),[[e.vModelRadio,e.unref(l)]]),a[19]||(a[19]=e.createElementVNode("span",{class:"radio-text"},"Z轴切割",-1))])])])):e.createCommentVNode("",!0)]),_:1})],512),[[e.vShow,D.value]]),e.withDirectives(e.createElementVNode("div",ot,[e.createElementVNode("div",lt,[e.createElementVNode("span",null,e.toDisplayString(r.value),1),e.createElementVNode("span",{class:"close",onClick:a[15]||(a[15]=M=>E.value=!1)}," X ")]),e.createVNode(w,{"max-height":"650px"},{default:e.withCtx(()=>[e.withDirectives(e.createVNode(Te,{ref_key:"jointRef",ref:k,model:e.unref(q),scene:e.unref(h),animationData:z.animationData},null,8,["model","scene","animationData"]),[[e.vShow,r.value==="关节控制"]]),e.withDirectives(e.createVNode(xe,{animationData:z.animationData},null,8,["animationData"]),[[e.vShow,r.value==="动画仿真"]])]),_:1})],512),[[e.vShow,E.value]]),c.value?(e.openBlock(),e.createElementBlock("div",st,[a[20]||(a[20]=e.createElementVNode("div",{class:"loading-spinner"},null,-1)),e.createElementVNode("p",null,e.toDisplayString(C.value),1)])):e.createCommentVNode("",!0)])}}},rt=oe._export_sfc(it,[["__scopeId","data-v-7bc47bb3"]]);exports.default=rt;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),n=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-QzgaFA5S.cjs"),pe=require("./OrbitControls-CqIpswqa.cjs"),me=require("./index-CRBj0IE1.cjs"),fe=require("./index.vue_vue_type_style_index_1_lang-Xo4JSq-J.cjs"),oe=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),re=require("./index-C8qRkCgn.cjs");function ve(z){let g=null,u=null,d=null,h=null,x=null,_=null,c=null,C=null;const D=1e3/30;let S=0;const E=e.ref([]),r=e.ref(new n.Vector3),k=e.ref(new n.Vector3),y=()=>{if(!z.value)return;g=new n.Scene,g.background=new n.Color(15790320);const m=z.value;u=new n.PerspectiveCamera(75,m.clientWidth/m.clientHeight,.1,1e4),u.position.set(8,-8,6),u.up.set(0,0,1),u.lookAt(0,0,0),d=new n.WebGLRenderer({antialias:!0,alpha:!0}),d.setSize(m.clientWidth,m.clientHeight),d.localClippingEnabled=!0,d.shadowMap.enabled=!0,d.shadowMap.type=n.PCFSoftShadowMap,d.toneMapping=n.ACESFilmicToneMapping,d.toneMappingExposure=1,d.outputColorSpace=n.SRGBColorSpace,m.appendChild(d.domElement),h=new pe.OrbitControls(u,d.domElement),h.enableDamping=!0,h.dampingFactor=.05,h.mouseButtons={LEFT:null,MIDDLE:n.MOUSE.PAN,RIGHT:n.MOUSE.ROTATE},h.panSpeed=.7,x=new n.Xe(u,d,{container:m,type:"cube",placement:"top-right",offset:{top:10,right:10},background:{color:"#D1D1D1",opacity:1},front:{label:"Top"},bottom:{label:"Front"},left:{label:"Left"},right:{label:"Right"},top:{label:"Back"},back:{label:"Bottom"}}),x.attachControls(h),f(),P()},t=(m,l)=>{c&&(g.remove(c),c.dispose()),C&&(g.remove(C),C.geometry.dispose(),C.material.dispose());const b=Math.min(Math.max(Math.floor(m/20),30),40);c=new n.GridHelper(m,b,13421772,14540253),c.rotateX(Math.PI/2),c.position.copy(l),g.add(c);const B=new n.PlaneGeometry(m,m),O=new n.ShadowMaterial({opacity:.3,color:0});C=new n.Mesh(B,O),C.position.copy(l),C.position.z-=.01,C.receiveShadow=!0,g.add(C)},p=()=>{if(E.value.length===0)return;const m=new n.Box3;let l=!1;if(E.value.forEach(X=>{if(X.userData.boundingBox)m.union(X.userData.boundingBox),l=!0;else if(X.userData.modelId&&modelBoundingBoxes.has(X.userData.modelId)){const Z=modelBoundingBoxes.get(X.userData.modelId);m.union(Z.box),l=!0}else m.expandByObject(X),l=!0}),!l){console.warn("无法计算包围盒,网格更新失败");return}const b=m.getSize(new n.Vector3),B=m.getCenter(new n.Vector3),O=Math.max(b.x,b.y,b.z),j=Math.max(O*8,50),q=new n.Vector3(B.x,B.y,m.min.z);t(j,q)},f=()=>{const m=new n.AmbientLight(4210752,.6);g.add(m);const l=new n.DirectionalLight(16777215,2);l.position.set(10,10,8),l.castShadow=!0,l.shadow.mapSize.width=4096,l.shadow.mapSize.height=4096,l.shadow.camera.near=.5,l.shadow.camera.far=50,l.shadow.camera.left=-50,l.shadow.camera.right=50,l.shadow.camera.top=50,l.shadow.camera.bottom=-50,g.add(l);const b=new n.DirectionalLight(16777215,.8);b.position.set(-8,-8,6),g.add(b);const B=new n.DirectionalLight(16777215,.6);B.position.set(0,-15,2),g.add(B);const O=new n.HemisphereLight(16777215,4473924,.8);g.add(O);const j=new n.PointLight(16777215,1,50);j.position.set(15,15,15),g.add(j);const q=new n.PointLight(16777215,.5,50);q.position.set(-15,-15,15),g.add(q)},P=()=>{_=requestAnimationFrame(P),h&&h.update();const m=performance.now(),l=m-S;l<D||(S=m-l%D,d&&g&&u&&d.render(g,u),x&&x.render())},I=m=>{["map","normalMap","bumpMap","roughnessMap","metalnessMap","emissiveMap","specularMap","envMap","lightMap","aoMap","displacementMap"].forEach(b=>{m[b]&&m[b].dispose&&m[b].dispose()}),m.dispose&&m.dispose()},A=m=>{m==null||m.traverse(l=>{l.geometry&&l.geometry.dispose(),l.material&&(Array.isArray(l.material)?l.material.forEach(b=>{I(b)}):I(l.material))})};return{currentModels:E,initialCameraPosition:r,initialTargetPosition:k,initThreeJS:y,handleResize:()=>{if(!z.value||!u||!d||!x)return;const m=z.value,l=m.clientWidth,b=m.clientHeight;u.aspect=l/b,u.updateProjectionMatrix(),d.setSize(l,b),x.update()},fitCameraToAllModels:m=>{if(!u||!h||E.value.length===0)return;const l=new n.Box3;let b=!1;if(E.value.forEach(Z=>{if(Z.userData.boundingBox)l.union(Z.userData.boundingBox),b=!0;else if(Z.userData.modelId&&m.has(Z.userData.modelId)){const ee=m.get(Z.userData.modelId);l.union(ee.box),b=!0}else l.expandByObject(Z),b=!0}),!b){console.warn("无法计算包围盒");return}const B=l.getSize(new n.Vector3),O=l.getCenter(new n.Vector3),q=Math.max(B.x,B.y,B.z)*.8,X=new n.Vector3(O.x+q,O.y-q,O.z+q);u.position.copy(X),u.lookAt(O),h.target.copy(O),h.update(),r.value.copy(X),k.value.copy(O),p()},getThreeJSObjects:()=>({scene:g,camera:u,renderer:d,controls:h,gizmo:x}),clearAllModels:()=>{if(!g)return;E.value.forEach(l=>{g.remove(l),A(l)});const m=[];g.children.forEach(l=>{!l.isLight&&!l.isCamera&&l.type!=="GridHelper"&&l!==C&&m.push(l)}),m.forEach(l=>{g.remove(l),A(l)}),E.value=[],p()},cleanup:()=>{_&&cancelAnimationFrame(_),c&&c.dispose(),C&&(C.geometry.dispose(),C.material.dispose()),d&&d.dispose(),h&&h.dispose(),x&&x.dispose()},updateGridForModels:p}}function ge(z,g){const u=e.ref(!1);let d=null,h=12700,x=new n.Vector3,_=new n.Vector3,c=new n.Vector3,C=0,F=null;const D=t=>t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2,S=t=>{const p=new n.Vector3,f=C*1.2,P=new n.Vector3(c.x+f,c.y,c.z),I=new n.Vector3(c.x,c.y+f,c.z),A=new n.Vector3(c.x,c.y-f,c.z);if(t<=.567){const $=t/.567*Math.PI*2;p.x=c.x+Math.cos($)*f,p.z=c.z+Math.sin($)*f,p.y=c.y}else if(t<=.724){const L=(t-.567)/.157,$=D(L);p.lerpVectors(P,I,$)}else if(t<=.881){const L=(t-.724)/.157,J=D(L)*Math.PI;p.x=c.x+Math.sin(J)*f,p.y=c.y+Math.cos(J)*f,p.z=c.z}else{const L=(t-.881)/.119,$=D(L);p.lerpVectors(A,x,$)}return p},E=()=>{const{camera:t,controls:p}=z();if(!t||!p)return;d||(d=Date.now());const f=Date.now()-d,P=Math.min(f/h,1);if(P>=1){k();return}const I=S(P);t.position.copy(I),t.lookAt(c),p.target.copy(c),F=requestAnimationFrame(E)},r=()=>{if(g.value.length===0)return;const{camera:t,controls:p}=z();if(!t||!p)return;x.copy(t.position),_.copy(p.target);const f=new n.Box3;g.value.forEach(G=>{f.expandByObject(G)});const P=f.getSize(new n.Vector3);c=f.getCenter(new n.Vector3),C=Math.max(P.x,P.y,P.z)*1.2;const I=new n.Vector3(c.x+C*1.2,c.y,c.z);p.enabled=!1;const A=t.position.clone(),L=1e3,$=Date.now(),J=()=>{const G=Date.now()-$,Y=Math.min(G/L,1),m=D(Y);t.position.lerpVectors(A,I,m),t.lookAt(c),p.target.copy(c),Y<1?requestAnimationFrame(J):(u.value=!0,d=null,E())};J()},k=()=>{u.value=!1,d=null,F&&(cancelAnimationFrame(F),F=null);const{controls:t}=z();t&&(t.enabled=!0,t.target.copy(_))};return{isAnimating:u,toggleAnimation:()=>{if(u.value){u.value=!1,d=null,F&&(cancelAnimationFrame(F),F=null);const{camera:t,controls:p}=z();if(!t||!p)return;p.enabled=!0;const f=t.position.clone(),P=p.target.clone(),I=1500,A=Date.now(),L=()=>{const $=Date.now()-A,J=Math.min($/I,1),G=D(J);t.position.lerpVectors(f,x,G),p.target.lerpVectors(P,_,G),J<1&&requestAnimationFrame(L)};L()}else r()},startAnimation:r,stopAnimation:k}}function he(z,g){const u=e.ref(!1),d=e.ref("none");let h=[],x=[],_=new n.Box3,c=new n.Vector3;const C=()=>{h=[new n.Plane(new n.Vector3(1,0,0),0),new n.Plane(new n.Vector3(0,1,0),0),new n.Plane(new n.Vector3(0,0,1),0)]},F=()=>{_.makeEmpty(),g.value.forEach(y=>{_.expandByObject(y)}),c=_.getCenter(new n.Vector3)},D=y=>{const t=_.getSize(new n.Vector3);let p,f,P;y==="x"?(p=new n.PlaneGeometry(t.z*1.2,t.y*1.2),f=new n.Vector3(c.x,c.y,c.z),P=new n.Euler(0,Math.PI/2,0)):y==="y"?(p=new n.PlaneGeometry(t.x*1.2,t.z*1.2),f=new n.Vector3(c.x,c.y,c.z),P=new n.Euler(Math.PI/2,0,0)):y==="z"&&(p=new n.PlaneGeometry(t.x*1.2,t.y*1.2),f=new n.Vector3(c.x,c.y,c.z),P=new n.Euler(0,0,0));const I=new n.MeshPhongMaterial({color:8900331,transparent:!0,opacity:.3,side:n.DoubleSide,depthWrite:!1}),A=new n.Mesh(p,I);return A.position.copy(f),A.rotation.copy(P),A},S=()=>{if(E(),r(),d.value==="none")return;F();let y=null;if(d.value==="x"?(h[0].constant=-c.x,y=h[0]):d.value==="y"?(h[1].constant=-c.y,y=h[1]):d.value==="z"&&(h[2].constant=-c.z,y=h[2]),y){g.value.forEach(p=>{p.traverse(f=>{f.isMesh&&f.material&&(Array.isArray(f.material)?f.material.forEach(P=>{P.clippingPlanes=[y]}):f.material.clippingPlanes=[y])})});const{scene:t}=z();if(t){const p=D(d.value);t.add(p),x.push(p)}}},E=()=>{g.value.forEach(y=>{y.traverse(t=>{t.isMesh&&t.material&&(Array.isArray(t.material)?t.material.forEach(p=>{p.clippingPlanes=[]}):t.material.clippingPlanes=[])})})},r=()=>{const{scene:y}=z();y&&x.forEach(t=>{y.remove(t),t.geometry.dispose(),t.material.dispose()}),x=[]};return{isClipping:u,activeClippingAxis:d,toggleClipping:()=>{u.value=!u.value,u.value?(C(),g.value.length>0&&F()):(d.value="none",E(),r())},updateClippingPlanes:S,clearClippingPlanes:E,clearClippingMeshes:r}}const ye={class:"panel-content"},we={__name:"animationPanel",props:{animationData:Object,model:Object},setup(z){const g=z;e.ref();const u=e.ref();return e.watch(()=>[g==null?void 0:g.animationData],()=>{var h;let d=((h=re.cloneDeep(g==null?void 0:g.animationData))==null?void 0:h["输出(动画数据)Content"])??[];d&&(u.value=d)},{deep:!0,immediate:!0}),(d,h)=>{var x,_,c;return e.openBlock(),e.createElementBlock("div",ye,[(e.openBlock(),e.createBlock(me.ssTable,{itemData:(x=u.value)==null?void 0:x.compData,key:(_=u.value)==null?void 0:_.id,index:(c=u.value)==null?void 0:c.id,showHeader:!1},null,8,["itemData","index"]))])}}},xe=oe._export_sfc(we,[["__scopeId","data-v-2387536e"]]),Ve={class:"panel-content"},Me={key:0,class:"joints-list"},ke={class:"joint-info-row"},_e={class:"joint-left"},Pe={class:"joint-name"},Ce={class:"joint-range"},Ee={class:"joint-type"},be={key:0,class:"joint-control-row"},ze={class:"slider-container"},De=["min","max","value","onInput","disabled"],Ne={class:"value-display"},Se={class:"joint-value"},Be={class:"unit"},Ae={key:1,class:"empty-state"},ae=.001,Re=1e3,ue=60,Fe={__name:"jointPanel",props:{model:Object,scene:Object,animationData:Object},setup(z,{expose:g}){const u=z;e.ref(!0);const d=e.ref([]),h=e.ref(null),x=e.ref(null),_=e.ref(12.5),c=e.ref(),C=e.ref(1302),F=e.ref(30),D=e.ref(!1),S=e.ref(!1),E=e.ref(0),r=e.ref(0),k=e.ref(null),y=n.MathUtils.degToRad,t=e.ref(1),p=()=>Re/ue/t.value;let f=[];e.watch(()=>u.animationData,o=>{var i;C.value=o.extra.管长,_.value=o.extra.外径/2;let v=((i=re.cloneDeep(o))==null?void 0:i["输出(动画数据)"])??[];v&&v.length>0&&(f=v)},{deep:!0}),e.computed(()=>f.length>0);const P=(o,v=!1)=>o==="revolute"?v?Math.PI:-Math.PI:o==="prismatic"?v?1:-1:0,I=()=>{if(!h.value)return re.ElMessage.error("未加载 URDF"),!1;let o=null;return h.value.traverse(v=>{o||v.name==="Pipe_Link"&&v.traverse(i=>{i instanceof n.Mesh&&!o&&(o=i)})}),o?(o.position.y-=F.value*ae,c.value=o,o.material=new n.MeshPhongMaterial({color:11184810,shininess:80,side:n.DoubleSide}),!0):(re.ElMessage.error('在 "Pipe_Link" 内未找到任何 Mesh'),!1)},A=o=>{if(!o||!o.joints)return console.warn("URDF模型没有关节信息"),[];let v=null;if(o.traverse(V=>{V.name==="Pipe_Link"&&!v&&(v=V)}),v)c.value=v;else return console.warn("未找到管子模型"),[];const i=[];return Object.keys(o.joints).forEach(V=>{const s=o.joints[V];if(s._jointType==="fixed")return;const a=s.limit?{lower:s.limit.lower??P(s._jointType,!1),upper:s.limit.upper??P(s._jointType,!0)}:{lower:P(s._jointType,!1),upper:P(s._jointType,!0)};i.push({name:V,type:s._jointType||"unknown",limit:a,currentValue:s.angle||0,urdfJoint:s})}),i.sort((V,s)=>V.name.localeCompare(s.name))},L=(o,v)=>{const i=d.value.find(s=>s.name===o);if(!i)return;const V=parseFloat(v);if(i.limit){const s=Math.max(i.limit.lower,Math.min(i.limit.upper,V));i.currentValue=s}else i.currentValue=V;u.model&&u.model.setJointValue?u.model.setJointValue(o,i.currentValue):i.urdfJoint&&i.urdfJoint.setJointValue(i.currentValue)},$=o=>o.reduce((v,i)=>{let V=0;const s=i.Y??0,a=i.C??0,w=i.R??0;return s>0&&(V+=s),a>0&&w>0&&(V+=w*y(a)),v+V},0),J=o=>{const v=[],i=o.Y??0,V=o.B??0,s=o.C??0,a=o.R??0,w={pos:new n.Vector3(0,0,0),localY:new n.Vector3(0,1,0),localX:new n.Vector3(1,0,0),localZ:new n.Vector3(0,0,1)};if(!i&&!s)return v;if(v.push(w.pos.clone()),V!==0){const U=new n.Matrix4().makeRotationAxis(w.localY,y(V));w.localX.applyMatrix4(U),w.localZ.applyMatrix4(U)}if(i>0&&(w.pos.add(w.localY.clone().multiplyScalar(i*ae)),v.push(w.pos.clone())),s>0&&a>0){const U=y(s),T=a*ae,W=w.pos.clone().add(w.localX.clone().multiplyScalar(-T)),R=Math.max(16,Math.ceil(s/5));for(let M=1;M<=R;M++){const H=U*M/R,K=new n.Matrix4().makeRotationAxis(w.localZ,H),se=w.localX.clone().multiplyScalar(T).applyMatrix4(K),ie=W.clone().add(se);v.push(ie)}}return v},G=(o,v=0)=>{let i=f.slice(0,o+1);const V=f[o+1];if(V&&v>0){const R={...V,B:(V.B??0)*v,C:(V.C??0)*v};i.push(R)}const s=$(i),a=Math.max(0,C.value-s),w=[];w.push(new n.Vector3(0,0,0));const U=new n.Vector3(0,a*ae,0);a>0&&w.push(U);let T={pos:U.clone(),localY:new n.Vector3(0,1,0),localX:new n.Vector3(1,0,0),localZ:new n.Vector3(0,0,1)};const W=[];for(let R=i.length-1;R>=0;R--){const M=i[R],H=J(M);if(H.length>0){const K=H.map(Q=>{const ne=Q.clone(),de=new n.Matrix4;return de.makeBasis(T.localX,T.localY,T.localZ),ne.applyMatrix4(de),ne.add(T.pos)});W.push(K);const te=K[K.length-1];T.pos=te.clone();const se=M.B??0,ie=M.C??0;if(se!==0){const Q=new n.Matrix4().makeRotationAxis(T.localY,y(se));T.localX.applyMatrix4(Q),T.localZ.applyMatrix4(Q)}if(ie>0){const Q=y(ie),ne=new n.Matrix4().makeRotationAxis(T.localZ,Q);T.localY.applyMatrix4(ne),T.localX.applyMatrix4(ne)}}}for(const R of W)R.length>1&&w.push(...R.slice(1));w.length<2&&w.push(new n.Vector3(0,.001,0));try{const R=new n.CatmullRomCurve3(w,!1,"catmullrom",.01),M=new n.TubeGeometry(R,Math.max(2,w.length*4),_.value*ae,18,!1);c.value.geometry.dispose(),c.value.geometry=M}catch(R){console.error("管件更新失败",R)}},Y=(o,v,i=1)=>{o&&(Object.keys(o).forEach(V=>{const s=o[V],a=d.value.find(w=>w.name===V);a&&(a.currentValue=s,u.model&&u.model.setJointValue?u.model.setJointValue(V,s):a.urdfJoint&&a.urdfJoint.setJointValue(s))}),G(v,i))},m=(o,v,i)=>o+(v-o)*i,l=(o,v,i)=>{if(!o||!v)return o||v;const V={};return Object.keys(o).forEach(s=>{const a=o[s],w=v[s];V[s]=m(a,w||a,i)}),V},b=()=>{if(f.length===0){console.warn("没有动画数据");return}I(),D.value=!0,S.value=!1,E.value=0,r.value=0,B()},B=()=>{if(!D.value||S.value)return;const o=E.value;if(o>=f.length-1){const s=f[f.length-1];Y(s,f.length-1,1),j();return}const v=r.value/ue,i=f[o],V=f[o+1];if(V){const s=l(i,V,v);Y(s,o,v)}else Y(i,o);r.value++,r.value>ue&&(r.value=0,E.value++),k.value=setTimeout(B,p())},O=()=>{S.value=!0,k.value&&(clearTimeout(k.value),k.value=null)},j=()=>{D.value=!1,S.value=!1,t.value=1,k.value&&(clearTimeout(k.value),k.value=null)};g({startAnimation:b,pauseAnimation:O,stopAnimation:j,resetAll:()=>{j(),E.value=0,r.value=0,d.value.forEach(o=>{(o.type==="revolute"||o.type==="prismatic")&&L(o.name,0)}),G(-1,0)},fastForward:()=>{t.value<4&&(t.value=Math.min(4,t.value*2))},fastBackward:()=>{t.value>.25&&(t.value=Math.max(.25,t.value/2))}}),e.watch(()=>u.model,o=>{o?(h.value=o,d.value=A(o)):d.value=[]},{immediate:!0});const ee=()=>{!u.model||D.value&&!S.value||d.value.forEach(o=>{o.urdfJoint&&o.urdfJoint.angle!==void 0&&(o.currentValue=o.urdfJoint.angle)})},le=()=>{const o=()=>{ee(),x.value=requestAnimationFrame(o)};o()},ce=()=>{x.value&&(cancelAnimationFrame(x.value),x.value=null)};return e.onMounted(()=>{le()}),e.onUnmounted(()=>{ce(),j()}),(o,v)=>(e.openBlock(),e.createElementBlock("div",Ve,[d.value.length>0?(e.openBlock(),e.createElementBlock("div",Me,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,i=>{var V,s,a,w;return e.openBlock(),e.createElementBlock("div",{key:i.name,class:"joint-item"},[e.createElementVNode("div",ke,[e.createElementVNode("div",_e,[e.createElementVNode("span",Pe,e.toDisplayString(i.name),1),e.createElementVNode("span",Ce," ["+e.toDisplayString(((V=i.limit)==null?void 0:V.lower.toFixed(2))??(i.type==="revolute"?"-3.14":"-1.00"))+", "+e.toDisplayString(((s=i.limit)==null?void 0:s.upper.toFixed(2))??(i.type==="revolute"?"3.14":"1.00"))+"] ",1)]),e.createElementVNode("span",Ee,e.toDisplayString(i.type),1)]),i.type==="revolute"||i.type==="prismatic"?(e.openBlock(),e.createElementBlock("div",be,[e.createElementVNode("div",ze,[e.createElementVNode("input",{type:"range",min:((a=i.limit)==null?void 0:a.lower)??(i.type==="revolute"?-Math.PI:-1),max:((w=i.limit)==null?void 0:w.upper)??(i.type==="revolute"?Math.PI:1),step:.01,value:i.currentValue,onInput:U=>L(i.name,U.target.value),class:"joint-slider",disabled:D.value&&!S.value},null,40,De)]),e.createElementVNode("div",Ne,[e.createElementVNode("span",Se,e.toDisplayString(i.currentValue?Number(i.currentValue).toFixed(3):"0.000"),1),e.createElementVNode("span",Be,e.toDisplayString(i.type==="revolute"?"rad":"m"),1)])])):e.createCommentVNode("",!0)])}),128))])):(e.openBlock(),e.createElementBlock("div",Ae,v[0]||(v[0]=[e.createElementVNode("p",null,"未检测到可控制的关节",-1)])))]))}},Te=oe._export_sfc(Fe,[["__scopeId","data-v-035ae936"]]),Le={class:"panel-content"},Ie="id",$e={__name:"urdfTree",props:{model:Object,maxExpandCount:{type:Number,default:10},expandStrategy:{type:String,default:"breadth",validator:z=>["breadth","firstLevel"].includes(z)}},emits:["nodeClick"],setup(z,{emit:g}){const u=z,d=g,h=e.ref([]),x={children:"children",label:"label"},_=r=>{d("nodeClick",r)},c=(r,k=0)=>{const y=[];return Array.isArray(r)&&(r==null?void 0:r.length)>0&&r.forEach(t=>{if(!(t!=null&&t.isMesh)&&((t==null?void 0:t.type)==="URDFJoint"||(t==null?void 0:t.type)==="URDFLink")){const p={name:t==null?void 0:t.name,label:t==null?void 0:t.name,show:!0,level:k+1,isPenultimate:!1,type:t==null?void 0:t.type,id:t==null?void 0:t.id,limit:(t==null?void 0:t.limit)??"",children:c(t==null?void 0:t.children,k+1),path:t==null?void 0:t.name};y.push(p)}}),y},C=r=>r?[{name:r==null?void 0:r.name,label:r==null?void 0:r.name,show:!0,level:1,isPenultimate:!1,type:r==null?void 0:r.type,id:r==null?void 0:r.id,limit:(r==null?void 0:r.limit)??"",children:c(r==null?void 0:r.children,1),path:r==null?void 0:r.name}]:[],F=(r,k)=>{const y=[],t=[...r];for(;t.length>0&&y.length<k;){const p=t.shift();p.children&&p.children.length>0&&(y.push(p.id),t.push(...p.children))}return y},D=(r,k)=>{const y=[];return r.forEach(t=>{if(t.children&&t.children.length>0){y.push(t.id);const p=t.children.filter(f=>f.children&&f.children.length>0).slice(0,k).map(f=>f.id);y.push(...p)}}),y.slice(0,k+1)},S=e.computed(()=>!h.value||h.value.length===0?[]:u.expandStrategy==="firstLevel"?D(h.value,u.maxExpandCount):F(h.value,u.maxExpandCount)),E=e.computed(()=>u!=null&&u.model?C(u.model):[]);return e.watch(E,r=>{h.value=JSON.parse(JSON.stringify(r))},{immediate:!0}),(r,k)=>{const y=e.resolveComponent("el-tree");return e.openBlock(),e.createElementBlock("div",Le,[e.createVNode(y,{data:h.value,props:x,"default-expanded-keys":S.value,"node-key":Ie,onNodeClick:_},null,8,["data","default-expanded-keys"])])}}},Je=oe._export_sfc($e,[["__scopeId","data-v-290ff4e1"]]),Oe=["xlink:href"],Ue=e.defineComponent({__name:"svgIcon",props:{backgroundColor:{default:"#f0f0f0"},prefix:{default:"icon"},name:{},size:{default:16},spin:{type:Boolean,default:!1},active:{type:Boolean,default:!1}},setup(z){const g=z,u=e.computed(()=>({backgroundColor:g.backgroundColor})),d=e.computed(()=>`#${g.prefix}-${g.name}`),h=e.computed(()=>{const{size:x}=g;let _=`${x}`;return _=`${_.replace("px","")}px`,{width:_,height:_}});return(x,_)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["container",{active:x.active}]),style:e.normalizeStyle(u.value)},[(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["svg-icon",[x.$attrs.class,x.spin&&"svg-icon-spin"]]),style:e.normalizeStyle(h.value),"aria-hidden":"true"},[e.createElementVNode("use",{"xlink:href":d.value},null,8,Oe)],6))],6))}}),N=oe._export_sfc(Ue,[["__scopeId","data-v-3150a90b"]]),Ge={class:"obj-viewer-container"},je={class:"buttonGroup-top"},qe={class:"buttonGroup-topLeft"},Xe={class:"buttonGroup-left"},He={class:"buttonGroup-right"},Ye={class:"buttonGroup-bottom"},Ze={class:"left-panel"},We={class:"panel-header"},Ke={key:1,class:"clipping-content"},Qe={class:"radio-group"},et={class:"radio-label"},tt={class:"radio-label"},nt={class:"radio-label"},at={class:"radio-label"},ot={class:"right-panel"},lt={class:"panel-header"},st={key:0,class:"loading-overlay"},it={__name:"threeModel",props:{animationData:{type:Object,default:()=>{}}},emits:["getAnimationData"],setup(z,{expose:g,emit:u}){const d=u;let h=null,x=!1;const _=e.ref(null),c=e.ref(!1),C=e.ref("");e.ref(!1);const F=e.ref(!1),D=e.ref(!1),S=e.ref(""),E=e.ref(!1),r=e.ref(""),k=e.ref(),{currentModels:y,initialCameraPosition:t,initialTargetPosition:p,initThreeJS:f,handleResize:P,fitCameraToAllModels:I,getThreeJSObjects:A,clearAllModels:L,cleanup:$}=ve(_),{isAnimating:J,toggleAnimation:G,stopAnimation:Y}=ge(A,y),{isClipping:m,activeClippingAxis:l,toggleClipping:b,updateClippingPlanes:B}=he(A,y),{addModelsFromUrls:O,loadModelByDefaultPath:j,urdfModel:q,modelBoundingBoxes:X}=fe.useModelLoader(A,y,c,C,L),Z=()=>{if(F.value||y.value.length===0)return;F.value=!0,J.value&&Y();const{camera:s,controls:a}=A();if(!s||!a)return;a.enabled=!0;const w=H=>H<.5?4*H*H*H:1-Math.pow(-2*H+2,3)/2,U=s.position.clone(),T=a.target.clone(),W=1500,R=Date.now(),M=()=>{const H=Date.now()-R,K=Math.min(H/W,1),te=w(K);s.position.lerpVectors(U,t.value,te),a.target.lerpVectors(T,p.value,te),K<1?requestAnimationFrame(M):F.value=!1};M()},ee=async()=>x?Promise.resolve():new Promise(s=>{const a=()=>{x?s():requestAnimationFrame(a)};a()}),le=async(s,a)=>{try{await ee(),J.value&&Y(),m.value&&b();const w=await a(s);return I(X),w}catch(w){throw console.error("加载模型失败:",w),w}},ce=async s=>le(s,O),o=async s=>le(s,j),v=s=>{D.value=!0,S.value=s,s==="剖面视图"&&!m.value&&b()},i=s=>{E.value=!0,r.value=s,s==="动画仿真"&&d("getAnimationData")},V=()=>{e.nextTick(()=>{var s;(s=k.value)==null||s.startAnimation()})};return e.onMounted(async()=>{await e.nextTick();try{f(),h=A().scene,x=!0,window.addEventListener("resize",P)}catch(s){console.error("Three.js初始化失败:",s)}}),e.onBeforeUnmount(()=>{x=!1,S.value="",r.value="",window.removeEventListener("resize",P),J.value&&Y(),$()}),g({addModelsFromUrls:ce,loadModelByDefaultPath:o}),(s,a)=>{var U,T,W,R;const w=e.resolveComponent("el-scrollbar");return e.openBlock(),e.createElementBlock("div",Ge,[e.createElementVNode("div",{ref_key:"threejsContainer",ref:_,class:"threejs-container"},null,512),e.createElementVNode("div",je,[e.createVNode(N,{name:"guanjianjiexi",size:"34"}),e.createVNode(N,{name:"guanjiekongzhi",size:"34"}),e.createVNode(N,{name:"gongyishengcheng",size:"34"}),e.createVNode(N,{name:"buchangshezhi",size:"34"}),e.createVNode(N,{name:"shuchujiagongchengxu",size:"34"})]),e.createElementVNode("div",qe,[e.createVNode(N,{name:"viewReset",size:"24",onClick:Z,title:"重置"}),e.createVNode(N,{name:"fangda",size:"24",title:"放大"}),e.createVNode(N,{name:"suoxiao",size:"24",title:"缩小"}),e.createVNode(N,{name:"lookAround",size:"24",onClick:e.unref(G),title:e.unref(J)?"停止动画":"动画视图"},null,8,["onClick","title"])]),e.createElementVNode("div",Xe,[e.createVNode(N,{name:"jiegoushu",size:"24",onClick:a[0]||(a[0]=M=>v("场景树")),active:D.value&&S.value==="场景树",title:"场景树"},null,8,["active"]),e.createVNode(N,{name:"clipping",size:"24",onClick:a[1]||(a[1]=M=>v("剖面视图")),active:D.value&&S.value==="剖面视图",title:"剖面视图"},null,8,["active"]),e.createVNode(N,{name:"donghuafangzhen",size:"24",onClick:a[2]||(a[2]=M=>v("场景树3"))}),e.createVNode(N,{name:"donghuafangzhen",size:"24",onClick:a[3]||(a[3]=M=>v("场景4"))})]),e.createElementVNode("div",He,[e.createVNode(N,{name:"donghuafangzhen",size:"24"}),e.createVNode(N,{name:"donghuafangzhen",size:"24"}),e.createVNode(N,{name:"guanjiekongzhi",size:"24",onClick:a[4]||(a[4]=M=>i("关节控制")),active:E.value&&r.value==="关节控制",title:"关节控制"},null,8,["active"]),e.createVNode(N,{name:"donghuafangzhen",size:"24",title:"动画仿真",onClick:a[5]||(a[5]=M=>i("动画仿真")),active:E.value&&r.value==="动画仿真"},null,8,["active"]),e.createVNode(N,{name:"donghuafangzhen",size:"24"}),e.createVNode(N,{name:"donghuafangzhen",size:"24"})]),e.createElementVNode("div",Ye,[e.createVNode(N,{name:"kuaitui",size:"24",backgroundColor:"#ffffff",title:"快退",onClick:(U=k.value)==null?void 0:U.fastBackward},null,8,["onClick"]),e.createVNode(N,{name:"bofang",size:"24",backgroundColor:"#ffffff",title:"播放",onClick:V}),e.createVNode(N,{name:"kuaijin",size:"24",backgroundColor:"#ffffff",title:"快进",onClick:(T=k.value)==null?void 0:T.fastForward},null,8,["onClick"]),e.createVNode(N,{name:"zanting",size:"24",backgroundColor:"#ffffff",title:"暂停",onClick:(W=k.value)==null?void 0:W.pauseAnimation},null,8,["onClick"]),e.createVNode(N,{name:"zhongzhi",size:"24",backgroundColor:"#ffffff",title:"停止",onClick:(R=k.value)==null?void 0:R.resetAll},null,8,["onClick"])]),e.withDirectives(e.createElementVNode("div",Ze,[e.createElementVNode("div",We,[e.createElementVNode("span",null,e.toDisplayString(S.value),1),e.createElementVNode("span",{class:"close",onClick:a[6]||(a[6]=M=>D.value=!1)}," X ")]),e.createVNode(w,{"max-height":"650px"},{default:e.withCtx(()=>[S.value==="场景树"?(e.openBlock(),e.createBlock(Je,{key:0,model:e.unref(q)},null,8,["model"])):e.createCommentVNode("",!0),S.value==="剖面视图"?(e.openBlock(),e.createElementBlock("div",Ke,[e.createElementVNode("div",Qe,[e.createElementVNode("label",et,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"none","onUpdate:modelValue":a[7]||(a[7]=M=>e.isRef(l)?l.value=M:null),onChange:a[8]||(a[8]=(...M)=>e.unref(B)&&e.unref(B)(...M))},null,544),[[e.vModelRadio,e.unref(l)]]),a[16]||(a[16]=e.createElementVNode("span",{class:"radio-text"},"无切割",-1))]),e.createElementVNode("label",tt,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"x","onUpdate:modelValue":a[9]||(a[9]=M=>e.isRef(l)?l.value=M:null),onChange:a[10]||(a[10]=(...M)=>e.unref(B)&&e.unref(B)(...M))},null,544),[[e.vModelRadio,e.unref(l)]]),a[17]||(a[17]=e.createElementVNode("span",{class:"radio-text"},"X轴切割",-1))]),e.createElementVNode("label",nt,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"y","onUpdate:modelValue":a[11]||(a[11]=M=>e.isRef(l)?l.value=M:null),onChange:a[12]||(a[12]=(...M)=>e.unref(B)&&e.unref(B)(...M))},null,544),[[e.vModelRadio,e.unref(l)]]),a[18]||(a[18]=e.createElementVNode("span",{class:"radio-text"},"Y轴切割",-1))]),e.createElementVNode("label",at,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"z","onUpdate:modelValue":a[13]||(a[13]=M=>e.isRef(l)?l.value=M:null),onChange:a[14]||(a[14]=(...M)=>e.unref(B)&&e.unref(B)(...M))},null,544),[[e.vModelRadio,e.unref(l)]]),a[19]||(a[19]=e.createElementVNode("span",{class:"radio-text"},"Z轴切割",-1))])])])):e.createCommentVNode("",!0)]),_:1})],512),[[e.vShow,D.value]]),e.withDirectives(e.createElementVNode("div",ot,[e.createElementVNode("div",lt,[e.createElementVNode("span",null,e.toDisplayString(r.value),1),e.createElementVNode("span",{class:"close",onClick:a[15]||(a[15]=M=>E.value=!1)}," X ")]),e.createVNode(w,{"max-height":"650px"},{default:e.withCtx(()=>[e.withDirectives(e.createVNode(Te,{ref_key:"jointRef",ref:k,model:e.unref(q),scene:e.unref(h),animationData:z.animationData},null,8,["model","scene","animationData"]),[[e.vShow,r.value==="关节控制"]]),e.withDirectives(e.createVNode(xe,{animationData:z.animationData},null,8,["animationData"]),[[e.vShow,r.value==="动画仿真"]])]),_:1})],512),[[e.vShow,E.value]]),c.value?(e.openBlock(),e.createElementBlock("div",st,[a[20]||(a[20]=e.createElementVNode("div",{class:"loading-spinner"},null,-1)),e.createElementVNode("p",null,e.toDisplayString(C.value),1)])):e.createCommentVNode("",!0)])}}},rt=oe._export_sfc(it,[["__scopeId","data-v-7bc47bb3"]]);exports.default=rt;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),X=require("./workpieceTreePanel-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),X=require("./workpieceTreePanel-CTOK6c6d.cjs"),pe=require("./iconfont-0T5xTLj8.cjs"),$=require("./index-C8qRkCgn.cjs"),s=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-QzgaFA5S.cjs");require("./index.vue_vue_type_style_index_1_lang-DnfCrXiN.cjs");require("./index-BpPyaNFa.cjs");const Q=require("./index-D_6peWlG.cjs");require("./index.vue_vue_type_style_index_1_lang-Xo4JSq-J.cjs");require("./index-D4EyLxA0.cjs");const Ce=require("./animationData-ChnEQcWN.cjs"),ne=require("./urdfTree-CWwnorES.cjs"),we=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),ee=require("./dataUtil-DrslFFRT.cjs"),M=require("./svgIcon-CUM54R6L.cjs"),Z=.001,H=s.MathUtils.degToRad,Ne=new s.MeshStandardMaterial({color:13421772,metalness:.3,roughness:.6,side:s.DoubleSide});function Me(V=.005,m=64){const f=new s.CatmullRomCurve3([new s.Vector3(0,0,0),new s.Vector3(0,0,0)]),n=new s.TubeGeometry(f,m,V,16,!1),g=Ne;return new s.Mesh(n,g)}const ke=V=>V.reduce((m,f)=>{let n=0;const g=f.Y??0,h=f.C??0,c=f.R??0;return g>0&&(n+=g),h>0&&c>0&&(n+=c*H(h)),m+n},0),Te=V=>{const m=[],f=V.Y??0,n=V.B??0,g=V.C??0,h=V.R??0,c={pos:new s.Vector3(0,0,0),localY:new s.Vector3(0,1,0),localX:new s.Vector3(1,0,0),localZ:new s.Vector3(0,0,1)};if(!f&&!g)return m;if(m.push(c.pos.clone()),n!==0){const C=new s.Matrix4().makeRotationAxis(c.localY,H(n));c.localX.applyMatrix4(C),c.localZ.applyMatrix4(C)}if(f>0&&(c.pos.add(c.localY.clone().multiplyScalar(f*Z)),m.push(c.pos.clone())),g>0&&h>0){const C=H(g),u=h*Z,_=c.pos.clone().add(c.localX.clone().multiplyScalar(-u)),r=Math.max(16,Math.ceil(g/5));for(let p=1;p<=r;p++){const a=C*p/r,d=new s.Matrix4().makeRotationAxis(c.localZ,a),b=c.localX.clone().multiplyScalar(u).applyMatrix4(d),E=_.clone().add(b);m.push(E)}}return m};function Se(V,m){const f=new s.Group;f.name="CompletePipe";const n={pos:new s.Vector3(0,0,0),localX:new s.Vector3(1,0,0),localY:new s.Vector3(0,1,0),localZ:new s.Vector3(0,0,1)};let g=0,h=1;for(let c=0;c<V.length;c++){const C=V[c],u=C.Y??0,_=C.B??0,r=C.C??0,p=C.R??0;if(_!==0){const a=new s.Matrix4().makeRotationAxis(n.localY,H(_));n.localX.applyMatrix4(a),n.localZ.applyMatrix4(a)}if(u>0){const a=n.pos.clone();n.pos.add(n.localY.clone().multiplyScalar(u*Z));const d=n.pos.clone(),i=Pe(a,d,m*Z);i.userData={segmentType:"straight",segmentIndex:g,frameIndex:c,length:u,frame:{Y:u,B:_,C:r,R:p}},i.name=`直段_${g}`,f.add(i);const b=a.clone();De(f,h,b,m*Z),g++}if(r>0&&p>0){const a=H(r),d=p*Z,i=[];i.push(n.pos.clone());const b=n.pos.clone().add(n.localX.clone().multiplyScalar(-d)),E=Math.max(16,Math.ceil(r/5));for(let P=1;P<=E;P++){const D=a*P/E,T=new s.Matrix4().makeRotationAxis(n.localZ,D),k=n.localX.clone().multiplyScalar(d).applyMatrix4(T),w=b.clone().add(k);i.push(w)}const v=Re(i,m*Z);v.userData={segmentType:"bend",segmentIndex:g,frameIndex:c,angle:r,radius:p,centerPoint:b.toArray(),frame:{Y:u,B:_,C:r,R:p}},v.name=`弯段_${g}`,f.add(v),Math.floor(i.length/2),i[0],n.pos=i[i.length-1].clone();const S=new s.Matrix4().makeRotationAxis(n.localZ,a);n.localY.applyMatrix4(S),n.localX.applyMatrix4(S),g++,h++}}return f}function De(V,m,f,n){const g=new s.Vector3(0,n*2,n*5),h=f.clone().add(g),c=[f,h],C=new s.BufferGeometry().setFromPoints(c),u=new s.LineDashedMaterial({color:16711680,dashSize:n*.5,gapSize:n*.3,linewidth:1}),_=new s.Line(C,u);_.computeLineDistances(),V.add(_);const r=document.createElement("canvas"),p=r.getContext("2d");r.width=128,r.height=128,p.clearRect(0,0,128,128),p.fillStyle="#FF0000",p.font="bold 80px Arial",p.textAlign="center",p.textBaseline="middle",p.fillText(m.toString(),64,64);const a=new s.CanvasTexture(r),d=new s.SpriteMaterial({map:a,transparent:!0,depthTest:!1,depthWrite:!1}),i=new s.Sprite(d),b=n*3;i.scale.set(b,b,1),i.position.copy(h),i.name=`Label_${m}`,i.userData={labelNumber:m},V.add(i)}function Pe(V,m,f){const n=new s.LineCurve3(V,m),g=new s.TubeGeometry(n,2,f,18,!1);return new s.Mesh(g,Ne)}function Re(V,m){const f=new s.CatmullRomCurve3(V,!1,"catmullrom",.01),n=new s.TubeGeometry(f,Math.max(16,V.length*2),m,18,!1);return new s.Mesh(n,Ne)}function _e(V,m,f,n,g,h=0){let c=m.slice(0,g+1);const C=m[g+1];if(C&&h>0){const i={...C,B:(C.B??0)*h,C:(C.C??0)*h};c.push(i)}const u=ke(c),_=Math.max(0,f-u),r=[];r.push(new s.Vector3(0,0,0));const p=new s.Vector3(0,_*Z,0);_>0&&r.push(p);let a={pos:p.clone(),localY:new s.Vector3(0,1,0),localX:new s.Vector3(1,0,0),localZ:new s.Vector3(0,0,1)};const d=[];for(let i=c.length-1;i>=0;i--){const b=c[i],E=Te(b);if(E.length>0){const v=E.map(T=>{const R=T.clone(),k=new s.Matrix4;return k.makeBasis(a.localX,a.localY,a.localZ),R.applyMatrix4(k),R.add(a.pos)});d.push(v);const S=v[v.length-1];a.pos=S.clone();const P=b.B??0,D=b.C??0;if(P!==0){const T=new s.Matrix4().makeRotationAxis(a.localY,H(P));a.localX.applyMatrix4(T),a.localZ.applyMatrix4(T)}if(D>0){const T=H(D),R=new s.Matrix4().makeRotationAxis(a.localZ,T);a.localY.applyMatrix4(R),a.localX.applyMatrix4(R)}}}for(const i of d)i.length>1&&r.push(...i.slice(1));r.length<2&&r.push(new s.Vector3(0,.001,0));try{const i=new s.CatmullRomCurve3(r,!1,"catmullrom",.01),b=new s.TubeGeometry(i,Math.max(2,r.length*4),n*Z,18,!1);V.geometry.dispose(),V.geometry=b}catch(i){console.error("管件更新失败",i)}}function xe(V,m,f,n=0){let g=V.slice(0,f+1);const h=V[f+1];if(h&&n>0){const a={...h,B:(h.B??0)*n,C:(h.C??0)*n};g.push(a)}const c=ke(g),C=Math.max(0,m-c),u=[];u.push(new s.Vector3(0,0,0));const _=new s.Vector3(0,C*Z,0);C>0&&u.push(_);let r={pos:_.clone(),localY:new s.Vector3(0,1,0),localX:new s.Vector3(1,0,0),localZ:new s.Vector3(0,0,1)};const p=[];for(let a=g.length-1;a>=0;a--){const d=g[a],i=Te(d);if(i.length>0){const b=i.map(P=>{const D=P.clone(),T=new s.Matrix4;return T.makeBasis(r.localX,r.localY,r.localZ),D.applyMatrix4(T),D.add(r.pos)});p.push(b);const E=b[b.length-1];r.pos=E.clone();const v=d.B??0,S=d.C??0;if(v!==0){const P=new s.Matrix4().makeRotationAxis(r.localY,H(v));r.localX.applyMatrix4(P),r.localZ.applyMatrix4(P)}if(S>0){const P=H(S),D=new s.Matrix4().makeRotationAxis(r.localZ,P);r.localY.applyMatrix4(D),r.localX.applyMatrix4(D)}}}for(const a of p)a.length>1&&u.push(...a.slice(1));return u.length<2&&u.push(new s.Vector3(0,.001,0)),u}function Ee(V,m,f,n,g,h,c,C=0,u=0){const _=g-u,r=xe(n,_,c,C);let a=xe(f,u,c,C);a.forEach(i=>i.y=-i.y),a.reverse();const d=[...a,...r];try{const i=new s.CatmullRomCurve3(d,!1,"catmullrom",.01),b=new s.TubeGeometry(i,Math.max(2,d.length*4),h*Z,18,!1);m.geometry.dispose(),V.geometry.dispose(),m.parent&&m.parent.remove(m),V.geometry=b}catch(i){console.error("管件更新失败",i)}}const Be={class:"panel-content"},ze={class:"action-bar"},Ae={class:"animation-controls"},$e={class:"control-row"},Fe={class:"control-row"},Ye={class:"frame-info"},Le={class:"control-row"},Ie={class:"progress-bar"},Ue={class:"dialog-footer"},je=e.defineComponent({__name:"animationPanel",props:{model:{},threeData:{}},emits:["getThreeData"],setup(V,{expose:m,emit:f}){const n=V,g=f,h=e.ref(),c=e.ref();e.watch(()=>n.threeData,l=>{const t=l==null?void 0:l.data;c.value=t==null?void 0:t.type},{immediate:!0});const C=async()=>{if(!sessionStorage.getItem("systemKey")){g("getThreeData");return}let t={};c.value===X.robotMode.SINGLE&&(t=await Ce.fetchSingleRobotAnimationData()),c.value===X.robotMode.DOUBLE&&(t=await Ce.fetchDoubleRobotAnimationData());const{initialPipeLength:o=0,pipeRadius:y=0,clampLength:N=0,animationData:x}=t;D.value=o,T.value=y,R.value=N,h.value=x;const O=$.cloneDeep(h.value),K=ce(F.value),q=(O==null?void 0:O["输出(动画数据)"])||[];u.value=q.length?q:[K]},u=e.ref([]),_=e.ref(!1),r=e.ref(""),p=e.ref(!1),a=e.ref(0),d=e.ref(0),i=e.ref(1e3);let b=!1;const E=e.ref(null),v=e.shallowRef(null),S=e.shallowRef(null),P=e.shallowRef(null),D=e.ref(0),T=e.ref(12.5),R=e.ref(30),k=e.ref([]),w=e.ref(null),I=e.computed(()=>n.model?ne.getNonFixedJoints(n.model).map(o=>o.name):[]),G=e.ref(["Y","B","C","R"]),F=e.computed(()=>[...I.value,...G.value]),Y=e.computed(()=>F.value.length>0?`请按以下格式粘贴数据 (第一行为表头,使用 Tab 分隔):
|
|
2
2
|
${F.value.join(" ")}
|
|
3
3
|
0 0 0 ...
|
|
4
4
|
1 2 3 ...`:"请先加载模型。"),J=()=>u.value.map(l=>({Y:parseFloat(l.Y)||0,B:parseFloat(l.B)||0,C:parseFloat(l.C)||0,R:parseFloat(l.R)||0})),U=()=>{const l=[],t=[];return u.value.forEach(o=>{const{Y1:y,B1:N,C1:x,R1:O,Y2:K,B2:q,C2:ie,R2:A}=o;l.push({Y:parseFloat(y)||0,B:parseFloat(N)||0,C:parseFloat(x)||0,R:parseFloat(O)||0}),t.push({Y:parseFloat(K)||0,B:parseFloat(q)||0,C:parseFloat(ie)||0,R:parseFloat(A)||0})}),{posPipeYbcr:l,negPipeYbcr:t}},L=(l=0,t=0)=>{if(v.value&&S.value){const o=U();Ee(v.value,S.value,o.posPipeYbcr,o.negPipeYbcr,D.value,T.value,l,t,R.value)}else if(v.value){const o=J();_e(v.value,o,D.value,T.value,l,t)}},W=l=>{if(l<0||l>=u.value.length){console.error(`帧索引 ${l} 超出范围`);return}const t=u.value[l];if(console.log(`应用第 ${l} 帧数据 ${t}`),a.value=l,E.value){const o={};I.value.forEach(y=>{const N=parseFloat(t[y]);isNaN(N)||(o[y]=N)}),E.value.setJointAngles(o)}L(l,0)},B=async()=>{if(u.value.length===0){$.ElMessage.error("无法播放动画:无数据");return}if(!p.value){p.value=!0,b=!1,u.value.length-1===a.value&&(a.value=0);try{for(let l=a.value+1;l<u.value.length&&!b;l++){a.value=l;const t=u.value[l],o={};E.value&&I.value.forEach(y=>{const N=parseFloat(t[y]);isNaN(N)||(o[y]=N)}),E.value?await E.value.animateToState(o,i.value,y=>{d.value=(l+y)/u.value.length*100,L(l-1,y)}):(await new Promise(y=>setTimeout(y,i.value)),d.value=(l+1)/u.value.length*100)}b||$.ElMessage.success("动画播放完成")}catch(l){console.error("动画播放出错:",l),$.ElMessage.error("动画播放出错")}finally{p.value=!1,d.value=0}}},z=()=>{b=!0,p.value=!1,d.value=0,$.ElMessage.info("动画已停止")},ae=()=>{a.value=0},j=()=>{if(v.value&&S.value){const l=U();Ee(v.value,S.value,l.posPipeYbcr,l.negPipeYbcr,D.value,T.value,-1,0,R.value)}else if(v.value){const l=J();_e(v.value,l,D.value,T.value,-1,0)}},oe=()=>{E.value&&E.value.resetToZero(),j(),ae(),$.ElMessage.success("机器人和管件已重置")},me=l=>`第 ${l+1} 帧`,ve=l=>{p.value&&z(),W(l)},fe=()=>{p.value&&z(),!(a.value+1>=u.value.length)&&W(a.value+1)},ge=()=>{p.value&&z(),a.value!==0&&W(a.value-1)},se=()=>{P.value&&(P.value.visible=!0),v.value&&v.value.parent&&v.value.parent.remove(v.value),P.value=null,v.value=null,S.value=null},ce=l=>l==null?void 0:l.reduce((t,o)=>(t[o]="0",t),{});e.watch(F,(l,t)=>{if(JSON.stringify(l)!==JSON.stringify(t))if(l.length>0){const o=ce(l);u.value=[o]}else u.value=[]},{immediate:!0});const re=e.ref(0),he=l=>{re.value=l},ue=(l,t)=>{if(!l||!t)return;const o=ne.getTargetJoint(l,t),y=Me();y.visible=!1,o==null||o.add(y)},te=l=>{E.value=new X.URDFRobotController(l),k.value=ne.getAllLinkName(l),w.value="Pipe_Joint"},le=()=>{E.value=null,k.value=[],w.value=null},Ve=l=>{te(l),ue(l,w.value),he(re.value+1),oe()};e.watch(()=>n.model,l=>{if(se(),l){Ve(l);return}le()},{immediate:!0});const de=l=>{var o,y;const t=new s.Mesh(l.geometry.clone(),l.material);return t.name="managed_pipe_clone",(y=(o=l==null?void 0:l.parent)==null?void 0:o.add)==null||y.call(o,t),t.position.copy(l.position),t.rotation.copy(l.rotation),t.scale.copy(l.scale),t};e.watch([w,R,D,re],([l,t])=>{if(se(),n.model&&l){const o=ne.getMeshFromJoint(n.model,l);if(console.log(o,"meshToReplace"),o&&o.parent){P.value=o,o.visible=!1;const y=de(o);if(c.value===X.robotMode.SINGLE&&(y.position.y-=t*.001),v.value=y,c.value===X.robotMode.DOUBLE){const N=de(o);S.value=N}L(0,0)}else l&&console.warn(`在 link '${l}' 中未找到可替换的网格或其没有父级。`)}});const be=async()=>{if(F.value.length===0){$.ElMessage.warning("没有可导出的表头");return}const l=F.value.join(" ");try{await navigator.clipboard.writeText(l),$.ElMessage.success("表头已成功复制到剪贴板!")}catch(t){console.error("复制失败:",t),$.ElMessage.error("复制失败,请检查浏览器权限或手动复制。")}},ye=()=>{if(!r.value.trim()){$.ElMessage.warning("导入内容不能为空");return}const l=r.value.trim().split(`
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { defineComponent as Oe, ref as h, watch as se, shallowRef as ve, computed as we, onUnmounted as Qe, resolveComponent as O, createElementBlock as _e, openBlock as te, createElementVNode as n, createVNode as o, withCtx as T, createBlock as Ce, createCommentVNode as ye, unref as M, toDisplayString as me, onMounted as We, onBeforeUnmount as Ie, Fragment as et, renderList as tt, nextTick as lt, withDirectives as q, vShow as re, renderSlot as de, isRef as Te, vModelRadio as Re } from "vue";
|
|
2
|
-
import { r as Ve, U as ot, s as je, u as nt, a as at, W as st } from "./workpieceTreePanel-
|
|
2
|
+
import { r as Ve, U as ot, s as je, u as nt, a as at, W as st } from "./workpieceTreePanel-D3a0Vvh1.js";
|
|
3
3
|
import { u as Ke, a as it, b as rt } from "./iconfont-DN8mra_i.js";
|
|
4
4
|
import { ag as ut, c as ct, E as X, aW as pt, aw as dt } from "./index-BUYYl2Pc.js";
|
|
5
5
|
import { t as Me, T as ke, V as F, r as Q, s as mt, u as vt, k as Se, v as ft, L as gt, w as ht, x as bt, y as yt, z as wt, F as _t, I as Ct, p as kt } from "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-DEgtwZwW.js";
|
|
6
6
|
import "./index.vue_vue_type_style_index_1_lang-kYz8t0xw.js";
|
|
7
7
|
import "./index-BHtNKL1L.js";
|
|
8
8
|
import { _ as ue, s as Pt } from "./index-DkEISMpK.js";
|
|
9
|
-
import "./index.vue_vue_type_style_index_1_lang-
|
|
9
|
+
import "./index.vue_vue_type_style_index_1_lang-C-2EhQeU.js";
|
|
10
10
|
import "./index-C7Ks0zLC.js";
|
|
11
|
-
import { f as xt, a as Dt } from "./animationData-
|
|
11
|
+
import { f as xt, a as Dt } from "./animationData-R5RUbyuY.js";
|
|
12
12
|
import { g as Tt, a as Rt, b as Vt, c as Mt, U as St, J as At } from "./urdfTree-DIyCunQo.js";
|
|
13
13
|
import { _ as Xe } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
14
14
|
import { g as zt, a as Ee, d as $t, c as Ft, e as Yt, b as Lt } from "./dataUtil-BS-wt9Xk.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),Be=require("./index.vue_vue_type_style_index_1_lang-DnfCrXiN.cjs"),U=require("./workpieceTreePanel-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),Be=require("./index.vue_vue_type_style_index_1_lang-DnfCrXiN.cjs"),U=require("./workpieceTreePanel-CTOK6c6d.cjs"),Q=require("./iconfont-0T5xTLj8.cjs"),f=require("./index-C8qRkCgn.cjs");require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-QzgaFA5S.cjs");const ee=require("./index-D_6peWlG.cjs"),G=require("./urdfTree-CWwnorES.cjs"),re=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),N=require("./svgIcon-CUM54R6L.cjs"),$e=require("./animationData-ChnEQcWN.cjs"),ze=require("./MTLLoader-D80GV1WB.cjs"),se=require("./index-DNWalfgy.cjs"),Le={class:"panel-content"},Re={class:"action-bar"},Ue={key:0,class:"animation-controls"},je={class:"control-row"},Ae={class:"control-row"},Ie={class:"frame-info"},Oe={class:"control-row"},Fe={key:1,class:"empty-state"},qe={class:"dialog-footer"},Je=e.defineComponent({__name:"urdfAnimationPanel",props:{model:{},scene:{},xyzbcList:{}},setup(T,{expose:j}){const w=T,o=e.ref([]),C=e.ref(!1),_=e.ref(""),i=e.ref("stopped"),d=e.ref(0),D=e.ref(0),L=e.ref(10),g=e.ref(null);let m=0;const A=e.ref([]),I=e.computed(()=>w.model?G.getNonFixedJoints(w.model).map(r=>r.name):[]),M=e.computed(()=>[...I.value]),H=e.computed(()=>M.value.length>0?`请按以下格式粘贴数据 (第一行为表头,使用 Tab 分隔):
|
|
2
2
|
${M.value.join(" ")}
|
|
3
3
|
0 0 0 ...
|
|
4
4
|
1 2 3 ...`:"请先加载模型。"),B=e.computed(()=>o.value[d.value]||{});e.watch(()=>w.model,s=>{s?(g.value=new U.URDFRobotController(s),A.value=G.getAllLinkName(s),d.value=0):(g.value=null,A.value=[])},{immediate:!0});const $=s=>{if(s<0||s>=o.value.length){console.error(`帧索引 ${s} 超出范围`);return}const n=o.value[s];if(g.value){const r={};I.value.forEach(b=>{const v=parseFloat(n[b]);isNaN(v)||(r[b]=v)}),g.value.setJointAngles(r)}d.value=s,D.value=o.value.length>1?s/(o.value.length-1)*100:100},W=async s=>{try{for(let n=d.value;n<o.value.length;n++){if(s!==m)return;const r=o.value[n],b={};if(g.value)I.value.forEach(v=>{const p=parseFloat(r[v]);isNaN(p)||(b[v]=p)}),await g.value.animateToState(b,L.value,v=>{s===m&&(D.value=(n+v)/o.value.length*100)});else{if(await new Promise(v=>setTimeout(v,L.value)),s!==m)return;D.value=(n+1)/o.value.length*100}d.value=n}s===m&&(f.ElMessage.success("动画播放完成"),i.value="stopped",D.value=100)}catch(n){console.error("动画播放出错:",n),f.ElMessage.error("动画播放出错"),i.value="stopped"}},R=()=>{if(o.value.length===0){f.ElMessage.error("无动画数据");return}i.value==="stopped"&&(d.value=0,$(0)),i.value="playing",m++,W(m),f.ElMessage.info("动画播放中")},O=()=>{i.value==="playing"&&(m++,i.value="paused",f.ElMessage.info("动画已暂停"))},F=()=>{m++,i.value="stopped",d.value=0,D.value=0,$(0),f.ElMessage.info("动画已停止并重置")},P=()=>{i.value==="playing"?O():R()},y=s=>{m++,i.value="paused",$(s)},z=()=>{if(!_.value.trim()){f.ElMessage.warning("导入内容不能为空");return}const s=_.value.trim().split(`
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent as _e, ref as u, computed as w, watch as W, onUnmounted as Ye, resolveComponent as Y, createElementBlock as A, openBlock as U, createElementVNode as l, createCommentVNode as M, createVNode as i, toDisplayString as $, Fragment as Ze, renderList as qe, withCtx as ne, inject as ke, shallowRef as ue, onMounted as Qe, nextTick as et, onBeforeUnmount as tt, withDirectives as T, vShow as H, renderSlot as K, unref as v, createBlock as Pe, isRef as re, vModelRadio as de } from "vue";
|
|
2
2
|
import { aw as lt } from "./index.vue_vue_type_style_index_1_lang-kYz8t0xw.js";
|
|
3
|
-
import { U as at, s as we, u as nt, a as ot, W as st } from "./workpieceTreePanel-
|
|
3
|
+
import { U as at, s as we, u as nt, a as ot, W as st } from "./workpieceTreePanel-D3a0Vvh1.js";
|
|
4
4
|
import { u as it, a as ut, b as rt } from "./iconfont-DN8mra_i.js";
|
|
5
5
|
import { c as dt, E as P } from "./index-BUYYl2Pc.js";
|
|
6
6
|
import "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-DEgtwZwW.js";
|
|
@@ -8,9 +8,9 @@ import { _ as me } from "./index-DkEISMpK.js";
|
|
|
8
8
|
import { g as vt, b as ct, U as pt, J as mt, d as ft } from "./urdfTree-DIyCunQo.js";
|
|
9
9
|
import { _ as xe } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
10
10
|
import { T as k } from "./svgIcon-D-_fXUBL.js";
|
|
11
|
-
import { i as bt } from "./animationData-
|
|
11
|
+
import { i as bt } from "./animationData-R5RUbyuY.js";
|
|
12
12
|
import { O as gt } from "./MTLLoader-B5xRp-vz.js";
|
|
13
|
-
import { L as ht, j as yt } from "./index-
|
|
13
|
+
import { L as ht, j as yt } from "./index-Dm2K00uW.js";
|
|
14
14
|
const kt = { class: "panel-content" }, Pt = { class: "action-bar" }, wt = {
|
|
15
15
|
key: 0,
|
|
16
16
|
class: "animation-controls"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent as Pe, computed as R, ref as E, resolveComponent as Y, createElementBlock as le, openBlock as Z, createElementVNode as m, createVNode as h, withCtx as de, toDisplayString as J, shallowRef as te, watch as lt, onMounted as ct, onBeforeUnmount as ut, withDirectives as I, createCommentVNode as ve, unref as b, renderSlot as Ae, createBlock as dt, isRef as ne, vModelRadio as ie, vShow as oe } from "vue";
|
|
2
2
|
import { u as ft, a as pt, b as mt, f as ht, d as Ue } from "./iconfont-DN8mra_i.js";
|
|
3
3
|
import { C as fe, k as Be, aE as vt, v as gt, V as M, aF as yt, aG as xe, aH as be, av as H, aI as wt, B as _e, aD as De, aJ as xt, aK as ce, aL as Fe, Y as Oe, aM as ue, aN as Q, aO as bt, r as _t, s as je, t as St, w as zt, a5 as Ct, ag as At, ao as Ut } from "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-DEgtwZwW.js";
|
|
4
|
-
import { r as Et } from "./threeViewerHost-
|
|
4
|
+
import { r as Et } from "./threeViewerHost-5yvNo1Ub.js";
|
|
5
5
|
import { E as K } from "./index-BUYYl2Pc.js";
|
|
6
6
|
import { U as Mt, J as Lt } from "./urdfTree-DIyCunQo.js";
|
|
7
7
|
import { _ as Ie } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
@@ -1154,8 +1154,10 @@ function fn(o, e) {
|
|
|
1154
1154
|
if (!n || !i || !t || !s)
|
|
1155
1155
|
return;
|
|
1156
1156
|
const r = dn(e);
|
|
1157
|
+
if (!r)
|
|
1158
|
+
return;
|
|
1157
1159
|
r.name = "轨迹路径", n.add(r);
|
|
1158
|
-
const a = un(e, i, t, 0.
|
|
1160
|
+
const a = un(e, i, t, 0.4, 50);
|
|
1159
1161
|
return r.material.size = a, r;
|
|
1160
1162
|
}
|
|
1161
1163
|
const pn = { class: "obj-viewer-container" }, mn = { class: "buttonGroup-top" }, hn = { class: "buttonGroup-topLeft" }, vn = { class: "buttonGroup-left" }, gn = { class: "buttonGroup-right" }, yn = { class: "buttonGroup-bottom" }, wn = { class: "left-panel" }, xn = { class: "panel-header" }, bn = { class: "panel-body" }, _n = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),O=require("./iconfont-0T5xTLj8.cjs"),c=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-QzgaFA5S.cjs"),Be=require("./threeViewerHost-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),O=require("./iconfont-0T5xTLj8.cjs"),c=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-QzgaFA5S.cjs"),Be=require("./threeViewerHost-Ym_dg2DG.cjs"),G=require("./index-C8qRkCgn.cjs"),oe=require("./urdfTree-CWwnorES.cjs"),ue=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),w=require("./svgIcon-CUM54R6L.cjs"),Le=require("./isString--eJE54G5.cjs");function ke(r=.5,e=4){const i=new c.Mesh(new c.ConeGeometry(r,e,32),new c.MeshStandardMaterial({color:"#919191ff",metalness:.3,roughness:.6})),o=i.geometry.parameters.height;return i.geometry.translate(0,-o/2,0),i.rotation.set(-90,0,0,"XYZ"),i}function Pe(r,e){r.position.copy(e)}function Ie(r,e,i=new c.Color(16711680)){const o=new c.Vector3;e.getWorldPosition(o);const n=r.geometry.attributes.position,s=r.geometry.attributes.color,l=new c.Color(55551);let a=1/0,p=-1;for(let f=0;f<n.count;f++){const m=new c.Vector3().fromBufferAttribute(n,f).distanceTo(o);m<a&&(a=m,p=f)}for(let f=0;f<s.count;f++)l.toArray(s.array,f*3);if(p!==-1){const f=i.toArray(),h=p*3+2;for(let m=0;m<h;m=m+3)s.array[m]=f[0],s.array[m+1]=f[1],s.array[m+2]=f[2]}s.needsUpdate=!0}function de(r,e,i,o=new c.Color(16711680)){Pe(r,e),Ie(i,r,o)}const De={class:"panel-content"},Fe={class:"animation-controls"},Oe={class:"control-row"},je={class:"control-row"},Re={class:"frame-info"},We={class:"control-row"},Ge=t.defineComponent({__name:"trackAnimationPanel",props:{cloud:{},knife:{},vectors:{}},emits:["getThreeData"],setup(r,{expose:e,emit:i}){const o=r,n=t.computed(()=>o.vectors),s=t.ref(!1),l=t.ref(0),a=t.ref(50);let p=!1;const f=g=>`第 ${g+1} 帧`,h=g=>{if(g<0||g>=n.value.length){console.error(`帧索引 ${g} 超出范围`);return}const x=n.value[g];l.value=g,de(o.knife,x,o.cloud)},m=async()=>{if(n.value.length===0){G.ElMessage.error("无法播放动画:无数据");return}if(!s.value){s.value=!0,p=!1,n.value.length-1===l.value&&(l.value=0);try{for(let g=l.value+1;g<n.value.length&&!p;g++)await new Promise(x=>setTimeout(x,a.value)),h(g);p||G.ElMessage.success("动画播放完成")}catch(g){console.error("动画播放出错:",g),G.ElMessage.error("动画播放出错")}finally{s.value=!1}}},v=()=>{p=!0,s.value=!1,G.ElMessage.info("动画已停止")},C=g=>{s.value&&v(),h(g)};return e({playAnimation:m,stopAnimation:v,forwardFrame:()=>{s.value&&v(),!(l.value+1>=n.value.length)&&h(l.value+1)},backwardFrame:()=>{s.value&&v(),l.value!==0&&h(l.value-1)}}),(g,x)=>{const E=t.resolveComponent("el-input-number"),V=t.resolveComponent("el-form-item"),N=t.resolveComponent("el-form"),Z=t.resolveComponent("el-slider");return t.openBlock(),t.createElementBlock("div",De,[t.createElementVNode("div",Fe,[t.createElementVNode("div",Oe,[t.createVNode(N,{"label-width":"auto",style:{width:"100%"}},{default:t.withCtx(()=>[t.createVNode(V,{label:"帧间隔 (ms):",prop:"frameDuration"},{default:t.withCtx(()=>[t.createVNode(E,{modelValue:a.value,"onUpdate:modelValue":x[0]||(x[0]=F=>a.value=F),min:0,max:5e3,step:10,style:{width:"100%"}},null,8,["modelValue"])]),_:1})]),_:1})]),t.createElementVNode("div",je,[x[2]||(x[2]=t.createElementVNode("label",null,"当前帧:",-1)),t.createElementVNode("span",Re,t.toDisplayString(l.value+1)+" / "+t.toDisplayString(n.value.length),1)]),t.createElementVNode("div",We,[x[3]||(x[3]=t.createElementVNode("label",null,"动画进度:",-1)),t.createVNode(Z,{modelValue:l.value,"onUpdate:modelValue":x[1]||(x[1]=F=>l.value=F),min:0,max:n.value.length>0?n.value.length-1:0,step:1,"format-tooltip":f,onInput:C,disabled:n.value.length===0,style:{"flex-grow":"1",margin:"0 10px"}},null,8,["modelValue","max","disabled"])])])])}}}),He=ue._export_sfc(Ge,[["__scopeId","data-v-93cde733"]]),re=new c.Box3,q=new c.Vector3;class fe extends c.InstancedBufferGeometry{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],i=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],o=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(o),this.setAttribute("position",new c.Float32BufferAttribute(e,3)),this.setAttribute("uv",new c.Float32BufferAttribute(i,2))}applyMatrix4(e){const i=this.attributes.instanceStart,o=this.attributes.instanceEnd;return i!==void 0&&(i.applyMatrix4(e),o.applyMatrix4(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let i;e instanceof Float32Array?i=e:Array.isArray(e)&&(i=new Float32Array(e));const o=new c.InstancedInterleavedBuffer(i,6,1);return this.setAttribute("instanceStart",new c.InterleavedBufferAttribute(o,3,0)),this.setAttribute("instanceEnd",new c.InterleavedBufferAttribute(o,3,3)),this.instanceCount=this.attributes.instanceStart.count,this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let i;e instanceof Float32Array?i=e:Array.isArray(e)&&(i=new Float32Array(e));const o=new c.InstancedInterleavedBuffer(i,6,1);return this.setAttribute("instanceColorStart",new c.InterleavedBufferAttribute(o,3,0)),this.setAttribute("instanceColorEnd",new c.InterleavedBufferAttribute(o,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new c.WireframeGeometry(e.geometry)),this}fromLineSegments(e){const i=e.geometry;return this.setPositions(i.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new c.Box3);const e=this.attributes.instanceStart,i=this.attributes.instanceEnd;e!==void 0&&i!==void 0&&(this.boundingBox.setFromBufferAttribute(e),re.setFromBufferAttribute(i),this.boundingBox.union(re))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new c.Sphere),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,i=this.attributes.instanceEnd;if(e!==void 0&&i!==void 0){const o=this.boundingSphere.center;this.boundingBox.getCenter(o);let n=0;for(let s=0,l=e.count;s<l;s++)q.fromBufferAttribute(e,s),n=Math.max(n,o.distanceToSquared(q)),q.fromBufferAttribute(i,s),n=Math.max(n,o.distanceToSquared(q));this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}}c.UniformsLib.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new c.Vector2(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}};c.ShaderLib.line={uniforms:c.UniformsUtils.merge([c.UniformsLib.common,c.UniformsLib.fog,c.UniformsLib.line]),vertexShader:`
|
|
2
2
|
#include <common>
|
|
3
3
|
#include <color_pars_vertex>
|
|
4
4
|
#include <fog_pars_vertex>
|
|
@@ -367,4 +367,4 @@
|
|
|
367
367
|
#include <premultiplied_alpha_fragment>
|
|
368
368
|
|
|
369
369
|
}
|
|
370
|
-
`};class te extends c.ShaderMaterial{constructor(e){super({type:"LineMaterial",uniforms:c.UniformsUtils.clone(c.ShaderLib.line.uniforms),vertexShader:c.ShaderLib.line.vertexShader,fragmentShader:c.ShaderLib.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(e)}get color(){return this.uniforms.diffuse.value}set color(e){this.uniforms.diffuse.value=e}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(e){e===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(e){this.uniforms.linewidth&&(this.uniforms.linewidth.value=e)}get dashed(){return"USE_DASH"in this.defines}set dashed(e){e===!0!==this.dashed&&(this.needsUpdate=!0),e===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(e){this.uniforms.dashScale.value=e}get dashSize(){return this.uniforms.dashSize.value}set dashSize(e){this.uniforms.dashSize.value=e}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(e){this.uniforms.dashOffset.value=e}get gapSize(){return this.uniforms.gapSize.value}set gapSize(e){this.uniforms.gapSize.value=e}get opacity(){return this.uniforms.opacity.value}set opacity(e){this.uniforms&&(this.uniforms.opacity.value=e)}get resolution(){return this.uniforms.resolution.value}set resolution(e){this.uniforms.resolution.value.copy(e)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(e){this.defines&&(e===!0!==this.alphaToCoverage&&(this.needsUpdate=!0),e===!0?this.defines.USE_ALPHA_TO_COVERAGE="":delete this.defines.USE_ALPHA_TO_COVERAGE)}}const J=new c.Vector4,se=new c.Vector3,ae=new c.Vector3,b=new c.Vector4,S=new c.Vector4,T=new c.Vector4,Q=new c.Vector3,ee=new c.Matrix4,_=new c.Line3,le=new c.Vector3,$=new c.Box3,X=new c.Sphere,U=new c.Vector4;let M,D;function ce(r,e,i){return U.set(0,0,-e,1).applyMatrix4(r.projectionMatrix),U.multiplyScalar(1/U.w),U.x=D/i.width,U.y=D/i.height,U.applyMatrix4(r.projectionMatrixInverse),U.multiplyScalar(1/U.w),Math.abs(Math.max(U.x,U.y))}function qe(r,e){const i=r.matrixWorld,o=r.geometry,n=o.attributes.instanceStart,s=o.attributes.instanceEnd,l=Math.min(o.instanceCount,n.count);for(let a=0,p=l;a<p;a++){_.start.fromBufferAttribute(n,a),_.end.fromBufferAttribute(s,a),_.applyMatrix4(i);const f=new c.Vector3,h=new c.Vector3;M.distanceSqToSegment(_.start,_.end,h,f),h.distanceTo(f)<D*.5&&e.push({point:h,pointOnLine:f,distance:M.origin.distanceTo(h),object:r,face:null,faceIndex:a,uv:null,uv1:null})}}function $e(r,e,i){const o=e.projectionMatrix,s=r.material.resolution,l=r.matrixWorld,a=r.geometry,p=a.attributes.instanceStart,f=a.attributes.instanceEnd,h=Math.min(a.instanceCount,p.count),m=-e.near;M.at(1,T),T.w=1,T.applyMatrix4(e.matrixWorldInverse),T.applyMatrix4(o),T.multiplyScalar(1/T.w),T.x*=s.x/2,T.y*=s.y/2,T.z=0,Q.copy(T),ee.multiplyMatrices(e.matrixWorldInverse,l);for(let v=0,C=h;v<C;v++){if(b.fromBufferAttribute(p,v),S.fromBufferAttribute(f,v),b.w=1,S.w=1,b.applyMatrix4(ee),S.applyMatrix4(ee),b.z>m&&S.z>m)continue;if(b.z>m){const V=b.z-S.z,N=(b.z-m)/V;b.lerp(S,N)}else if(S.z>m){const V=S.z-b.z,N=(S.z-m)/V;S.lerp(b,N)}b.applyMatrix4(o),S.applyMatrix4(o),b.multiplyScalar(1/b.w),S.multiplyScalar(1/S.w),b.x*=s.x/2,b.y*=s.y/2,S.x*=s.x/2,S.y*=s.y/2,_.start.copy(b),_.start.z=0,_.end.copy(S),_.end.z=0;const A=_.closestPointToPointParameter(Q,!0);_.at(A,le);const g=c.MathUtils.lerp(b.z,S.z,A),x=g>=-1&&g<=1,E=Q.distanceTo(le)<D*.5;if(x&&E){_.start.fromBufferAttribute(p,v),_.end.fromBufferAttribute(f,v),_.start.applyMatrix4(l),_.end.applyMatrix4(l);const V=new c.Vector3,N=new c.Vector3;M.distanceSqToSegment(_.start,_.end,N,V),i.push({point:N,pointOnLine:V,distance:M.origin.distanceTo(N),object:r,face:null,faceIndex:v,uv:null,uv1:null})}}}class Xe extends c.Mesh{constructor(e=new fe,i=new te({color:Math.random()*16777215})){super(e,i),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,i=e.attributes.instanceStart,o=e.attributes.instanceEnd,n=new Float32Array(2*i.count);for(let l=0,a=0,p=i.count;l<p;l++,a+=2)se.fromBufferAttribute(i,l),ae.fromBufferAttribute(o,l),n[a]=a===0?0:n[a-1],n[a+1]=n[a]+se.distanceTo(ae);const s=new c.InstancedInterleavedBuffer(n,2,1);return e.setAttribute("instanceDistanceStart",new c.InterleavedBufferAttribute(s,1,0)),e.setAttribute("instanceDistanceEnd",new c.InterleavedBufferAttribute(s,1,1)),this}raycast(e,i){const o=this.material.worldUnits,n=e.camera;n===null&&!o&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const s=e.params.Line2!==void 0&&e.params.Line2.threshold||0;M=e.ray;const l=this.matrixWorld,a=this.geometry,p=this.material;D=p.linewidth+s,a.boundingSphere===null&&a.computeBoundingSphere(),X.copy(a.boundingSphere).applyMatrix4(l);let f;if(o)f=D*.5;else{const m=Math.max(n.near,X.distanceToPoint(M.origin));f=ce(n,m,p.resolution)}if(X.radius+=f,M.intersectsSphere(X)===!1)return;a.boundingBox===null&&a.computeBoundingBox(),$.copy(a.boundingBox).applyMatrix4(l);let h;if(o)h=D*.5;else{const m=Math.max(n.near,$.distanceToPoint(M.origin));h=ce(n,m,p.resolution)}$.expandByScalar(h),M.intersectsBox($)!==!1&&(o?qe(this,i):$e(this,n,i))}onBeforeRender(e){const i=this.material.uniforms;i&&i.resolution&&(e.getViewport(J),this.material.uniforms.resolution.value.set(J.z,J.w))}}class me extends fe{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){const i=e.length-3,o=new Float32Array(2*i);for(let n=0;n<i;n+=3)o[2*n]=e[n],o[2*n+1]=e[n+1],o[2*n+2]=e[n+2],o[2*n+3]=e[n+3],o[2*n+4]=e[n+4],o[2*n+5]=e[n+5];return super.setPositions(o),this}setColors(e){const i=e.length-3,o=new Float32Array(2*i);for(let n=0;n<i;n+=3)o[2*n]=e[n],o[2*n+1]=e[n+1],o[2*n+2]=e[n+2],o[2*n+3]=e[n+3],o[2*n+4]=e[n+4],o[2*n+5]=e[n+5];return super.setColors(o),this}setFromPoints(e){const i=e.length-1,o=new Float32Array(6*i);for(let n=0;n<i;n++)o[6*n]=e[n].x,o[6*n+1]=e[n].y,o[6*n+2]=e[n].z||0,o[6*n+3]=e[n+1].x,o[6*n+4]=e[n+1].y,o[6*n+5]=e[n+1].z||0;return super.setPositions(o),this}fromLine(e){const i=e.geometry;return this.setPositions(i.attributes.position.array),this}}class Ye extends Xe{constructor(e=new me,i=new te({color:Math.random()*16777215})){super(e,i),this.isLine2=!0,this.type="Line2"}}function Ze(r){const e=[];return r.forEach(i=>{const[o,n,s]=i.trim().split(/\s+/);e.push(+o,+n,+s)}),e}function Y(r,e,i){switch(r){case"X":e.x=+i||0;break;case"Y":e.y=+i||0;break;case"Z":e.z=+i||0;break}}function Ke(r){const e=[],i=["X","Y","Z"];return r.forEach(o=>{const n={x:0,y:0,z:0},s=o.trim();if(!s)return;let l=null,a="";for(let p=0;p<(s==null?void 0:s.length);p++){const f=s[p],h=i.find(m=>m===f);if(h){l&&Y(l,n,a),a="",l=h;continue}a=a+f}Y(l,n,a),e.push(n.x,n.y,n.z)}),e}const Je=r=>r==null?void 0:r.filter(i=>i.includes("=")),Qe=r=>r.replace(/,/g,""),et=r=>r==null?void 0:r.map(i=>Qe(i)),tt=r=>{const e=Je(r);return et(e)};function nt(r){const e=tt(r),i=[];return e.forEach(o=>{var m,v,C,B,A,g;let[n,s,l,a]=o.trim().split(/\s+/);s=(m=s==null?void 0:s.trim)==null?void 0:m.call(s),l=(v=l==null?void 0:l.trim)==null?void 0:v.call(l),a=(C=a==null?void 0:a.trim)==null?void 0:C.call(a);const[,p]=(B=s==null?void 0:s.split)==null?void 0:B.call(s,"="),[,f]=(A=l==null?void 0:l.split)==null?void 0:A.call(l,"="),[,h]=(g=a==null?void 0:a.split)==null?void 0:g.call(a,"=");i.push(+p,+f,+h)}),i}function it(r){const e=[],i=["X","Y","Z"];return r.forEach(o=>{const n={x:0,y:0,z:0},s=o.trim();if(!s)return;let l=null,a="";for(let p=0;p<(s==null?void 0:s.length);p++){const f=s[p],h=i.find(m=>m===f);if(h){l&&Y(l,n,a),a="",l=h;continue}a=a+f}Y(l,n,a),e.push(n.x,n.y,n.z)}),e}function ot(r){return r==null?void 0:r.includes("=")}async function rt(r){var n,s;const e=(n=r==null?void 0:r.trim())==null?void 0:n.split(/\r?\n/);if(ot(r))return nt(e);const i=e==null?void 0:e[0],o=(s=i==null?void 0:i.trim())==null?void 0:s.split(/\s+/);if((o==null?void 0:o.length)>=3)return Ze(e);if((o==null?void 0:o.length)===1)return Ke(e)}async function st(r){const e=r.trim().split(/\r?\n/),i=[];return e.forEach(o=>{const n=o.trim().split(/\s+/);if(n.length!=3)return;const[s,l,a]=n;i.push(+s,+l,+a)}),i}async function at(r){const e=r.trim().split(/\r?\n/),i=[];return e.forEach(o=>{const n=o.trim().split(/\s+/);if(n.length!=3)return;const[s,l,a]=n;i.push(+s,+l,+a)}),i}async function lt(r){let e=r.trim().split(/\r?\n/);return e=e.filter(o=>o.startsWith("X")),e=e.map(o=>{const s=o.indexOf("A");return o.slice(0,s)}),it(e)}async function ct(r,e){const{isCyd:i,isUv:o,isCpt:n,isNc:s}=e;return o?rt(r):i?at(r):n?st(r):s?lt(r):[]}function ut(r){const e=[];for(let i=0;i<r.length;i+=3)e.push(new c.Vector3(r[i],r[i+1],r[i+2]));return e}function dt(r,e){if(!e||e.length<3)return;const{scene:i,camera:o,renderer:n,controls:s}=r();if(!i||!o||!n||!s)return;const l=[];for(let v=0;v<e.length;v+=3)l.push(new c.Vector3(e[v],e[v+1],e[v+2]));const p=new c.CatmullRomCurve3(l,!1,"catmullrom",.5).getPoints(150).flatMap(v=>[v.x,v.y,v.z]),f=new me;f.setPositions(p);const h=new te({color:55551,linewidth:3,resolution:new c.Vector2(window.innerWidth,window.innerHeight)}),m=new Ye(f,h);return m.name="轨迹路径",i.add(m),m}function ft(r,e,i,o=4,n=50){let s=1/0,l=-1/0,a=1/0,p=-1/0,f=1/0,h=-1/0;for(let g=0;g<r.length;g+=3){const x=r[g],E=r[g+1],V=r[g+2];s=Math.min(s,x),l=Math.max(l,x),a=Math.min(a,E),p=Math.max(p,E),f=Math.min(f,V),h=Math.max(h,V)}const v=Math.sqrt((l-s)**2+(p-a)**2+(h-f)**2)*.05,C=c.MathUtils.degToRad(e.fov),B=2*Math.tan(C/2)*n,A=v/B*i.domElement.height*(o/4);return Math.max(1,A)}function mt(r){if(r.length%3!==0)return console.error("points array length is not a multiple of 3:",r),null;const e=new c.BufferGeometry;e.setAttribute("position",new c.Float32BufferAttribute(r,3));const i=new Float32Array(r.length);for(let s=0;s<r.length;s+=3)i[s]=0,i[s+1]=.847,i[s+2]=1;e.setAttribute("color",new c.BufferAttribute(i,3));const o=new c.PointsMaterial({vertexColors:!0,size:1,sizeAttenuation:!1}),n=new c.Points(e,o);return o.needsUpdate=!0,n}function pt(r,e){if(!e)return;const{scene:i,camera:o,renderer:n,controls:s}=r();if(!i||!o||!n||!s)return;const l=mt(e);l.name="轨迹路径",i.add(l);const a=ft(e,o,n,.5,50);return l.material.size=a,l}const ht={class:"obj-viewer-container"},vt={class:"buttonGroup-top"},gt={class:"buttonGroup-topLeft"},yt={class:"buttonGroup-left"},wt={class:"buttonGroup-right"},xt={class:"buttonGroup-bottom"},bt={class:"left-panel"},St={class:"panel-header"},_t={class:"panel-body"},Et={key:1,class:"clipping-content"},Ct={class:"radio-group"},Vt={class:"radio-label"},zt={class:"radio-label"},Nt={class:"radio-label"},At={class:"radio-label"},Tt={class:"right-panel"},Ut={class:"panel-header"},Mt={class:"panel-body"},Bt={key:0,class:"loading-overlay"},Lt=t.defineComponent({__name:"threeTrackPathView",props:{fileBlobs:{},threeData:{default:()=>""},trackFileType:{}},emits:["getAnimationData","getThreeData"],setup(r,{emit:e}){const i=e,o=r,n=t.ref(null),s=t.ref(!1),l=t.ref(""),a=t.ref(),p=t.ref(!1),f=t.ref(""),h=t.ref(!1),m=t.ref(""),v=t.shallowRef(null),C=t.shallowRef(null),{currentModels:B,resetView:A,initThreeJS:g,handleResize:x,getThreeJSObjects:E,cleanup:V,axesHelperVisible:N,toggleAxesVisibility:Z}=O.useThreeJS(n),{isAnimating:F,toggleAnimation:pe,stopAnimation:he}=O.useAnimation(E,B),{isClipping:ve,activeClippingAxis:z,toggleClipping:ge,updateClippingPlanes:L}=O.useClipping(E,B),ye=()=>{Z()},j=d=>{p.value=!0,f.value=d,d==="剖面视图"&&!ve.value&&ge()},H=d=>{h.value=!0,m.value=d,d==="动画仿真"&&i("getAnimationData")},K=t.ref([]),R=t.ref([]),we=t.computed(()=>{var u;return(u=o.trackFileType)==null?void 0:u.isUv}),xe=t.computed(()=>{var u;return(u=o.trackFileType)==null?void 0:u.isCyd}),be=t.computed(()=>{var u;return(u=o.trackFileType)==null?void 0:u.isCpt}),P=t.computed(()=>{var u;return(u=o.trackFileType)==null?void 0:u.isNc}),Se=t.computed(()=>{const d=o.fileBlobs||[];return d==null?void 0:d[0]});let k=t.shallowRef(),I=t.shallowRef();const _e=()=>{const{scene:d}=E();k.value&&d&&(O.disposeObj(k.value,d),k.value=null)},Ee=()=>{const{scene:d}=E();I.value&&d&&(O.disposeObj(I.value,d),I.value=null)},ne=()=>{_e(),Ee()},Ce=async d=>{const u=URL.createObjectURL(d),W=await Be.readFileText(u);if(URL.revokeObjectURL(u),Le.isString(W)){const y=await ct(W,o.trackFileType)||[];K.value=y;const ie=K.value;we.value&&(k.value=dt(E,ie)),(xe.value||be.value||P.value)&&(k.value=pt(E,ie)),O.frameCameraToMesh(E,k.value)}},Ve=()=>{var d,u;I.value=ke(),R.value=ut(K.value),R.value&&R.value.length&&(de(I.value,R.value[0],k.value,new c.Color(16711680)),(u=(d=C.value)==null?void 0:d.add)==null||u.call(d,I.value))};t.watch(()=>Se.value,async d=>{d&&(ne(),await Ce(d),P.value&&Ve())},{immediate:!0,deep:!0});const ze=()=>{var d;P.value&&((d=a==null?void 0:a.value)==null||d.playAnimation())},Ne=()=>{var d;P.value&&((d=a==null?void 0:a.value)==null||d.stopAnimation())},Ae=()=>{var d;P.value&&((d=a==null?void 0:a.value)==null||d.forwardFrame())},Te=()=>{var d;P.value&&((d=a==null?void 0:a.value)==null||d.backwardFrame())},Ue=()=>{g(),window.addEventListener("resize",x);const d=E();C.value=d.scene,C.value&&(C.value.name="CPMPIP")},Me=()=>{window.removeEventListener("resize",x),F.value&&he(),ne(),V()};return t.onMounted(async()=>{try{Ue()}catch(d){console.error("Three.js 初始化失败:",d),G.ElMessage.error("渲染引擎初始化失败!")}}),t.onBeforeUnmount(()=>{Me()}),(d,u)=>{const W=t.resolveComponent("el-scrollbar");return t.openBlock(),t.createElementBlock("div",ht,[t.createElementVNode("div",{ref_key:"threejsContainer",ref:n,class:"threejs-container"},null,512),t.createElementVNode("div",vt,[t.createVNode(w.ThreeSvgIcon,{name:"guanjianjiexi",size:"34"}),t.createVNode(w.ThreeSvgIcon,{name:"guanjiekongzhi",size:"34"}),t.createVNode(w.ThreeSvgIcon,{name:"gongyishengcheng",size:"34"}),t.createVNode(w.ThreeSvgIcon,{name:"buchangshezhi",size:"34"}),t.createVNode(w.ThreeSvgIcon,{name:"shuchujiagongchengxu",size:"34"})]),t.createElementVNode("div",gt,[t.createVNode(w.ThreeSvgIcon,{name:"viewReset",size:"24",onClick:t.unref(A),title:"重置"},null,8,["onClick"]),t.createVNode(w.ThreeSvgIcon,{name:"fangda",size:"24",title:"放大"}),t.createVNode(w.ThreeSvgIcon,{name:"suoxiao",size:"24",title:"缩小"}),t.createVNode(w.ThreeSvgIcon,{name:"lookAround",size:"24",onClick:t.unref(pe),title:t.unref(F)?"停止动画":"动画视图"},null,8,["onClick","title"]),t.createVNode(w.ThreeSvgIcon,{name:"zuobiaoxi",size:"24",active:t.unref(N),onClick:ye,title:"显隐坐标轴"},null,8,["active"])]),t.createElementVNode("div",yt,[t.renderSlot(d.$slots,"button-left",{switchRightPanel:j},void 0,!0),t.createVNode(w.ThreeSvgIcon,{name:"jiegoushu",size:"24",onClick:u[0]||(u[0]=y=>j("场景树")),active:p.value&&f.value==="场景树",title:"场景树"},null,8,["active"]),t.createVNode(w.ThreeSvgIcon,{name:"clipping",size:"24",onClick:u[1]||(u[1]=y=>j("剖面视图")),active:p.value&&f.value==="剖面视图",title:"剖面视图"},null,8,["active"]),t.createVNode(w.ThreeSvgIcon,{name:"donghuafangzhen",size:"24",onClick:u[2]||(u[2]=y=>j("场景树3"))}),t.createVNode(w.ThreeSvgIcon,{name:"donghuafangzhen",size:"24",onClick:u[3]||(u[3]=y=>j("场景4"))})]),t.createElementVNode("div",wt,[t.renderSlot(d.$slots,"button-right",{switchRightPanel:H},void 0,!0),t.createVNode(w.ThreeSvgIcon,{name:"donghuafangzhen",size:"24"}),t.createVNode(w.ThreeSvgIcon,{name:"guanjiekongzhi",size:"24",onClick:u[4]||(u[4]=y=>H("关节控制")),active:h.value&&m.value==="关节控制",title:"关节控制"},null,8,["active"]),t.createVNode(w.ThreeSvgIcon,{name:"donghuafangzhen",size:"24",title:"动画仿真",onClick:u[5]||(u[5]=y=>H("动画仿真")),active:h.value&&m.value==="动画仿真"},null,8,["active"]),t.createVNode(w.ThreeSvgIcon,{name:"donghuafangzhen",size:"24",title:"urdf动画",onClick:u[6]||(u[6]=y=>H("urdf动画")),active:h.value&&m.value==="urdf动画"},null,8,["active"]),t.createVNode(w.ThreeSvgIcon,{name:"donghuafangzhen",size:"24"})]),t.createElementVNode("div",xt,[t.createVNode(w.ThreeSvgIcon,{name:"kuaitui",size:"24",backgroundColor:"#ffffff",title:"快退",onClick:Te}),t.createVNode(w.ThreeSvgIcon,{name:"bofang",size:"24",backgroundColor:"#ffffff",title:"播放",onClick:ze}),t.createVNode(w.ThreeSvgIcon,{name:"kuaijin",size:"24",backgroundColor:"#ffffff",title:"快进",onClick:Ae}),t.createVNode(w.ThreeSvgIcon,{name:"zanting",size:"24",backgroundColor:"#ffffff",title:"暂停",onClick:Ne})]),t.withDirectives(t.createElementVNode("div",bt,[t.createElementVNode("div",St,[t.createElementVNode("span",null,t.toDisplayString(f.value),1),t.createElementVNode("span",{class:"close",onClick:u[7]||(u[7]=y=>p.value=!1)}," X ")]),t.createElementVNode("div",_t,[t.createVNode(W,{height:"100%"},{default:t.withCtx(()=>[f.value==="场景树"?(t.openBlock(),t.createBlock(oe.UrdfTree,{key:0,model:v.value},null,8,["model"])):t.createCommentVNode("",!0),f.value==="剖面视图"?(t.openBlock(),t.createElementBlock("div",Et,[t.createElementVNode("div",Ct,[t.createElementVNode("label",Vt,[t.withDirectives(t.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"none","onUpdate:modelValue":u[8]||(u[8]=y=>t.isRef(z)?z.value=y:null),onChange:u[9]||(u[9]=(...y)=>t.unref(L)&&t.unref(L)(...y))},null,544),[[t.vModelRadio,t.unref(z)]]),u[17]||(u[17]=t.createElementVNode("span",{class:"radio-text"},"无切割",-1))]),t.createElementVNode("label",zt,[t.withDirectives(t.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"x","onUpdate:modelValue":u[10]||(u[10]=y=>t.isRef(z)?z.value=y:null),onChange:u[11]||(u[11]=(...y)=>t.unref(L)&&t.unref(L)(...y))},null,544),[[t.vModelRadio,t.unref(z)]]),u[18]||(u[18]=t.createElementVNode("span",{class:"radio-text"},"X轴切割",-1))]),t.createElementVNode("label",Nt,[t.withDirectives(t.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"y","onUpdate:modelValue":u[12]||(u[12]=y=>t.isRef(z)?z.value=y:null),onChange:u[13]||(u[13]=(...y)=>t.unref(L)&&t.unref(L)(...y))},null,544),[[t.vModelRadio,t.unref(z)]]),u[19]||(u[19]=t.createElementVNode("span",{class:"radio-text"},"Y轴切割",-1))]),t.createElementVNode("label",At,[t.withDirectives(t.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"z","onUpdate:modelValue":u[14]||(u[14]=y=>t.isRef(z)?z.value=y:null),onChange:u[15]||(u[15]=(...y)=>t.unref(L)&&t.unref(L)(...y))},null,544),[[t.vModelRadio,t.unref(z)]]),u[20]||(u[20]=t.createElementVNode("span",{class:"radio-text"},"Z轴切割",-1))])])])):t.createCommentVNode("",!0)]),_:1})])],512),[[t.vShow,p.value]]),t.withDirectives(t.createElementVNode("div",Tt,[t.createElementVNode("div",Ut,[t.createElementVNode("span",null,t.toDisplayString(m.value),1),t.createElementVNode("span",{class:"close",onClick:u[16]||(u[16]=y=>h.value=!1)}," X ")]),t.createElementVNode("div",Mt,[t.createVNode(W,{height:"100%"},{default:t.withCtx(()=>[t.withDirectives(t.createVNode(oe.JointPanel,{model:v.value},null,8,["model"]),[[t.vShow,m.value==="关节控制"]]),t.withDirectives(t.createVNode(He,{ref_key:"animationPanelRef",ref:a,cloud:t.unref(k),knife:t.unref(I),vectors:R.value},null,8,["cloud","knife","vectors"]),[[t.vShow,m.value==="动画仿真"&&P.value]])]),_:1})])],512),[[t.vShow,h.value]]),s.value?(t.openBlock(),t.createElementBlock("div",Bt,[u[21]||(u[21]=t.createElementVNode("div",{class:"loading-spinner"},null,-1)),t.createElementVNode("p",null,t.toDisplayString(l.value),1)])):t.createCommentVNode("",!0)])}}}),kt=ue._export_sfc(Lt,[["__scopeId","data-v-e8652636"]]);exports.default=kt;
|
|
370
|
+
`};class te extends c.ShaderMaterial{constructor(e){super({type:"LineMaterial",uniforms:c.UniformsUtils.clone(c.ShaderLib.line.uniforms),vertexShader:c.ShaderLib.line.vertexShader,fragmentShader:c.ShaderLib.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(e)}get color(){return this.uniforms.diffuse.value}set color(e){this.uniforms.diffuse.value=e}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(e){e===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(e){this.uniforms.linewidth&&(this.uniforms.linewidth.value=e)}get dashed(){return"USE_DASH"in this.defines}set dashed(e){e===!0!==this.dashed&&(this.needsUpdate=!0),e===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(e){this.uniforms.dashScale.value=e}get dashSize(){return this.uniforms.dashSize.value}set dashSize(e){this.uniforms.dashSize.value=e}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(e){this.uniforms.dashOffset.value=e}get gapSize(){return this.uniforms.gapSize.value}set gapSize(e){this.uniforms.gapSize.value=e}get opacity(){return this.uniforms.opacity.value}set opacity(e){this.uniforms&&(this.uniforms.opacity.value=e)}get resolution(){return this.uniforms.resolution.value}set resolution(e){this.uniforms.resolution.value.copy(e)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(e){this.defines&&(e===!0!==this.alphaToCoverage&&(this.needsUpdate=!0),e===!0?this.defines.USE_ALPHA_TO_COVERAGE="":delete this.defines.USE_ALPHA_TO_COVERAGE)}}const J=new c.Vector4,se=new c.Vector3,ae=new c.Vector3,b=new c.Vector4,S=new c.Vector4,T=new c.Vector4,Q=new c.Vector3,ee=new c.Matrix4,_=new c.Line3,le=new c.Vector3,$=new c.Box3,X=new c.Sphere,U=new c.Vector4;let M,D;function ce(r,e,i){return U.set(0,0,-e,1).applyMatrix4(r.projectionMatrix),U.multiplyScalar(1/U.w),U.x=D/i.width,U.y=D/i.height,U.applyMatrix4(r.projectionMatrixInverse),U.multiplyScalar(1/U.w),Math.abs(Math.max(U.x,U.y))}function qe(r,e){const i=r.matrixWorld,o=r.geometry,n=o.attributes.instanceStart,s=o.attributes.instanceEnd,l=Math.min(o.instanceCount,n.count);for(let a=0,p=l;a<p;a++){_.start.fromBufferAttribute(n,a),_.end.fromBufferAttribute(s,a),_.applyMatrix4(i);const f=new c.Vector3,h=new c.Vector3;M.distanceSqToSegment(_.start,_.end,h,f),h.distanceTo(f)<D*.5&&e.push({point:h,pointOnLine:f,distance:M.origin.distanceTo(h),object:r,face:null,faceIndex:a,uv:null,uv1:null})}}function $e(r,e,i){const o=e.projectionMatrix,s=r.material.resolution,l=r.matrixWorld,a=r.geometry,p=a.attributes.instanceStart,f=a.attributes.instanceEnd,h=Math.min(a.instanceCount,p.count),m=-e.near;M.at(1,T),T.w=1,T.applyMatrix4(e.matrixWorldInverse),T.applyMatrix4(o),T.multiplyScalar(1/T.w),T.x*=s.x/2,T.y*=s.y/2,T.z=0,Q.copy(T),ee.multiplyMatrices(e.matrixWorldInverse,l);for(let v=0,C=h;v<C;v++){if(b.fromBufferAttribute(p,v),S.fromBufferAttribute(f,v),b.w=1,S.w=1,b.applyMatrix4(ee),S.applyMatrix4(ee),b.z>m&&S.z>m)continue;if(b.z>m){const V=b.z-S.z,N=(b.z-m)/V;b.lerp(S,N)}else if(S.z>m){const V=S.z-b.z,N=(S.z-m)/V;S.lerp(b,N)}b.applyMatrix4(o),S.applyMatrix4(o),b.multiplyScalar(1/b.w),S.multiplyScalar(1/S.w),b.x*=s.x/2,b.y*=s.y/2,S.x*=s.x/2,S.y*=s.y/2,_.start.copy(b),_.start.z=0,_.end.copy(S),_.end.z=0;const A=_.closestPointToPointParameter(Q,!0);_.at(A,le);const g=c.MathUtils.lerp(b.z,S.z,A),x=g>=-1&&g<=1,E=Q.distanceTo(le)<D*.5;if(x&&E){_.start.fromBufferAttribute(p,v),_.end.fromBufferAttribute(f,v),_.start.applyMatrix4(l),_.end.applyMatrix4(l);const V=new c.Vector3,N=new c.Vector3;M.distanceSqToSegment(_.start,_.end,N,V),i.push({point:N,pointOnLine:V,distance:M.origin.distanceTo(N),object:r,face:null,faceIndex:v,uv:null,uv1:null})}}}class Xe extends c.Mesh{constructor(e=new fe,i=new te({color:Math.random()*16777215})){super(e,i),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,i=e.attributes.instanceStart,o=e.attributes.instanceEnd,n=new Float32Array(2*i.count);for(let l=0,a=0,p=i.count;l<p;l++,a+=2)se.fromBufferAttribute(i,l),ae.fromBufferAttribute(o,l),n[a]=a===0?0:n[a-1],n[a+1]=n[a]+se.distanceTo(ae);const s=new c.InstancedInterleavedBuffer(n,2,1);return e.setAttribute("instanceDistanceStart",new c.InterleavedBufferAttribute(s,1,0)),e.setAttribute("instanceDistanceEnd",new c.InterleavedBufferAttribute(s,1,1)),this}raycast(e,i){const o=this.material.worldUnits,n=e.camera;n===null&&!o&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const s=e.params.Line2!==void 0&&e.params.Line2.threshold||0;M=e.ray;const l=this.matrixWorld,a=this.geometry,p=this.material;D=p.linewidth+s,a.boundingSphere===null&&a.computeBoundingSphere(),X.copy(a.boundingSphere).applyMatrix4(l);let f;if(o)f=D*.5;else{const m=Math.max(n.near,X.distanceToPoint(M.origin));f=ce(n,m,p.resolution)}if(X.radius+=f,M.intersectsSphere(X)===!1)return;a.boundingBox===null&&a.computeBoundingBox(),$.copy(a.boundingBox).applyMatrix4(l);let h;if(o)h=D*.5;else{const m=Math.max(n.near,$.distanceToPoint(M.origin));h=ce(n,m,p.resolution)}$.expandByScalar(h),M.intersectsBox($)!==!1&&(o?qe(this,i):$e(this,n,i))}onBeforeRender(e){const i=this.material.uniforms;i&&i.resolution&&(e.getViewport(J),this.material.uniforms.resolution.value.set(J.z,J.w))}}class me extends fe{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){const i=e.length-3,o=new Float32Array(2*i);for(let n=0;n<i;n+=3)o[2*n]=e[n],o[2*n+1]=e[n+1],o[2*n+2]=e[n+2],o[2*n+3]=e[n+3],o[2*n+4]=e[n+4],o[2*n+5]=e[n+5];return super.setPositions(o),this}setColors(e){const i=e.length-3,o=new Float32Array(2*i);for(let n=0;n<i;n+=3)o[2*n]=e[n],o[2*n+1]=e[n+1],o[2*n+2]=e[n+2],o[2*n+3]=e[n+3],o[2*n+4]=e[n+4],o[2*n+5]=e[n+5];return super.setColors(o),this}setFromPoints(e){const i=e.length-1,o=new Float32Array(6*i);for(let n=0;n<i;n++)o[6*n]=e[n].x,o[6*n+1]=e[n].y,o[6*n+2]=e[n].z||0,o[6*n+3]=e[n+1].x,o[6*n+4]=e[n+1].y,o[6*n+5]=e[n+1].z||0;return super.setPositions(o),this}fromLine(e){const i=e.geometry;return this.setPositions(i.attributes.position.array),this}}class Ye extends Xe{constructor(e=new me,i=new te({color:Math.random()*16777215})){super(e,i),this.isLine2=!0,this.type="Line2"}}function Ze(r){const e=[];return r.forEach(i=>{const[o,n,s]=i.trim().split(/\s+/);e.push(+o,+n,+s)}),e}function Y(r,e,i){switch(r){case"X":e.x=+i||0;break;case"Y":e.y=+i||0;break;case"Z":e.z=+i||0;break}}function Ke(r){const e=[],i=["X","Y","Z"];return r.forEach(o=>{const n={x:0,y:0,z:0},s=o.trim();if(!s)return;let l=null,a="";for(let p=0;p<(s==null?void 0:s.length);p++){const f=s[p],h=i.find(m=>m===f);if(h){l&&Y(l,n,a),a="",l=h;continue}a=a+f}Y(l,n,a),e.push(n.x,n.y,n.z)}),e}const Je=r=>r==null?void 0:r.filter(i=>i.includes("=")),Qe=r=>r.replace(/,/g,""),et=r=>r==null?void 0:r.map(i=>Qe(i)),tt=r=>{const e=Je(r);return et(e)};function nt(r){const e=tt(r),i=[];return e.forEach(o=>{var m,v,C,B,A,g;let[n,s,l,a]=o.trim().split(/\s+/);s=(m=s==null?void 0:s.trim)==null?void 0:m.call(s),l=(v=l==null?void 0:l.trim)==null?void 0:v.call(l),a=(C=a==null?void 0:a.trim)==null?void 0:C.call(a);const[,p]=(B=s==null?void 0:s.split)==null?void 0:B.call(s,"="),[,f]=(A=l==null?void 0:l.split)==null?void 0:A.call(l,"="),[,h]=(g=a==null?void 0:a.split)==null?void 0:g.call(a,"=");i.push(+p,+f,+h)}),i}function it(r){const e=[],i=["X","Y","Z"];return r.forEach(o=>{const n={x:0,y:0,z:0},s=o.trim();if(!s)return;let l=null,a="";for(let p=0;p<(s==null?void 0:s.length);p++){const f=s[p],h=i.find(m=>m===f);if(h){l&&Y(l,n,a),a="",l=h;continue}a=a+f}Y(l,n,a),e.push(n.x,n.y,n.z)}),e}function ot(r){return r==null?void 0:r.includes("=")}async function rt(r){var n,s;const e=(n=r==null?void 0:r.trim())==null?void 0:n.split(/\r?\n/);if(ot(r))return nt(e);const i=e==null?void 0:e[0],o=(s=i==null?void 0:i.trim())==null?void 0:s.split(/\s+/);if((o==null?void 0:o.length)>=3)return Ze(e);if((o==null?void 0:o.length)===1)return Ke(e)}async function st(r){const e=r.trim().split(/\r?\n/),i=[];return e.forEach(o=>{const n=o.trim().split(/\s+/);if(n.length!=3)return;const[s,l,a]=n;i.push(+s,+l,+a)}),i}async function at(r){const e=r.trim().split(/\r?\n/),i=[];return e.forEach(o=>{const n=o.trim().split(/\s+/);if(n.length!=3)return;const[s,l,a]=n;i.push(+s,+l,+a)}),i}async function lt(r){let e=r.trim().split(/\r?\n/);return e=e.filter(o=>o.startsWith("X")),e=e.map(o=>{const s=o.indexOf("A");return o.slice(0,s)}),it(e)}async function ct(r,e){const{isCyd:i,isUv:o,isCpt:n,isNc:s}=e;return o?rt(r):i?at(r):n?st(r):s?lt(r):[]}function ut(r){const e=[];for(let i=0;i<r.length;i+=3)e.push(new c.Vector3(r[i],r[i+1],r[i+2]));return e}function dt(r,e){if(!e||e.length<3)return;const{scene:i,camera:o,renderer:n,controls:s}=r();if(!i||!o||!n||!s)return;const l=[];for(let v=0;v<e.length;v+=3)l.push(new c.Vector3(e[v],e[v+1],e[v+2]));const p=new c.CatmullRomCurve3(l,!1,"catmullrom",.5).getPoints(150).flatMap(v=>[v.x,v.y,v.z]),f=new me;f.setPositions(p);const h=new te({color:55551,linewidth:3,resolution:new c.Vector2(window.innerWidth,window.innerHeight)}),m=new Ye(f,h);return m.name="轨迹路径",i.add(m),m}function ft(r,e,i,o=4,n=50){let s=1/0,l=-1/0,a=1/0,p=-1/0,f=1/0,h=-1/0;for(let g=0;g<r.length;g+=3){const x=r[g],E=r[g+1],V=r[g+2];s=Math.min(s,x),l=Math.max(l,x),a=Math.min(a,E),p=Math.max(p,E),f=Math.min(f,V),h=Math.max(h,V)}const v=Math.sqrt((l-s)**2+(p-a)**2+(h-f)**2)*.05,C=c.MathUtils.degToRad(e.fov),B=2*Math.tan(C/2)*n,A=v/B*i.domElement.height*(o/4);return Math.max(1,A)}function mt(r){if(r.length%3!==0)return console.error("points array length is not a multiple of 3:",r),null;const e=new c.BufferGeometry;e.setAttribute("position",new c.Float32BufferAttribute(r,3));const i=new Float32Array(r.length);for(let s=0;s<r.length;s+=3)i[s]=0,i[s+1]=.847,i[s+2]=1;e.setAttribute("color",new c.BufferAttribute(i,3));const o=new c.PointsMaterial({vertexColors:!0,size:1,sizeAttenuation:!1}),n=new c.Points(e,o);return o.needsUpdate=!0,n}function pt(r,e){if(!e)return;const{scene:i,camera:o,renderer:n,controls:s}=r();if(!i||!o||!n||!s)return;const l=mt(e);if(!l)return;l.name="轨迹路径",i.add(l);const a=ft(e,o,n,.4,50);return l.material.size=a,l}const ht={class:"obj-viewer-container"},vt={class:"buttonGroup-top"},gt={class:"buttonGroup-topLeft"},yt={class:"buttonGroup-left"},wt={class:"buttonGroup-right"},xt={class:"buttonGroup-bottom"},bt={class:"left-panel"},St={class:"panel-header"},_t={class:"panel-body"},Et={key:1,class:"clipping-content"},Ct={class:"radio-group"},Vt={class:"radio-label"},zt={class:"radio-label"},Nt={class:"radio-label"},At={class:"radio-label"},Tt={class:"right-panel"},Ut={class:"panel-header"},Mt={class:"panel-body"},Bt={key:0,class:"loading-overlay"},Lt=t.defineComponent({__name:"threeTrackPathView",props:{fileBlobs:{},threeData:{default:()=>""},trackFileType:{}},emits:["getAnimationData","getThreeData"],setup(r,{emit:e}){const i=e,o=r,n=t.ref(null),s=t.ref(!1),l=t.ref(""),a=t.ref(),p=t.ref(!1),f=t.ref(""),h=t.ref(!1),m=t.ref(""),v=t.shallowRef(null),C=t.shallowRef(null),{currentModels:B,resetView:A,initThreeJS:g,handleResize:x,getThreeJSObjects:E,cleanup:V,axesHelperVisible:N,toggleAxesVisibility:Z}=O.useThreeJS(n),{isAnimating:F,toggleAnimation:pe,stopAnimation:he}=O.useAnimation(E,B),{isClipping:ve,activeClippingAxis:z,toggleClipping:ge,updateClippingPlanes:L}=O.useClipping(E,B),ye=()=>{Z()},j=d=>{p.value=!0,f.value=d,d==="剖面视图"&&!ve.value&&ge()},H=d=>{h.value=!0,m.value=d,d==="动画仿真"&&i("getAnimationData")},K=t.ref([]),R=t.ref([]),we=t.computed(()=>{var u;return(u=o.trackFileType)==null?void 0:u.isUv}),xe=t.computed(()=>{var u;return(u=o.trackFileType)==null?void 0:u.isCyd}),be=t.computed(()=>{var u;return(u=o.trackFileType)==null?void 0:u.isCpt}),P=t.computed(()=>{var u;return(u=o.trackFileType)==null?void 0:u.isNc}),Se=t.computed(()=>{const d=o.fileBlobs||[];return d==null?void 0:d[0]});let k=t.shallowRef(),I=t.shallowRef();const _e=()=>{const{scene:d}=E();k.value&&d&&(O.disposeObj(k.value,d),k.value=null)},Ee=()=>{const{scene:d}=E();I.value&&d&&(O.disposeObj(I.value,d),I.value=null)},ne=()=>{_e(),Ee()},Ce=async d=>{const u=URL.createObjectURL(d),W=await Be.readFileText(u);if(URL.revokeObjectURL(u),Le.isString(W)){const y=await ct(W,o.trackFileType)||[];K.value=y;const ie=K.value;we.value&&(k.value=dt(E,ie)),(xe.value||be.value||P.value)&&(k.value=pt(E,ie)),O.frameCameraToMesh(E,k.value)}},Ve=()=>{var d,u;I.value=ke(),R.value=ut(K.value),R.value&&R.value.length&&(de(I.value,R.value[0],k.value,new c.Color(16711680)),(u=(d=C.value)==null?void 0:d.add)==null||u.call(d,I.value))};t.watch(()=>Se.value,async d=>{d&&(ne(),await Ce(d),P.value&&Ve())},{immediate:!0,deep:!0});const ze=()=>{var d;P.value&&((d=a==null?void 0:a.value)==null||d.playAnimation())},Ne=()=>{var d;P.value&&((d=a==null?void 0:a.value)==null||d.stopAnimation())},Ae=()=>{var d;P.value&&((d=a==null?void 0:a.value)==null||d.forwardFrame())},Te=()=>{var d;P.value&&((d=a==null?void 0:a.value)==null||d.backwardFrame())},Ue=()=>{g(),window.addEventListener("resize",x);const d=E();C.value=d.scene,C.value&&(C.value.name="CPMPIP")},Me=()=>{window.removeEventListener("resize",x),F.value&&he(),ne(),V()};return t.onMounted(async()=>{try{Ue()}catch(d){console.error("Three.js 初始化失败:",d),G.ElMessage.error("渲染引擎初始化失败!")}}),t.onBeforeUnmount(()=>{Me()}),(d,u)=>{const W=t.resolveComponent("el-scrollbar");return t.openBlock(),t.createElementBlock("div",ht,[t.createElementVNode("div",{ref_key:"threejsContainer",ref:n,class:"threejs-container"},null,512),t.createElementVNode("div",vt,[t.createVNode(w.ThreeSvgIcon,{name:"guanjianjiexi",size:"34"}),t.createVNode(w.ThreeSvgIcon,{name:"guanjiekongzhi",size:"34"}),t.createVNode(w.ThreeSvgIcon,{name:"gongyishengcheng",size:"34"}),t.createVNode(w.ThreeSvgIcon,{name:"buchangshezhi",size:"34"}),t.createVNode(w.ThreeSvgIcon,{name:"shuchujiagongchengxu",size:"34"})]),t.createElementVNode("div",gt,[t.createVNode(w.ThreeSvgIcon,{name:"viewReset",size:"24",onClick:t.unref(A),title:"重置"},null,8,["onClick"]),t.createVNode(w.ThreeSvgIcon,{name:"fangda",size:"24",title:"放大"}),t.createVNode(w.ThreeSvgIcon,{name:"suoxiao",size:"24",title:"缩小"}),t.createVNode(w.ThreeSvgIcon,{name:"lookAround",size:"24",onClick:t.unref(pe),title:t.unref(F)?"停止动画":"动画视图"},null,8,["onClick","title"]),t.createVNode(w.ThreeSvgIcon,{name:"zuobiaoxi",size:"24",active:t.unref(N),onClick:ye,title:"显隐坐标轴"},null,8,["active"])]),t.createElementVNode("div",yt,[t.renderSlot(d.$slots,"button-left",{switchRightPanel:j},void 0,!0),t.createVNode(w.ThreeSvgIcon,{name:"jiegoushu",size:"24",onClick:u[0]||(u[0]=y=>j("场景树")),active:p.value&&f.value==="场景树",title:"场景树"},null,8,["active"]),t.createVNode(w.ThreeSvgIcon,{name:"clipping",size:"24",onClick:u[1]||(u[1]=y=>j("剖面视图")),active:p.value&&f.value==="剖面视图",title:"剖面视图"},null,8,["active"]),t.createVNode(w.ThreeSvgIcon,{name:"donghuafangzhen",size:"24",onClick:u[2]||(u[2]=y=>j("场景树3"))}),t.createVNode(w.ThreeSvgIcon,{name:"donghuafangzhen",size:"24",onClick:u[3]||(u[3]=y=>j("场景4"))})]),t.createElementVNode("div",wt,[t.renderSlot(d.$slots,"button-right",{switchRightPanel:H},void 0,!0),t.createVNode(w.ThreeSvgIcon,{name:"donghuafangzhen",size:"24"}),t.createVNode(w.ThreeSvgIcon,{name:"guanjiekongzhi",size:"24",onClick:u[4]||(u[4]=y=>H("关节控制")),active:h.value&&m.value==="关节控制",title:"关节控制"},null,8,["active"]),t.createVNode(w.ThreeSvgIcon,{name:"donghuafangzhen",size:"24",title:"动画仿真",onClick:u[5]||(u[5]=y=>H("动画仿真")),active:h.value&&m.value==="动画仿真"},null,8,["active"]),t.createVNode(w.ThreeSvgIcon,{name:"donghuafangzhen",size:"24",title:"urdf动画",onClick:u[6]||(u[6]=y=>H("urdf动画")),active:h.value&&m.value==="urdf动画"},null,8,["active"]),t.createVNode(w.ThreeSvgIcon,{name:"donghuafangzhen",size:"24"})]),t.createElementVNode("div",xt,[t.createVNode(w.ThreeSvgIcon,{name:"kuaitui",size:"24",backgroundColor:"#ffffff",title:"快退",onClick:Te}),t.createVNode(w.ThreeSvgIcon,{name:"bofang",size:"24",backgroundColor:"#ffffff",title:"播放",onClick:ze}),t.createVNode(w.ThreeSvgIcon,{name:"kuaijin",size:"24",backgroundColor:"#ffffff",title:"快进",onClick:Ae}),t.createVNode(w.ThreeSvgIcon,{name:"zanting",size:"24",backgroundColor:"#ffffff",title:"暂停",onClick:Ne})]),t.withDirectives(t.createElementVNode("div",bt,[t.createElementVNode("div",St,[t.createElementVNode("span",null,t.toDisplayString(f.value),1),t.createElementVNode("span",{class:"close",onClick:u[7]||(u[7]=y=>p.value=!1)}," X ")]),t.createElementVNode("div",_t,[t.createVNode(W,{height:"100%"},{default:t.withCtx(()=>[f.value==="场景树"?(t.openBlock(),t.createBlock(oe.UrdfTree,{key:0,model:v.value},null,8,["model"])):t.createCommentVNode("",!0),f.value==="剖面视图"?(t.openBlock(),t.createElementBlock("div",Et,[t.createElementVNode("div",Ct,[t.createElementVNode("label",Vt,[t.withDirectives(t.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"none","onUpdate:modelValue":u[8]||(u[8]=y=>t.isRef(z)?z.value=y:null),onChange:u[9]||(u[9]=(...y)=>t.unref(L)&&t.unref(L)(...y))},null,544),[[t.vModelRadio,t.unref(z)]]),u[17]||(u[17]=t.createElementVNode("span",{class:"radio-text"},"无切割",-1))]),t.createElementVNode("label",zt,[t.withDirectives(t.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"x","onUpdate:modelValue":u[10]||(u[10]=y=>t.isRef(z)?z.value=y:null),onChange:u[11]||(u[11]=(...y)=>t.unref(L)&&t.unref(L)(...y))},null,544),[[t.vModelRadio,t.unref(z)]]),u[18]||(u[18]=t.createElementVNode("span",{class:"radio-text"},"X轴切割",-1))]),t.createElementVNode("label",Nt,[t.withDirectives(t.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"y","onUpdate:modelValue":u[12]||(u[12]=y=>t.isRef(z)?z.value=y:null),onChange:u[13]||(u[13]=(...y)=>t.unref(L)&&t.unref(L)(...y))},null,544),[[t.vModelRadio,t.unref(z)]]),u[19]||(u[19]=t.createElementVNode("span",{class:"radio-text"},"Y轴切割",-1))]),t.createElementVNode("label",At,[t.withDirectives(t.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"z","onUpdate:modelValue":u[14]||(u[14]=y=>t.isRef(z)?z.value=y:null),onChange:u[15]||(u[15]=(...y)=>t.unref(L)&&t.unref(L)(...y))},null,544),[[t.vModelRadio,t.unref(z)]]),u[20]||(u[20]=t.createElementVNode("span",{class:"radio-text"},"Z轴切割",-1))])])])):t.createCommentVNode("",!0)]),_:1})])],512),[[t.vShow,p.value]]),t.withDirectives(t.createElementVNode("div",Tt,[t.createElementVNode("div",Ut,[t.createElementVNode("span",null,t.toDisplayString(m.value),1),t.createElementVNode("span",{class:"close",onClick:u[16]||(u[16]=y=>h.value=!1)}," X ")]),t.createElementVNode("div",Mt,[t.createVNode(W,{height:"100%"},{default:t.withCtx(()=>[t.withDirectives(t.createVNode(oe.JointPanel,{model:v.value},null,8,["model"]),[[t.vShow,m.value==="关节控制"]]),t.withDirectives(t.createVNode(He,{ref_key:"animationPanelRef",ref:a,cloud:t.unref(k),knife:t.unref(I),vectors:R.value},null,8,["cloud","knife","vectors"]),[[t.vShow,m.value==="动画仿真"&&P.value]])]),_:1})])],512),[[t.vShow,h.value]]),s.value?(t.openBlock(),t.createElementBlock("div",Bt,[u[21]||(u[21]=t.createElementVNode("div",{class:"loading-spinner"},null,-1)),t.createElementVNode("p",null,t.toDisplayString(l.value),1)])):t.createCommentVNode("",!0)])}}}),kt=ue._export_sfc(Lt,[["__scopeId","data-v-e8652636"]]);exports.default=kt;
|
|
@@ -24803,7 +24803,7 @@ const n_ = { class: "top-menu" }, i_ = {
|
|
|
24803
24803
|
},
|
|
24804
24804
|
emits: ["getThreeData"],
|
|
24805
24805
|
setup(e, { emit: t }) {
|
|
24806
|
-
const r = Ja(() => import("./threeSceneView-
|
|
24806
|
+
const r = Ja(() => import("./threeSceneView-afr3Fv7q.js")), a = Ja(() => import("./threePreview-Dmaba2U-.js")), n = Ja(() => import("./threeTrackPathView-CKhnsfKP.js")), i = Ja(() => import("./threeSceneViewForCPMPIP-CR5y7Hzt.js")), s = {
|
|
24807
24807
|
ROBOT_SCENE: "robot",
|
|
24808
24808
|
// 机器人场景
|
|
24809
24809
|
LATHE_SCENE: "latheScene",
|