1 |
- {"ast":null,"code":"import _defineProperty from \"/Users/mac/projects/mime/mine/node_modules/@babel/runtime/helpers/esm/defineProperty.js\";\nimport { Strategy } from \"./strategy.js\";\n\n/**\n * YUp策略类\n */\nexport class YUpRStrategy extends Strategy {\n constructor(...args) {\n super(...args);\n /**\n * 原点姿态\n * @type {Object}\n */\n _defineProperty(this, \"originPointPose\", null);\n }\n /**\n * 统一坐标系统\n * @param {Object} model - 模型\n * @param {Object} worldPose - 世界姿态\n */\n unifiedCoordinateSystem(model) {\n console.log(\"Y-up: beforeAddApplyMatrix\");\n return model;\n }\n\n /**\n * 设置本地原点姿态\n * @param {Object} worldPose - 世界姿态\n */\n setLocalOriginPose(worldPose) {\n this.originPointPose = worldPose;\n console.log(\"Y-up: convertLocalToWorld\");\n }\n\n /**\n * 转换本地到世界\n * @param {Object} model - 模型\n * @param {Object} localPosition - 本地位置\n */\n convertLocalToWorld(localPosition) {\n var quaternion = new THREE.Quaternion(this.originPointPose.worldQuaternion.x, this.originPointPose.worldQuaternion.y, this.originPointPose.worldQuaternion.z, this.originPointPose.worldQuaternion.w);\n var rotationMatrix = new THREE.Matrix4().makeRotationFromQuaternion(quaternion);\n var translationMatrix = new THREE.Matrix4().makeTranslation(this.originPointPose.worldPosition.x, this.originPointPose.worldPosition.y, this.originPointPose.worldPosition.z);\n var transformationMatrix = new THREE.Matrix4().multiplyMatrices(translationMatrix, rotationMatrix);\n // 用转换矩阵将本地坐标转为世界坐标\n let worldPosition = localPosition.applyMatrix4(transformationMatrix);\n console.log('======打印当前的worldPosition======', worldPosition);\n return worldPosition;\n }\n}","map":{"version":3,"names":["Strategy","YUpRStrategy","constructor","args","_defineProperty","unifiedCoordinateSystem","model","console","log","setLocalOriginPose","worldPose","originPointPose","convertLocalToWorld","localPosition","quaternion","THREE","Quaternion","worldQuaternion","x","y","z","w","rotationMatrix","Matrix4","makeRotationFromQuaternion","translationMatrix","makeTranslation","worldPosition","transformationMatrix","multiplyMatrices","applyMatrix4"],"sources":["/Users/mac/projects/mime/mine/public/plugin/uwb/strategy-manager/y-up-r-strategy.js"],"sourcesContent":["import { Strategy } from \"./strategy.js\";\n\n/**\n * YUp策略类\n */\nexport class YUpRStrategy extends Strategy {\n /**\n * 原点姿态\n * @type {Object}\n */\n originPointPose = null;\n\n /**\n * 统一坐标系统\n * @param {Object} model - 模型\n * @param {Object} worldPose - 世界姿态\n */\n unifiedCoordinateSystem(model) {\n console.log(\"Y-up: beforeAddApplyMatrix\");\n return model\n }\n\n /**\n * 设置本地原点姿态\n * @param {Object} worldPose - 世界姿态\n */\n setLocalOriginPose(worldPose) {\n this.originPointPose = worldPose;\n console.log(\"Y-up: convertLocalToWorld\");\n }\n\n /**\n * 转换本地到世界\n * @param {Object} model - 模型\n * @param {Object} localPosition - 本地位置\n */\n convertLocalToWorld(localPosition) {\n var quaternion = new THREE.Quaternion(this.originPointPose.worldQuaternion.x,this.originPointPose.worldQuaternion.y,this.originPointPose.worldQuaternion.z,this.originPointPose.worldQuaternion.w);\n var rotationMatrix = new THREE.Matrix4().makeRotationFromQuaternion(quaternion);\n var translationMatrix = new THREE.Matrix4().makeTranslation(this.originPointPose.worldPosition.x,this.originPointPose.worldPosition.y,this.originPointPose.worldPosition.z);\n var transformationMatrix = new THREE.Matrix4().multiplyMatrices(translationMatrix, rotationMatrix);\n// 用转换矩阵将本地坐标转为世界坐标\n let worldPosition = localPosition.applyMatrix4(transformationMatrix);\n console.log('======打印当前的worldPosition======',worldPosition);\n return worldPosition\n\n }\n}\n"],"mappings":";AAAA,SAASA,QAAQ,QAAQ,eAAe;;AAExC;AACA;AACA;AACA,OAAO,MAAMC,YAAY,SAASD,QAAQ,CAAC;EAAAE,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IACzC;AACF;AACA;AACA;IAHEC,eAAA,0BAIkB,IAAI;EAAA;EAEtB;AACF;AACA;AACA;AACA;EACEC,uBAAuBA,CAACC,KAAK,EAAE;IAC7BC,OAAO,CAACC,GAAG,CAAC,4B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