--- outline: [2, 3] --- # FaultSlip - 源文件:`packages/sdk/src/effect/FaultSlip.ts` - 文档位置:`packages/docs/api/effect/FaultSlip.md` ## 接口:`FaultSlipOptions` - 作用:FaultSlipOptions 的结构定义。 ### 字段 | 字段名 | 类型 | 必填 | 作用 | | --- | --- | --- | --- | | `normal` | `THREE.Vector3` | 否 | 法线方向。 | | `rows` | `number` | 否 | 用于保存 `rows` 对应的数据。 | | `cols` | `number` | 否 | 用于保存 `cols` 对应的数据。 | | `spacingU` | `number` | 否 | 用于保存 `spacingU` 对应的数据。 | | `spacingV` | `number` | 否 | 用于保存 `spacingV` 对应的数据。 | | `arrowLength` | `number` | 否 | 用于保存 `arrowLength` 对应的数据。 | | `shaftWidth` | `number` | 否 | 用于保存 `shaftWidth` 对应的数据。 | | `headWidth` | `number` | 否 | 用于保存 `headWidth` 对应的数据。 | | `headLength` | `number` | 否 | 用于保存 `headLength` 对应的数据。 | | `colorHex` | `number` | 否 | 用于保存 `colorHex` 对应的数据。 | | `arrowSideOffset` | `number` | 否 | 用于保存 `arrowSideOffset` 对应的数据。 | | `arrowMoveAmp` | `number` | 否 | 用于保存 `arrowMoveAmp` 对应的数据。 | | `arrowMoveSpeed` | `number` | 否 | 用于保存 `arrowMoveSpeed` 对应的数据。 | | `autoStart` | `boolean` | 否 | 用于标记 `autoStart` 的启用状态。 | ## 类:`FaultSlip` - 作用:断层滑移引起矿震的可视化效果 基于 Mesh 的包围盒生成断层面和交错箭头动画 ### 构造函数 #### `new FaultSlip(mesh: THREE.Mesh, options?: FaultSlipOptions)` - 作用:创建 FaultSlip 实例。 - 入参: | 参数名 | 类型 | 必填 | 说明 | | --- | --- | --- | --- | | `mesh` | `THREE.Mesh` | 是 | 目标网格对象。 | | `options` | `FaultSlipOptions` | 否 | 当前功能对应的配置项。 | - 出参:`FaultSlip` - 返回说明:返回当前类实例。 ### 属性 | 属性名 | 可见性 | 类型 | 作用 | | --- | --- | --- | --- | | `options` | `public` | `Required` | 用于保存 `options` 对应的数据。 | | `group` | `public` | `THREE.Group` | 用于保存 `group` 对应的数据。 | | `active` | `public` | `boolean` | 用于标记 `active` 的启用状态。 | | `mesh` | `public` | `THREE.Mesh` | 用于保存 `mesh` 对应的数据。 | | `arrowAnims` | `public` | `ArrowAnimation[]` | 用于保存 `arrowAnims` 的集合数据。 | | `flatArrowShaftGeom` | `public` | `THREE.PlaneGeometry` | 用于保存 `flatArrowShaftGeom` 对应的数据。 | | `flatArrowHeadGeom` | `public` | `THREE.ShapeGeometry` | 用于保存 `flatArrowHeadGeom` 对应的数据。 | | `flatArrowMat` | `public` | `THREE.MeshBasicMaterial` | 用于保存 `flatArrowMat` 对应的数据。 | | `tmpV` | `public` | `THREE.Vector3` | 用于保存 `tmpV` 对应的数据。 | | `tmpV2` | `public` | `THREE.Vector3` | 用于保存 `tmpV2` 对应的数据。 | | `tmpV3` | `public` | `THREE.Vector3` | 用于保存 `tmpV3` 对应的数据。 | | `tmpM` | `public` | `THREE.Matrix4` | 用于保存 `tmpM` 对应的数据。 | | `updateBound` | `public` | `((data: RenderEventData) => void) \| null` | 用于保存 `updateBound` 对应的数据。 | ### 方法 #### `start(): void` - 作用:执行 start 相关逻辑。 - 入参:无 - 出参:`void` - 返回说明:无返回值。 #### `stop(): void` - 作用:执行 stop 相关逻辑。 - 入参:无 - 出参:`void` - 返回说明:无返回值。 #### `toggle(): void` - 作用:执行 toggle 相关逻辑。 - 入参:无 - 出参:`void` - 返回说明:无返回值。 #### `update(data: RenderEventData): void` - 作用:更新 update。 - 入参: | 参数名 | 类型 | 必填 | 说明 | | --- | --- | --- | --- | | `data` | `RenderEventData` | 是 | 输入数据。 | - 出参:`void` - 返回说明:无返回值。 #### `setColor(colorHex: number): void` - 作用:设置 Color。 - 入参: | 参数名 | 类型 | 必填 | 说明 | | --- | --- | --- | --- | | `colorHex` | `number` | 是 | 参数 `colorHex`,类型为 `number`。 | - 出参:`void` - 返回说明:无返回值。 #### `setOpacity(opacity: number): void` - 作用:设置 Opacity。 - 入参: | 参数名 | 类型 | 必填 | 说明 | | --- | --- | --- | --- | | `opacity` | `number` | 是 | 参数 `opacity`,类型为 `number`。 | - 出参:`void` - 返回说明:无返回值。 #### `setSpeed(speed: number): void` - 作用:设置 Speed。 - 入参: | 参数名 | 类型 | 必填 | 说明 | | --- | --- | --- | --- | | `speed` | `number` | 是 | 参数 `speed`,类型为 `number`。 | - 出参:`void` - 返回说明:无返回值。 #### `setAmplitude(amplitude: number): void` - 作用:设置 Amplitude。 - 入参: | 参数名 | 类型 | 必填 | 说明 | | --- | --- | --- | --- | | `amplitude` | `number` | 是 | 参数 `amplitude`,类型为 `number`。 | - 出参:`void` - 返回说明:无返回值。 #### `dispose(): void` - 作用:释放资源并销毁当前实例。 - 入参:无 - 出参:`void` - 返回说明:无返回值。 #### `init(): void` - 作用:执行 init 初始化逻辑。 - 入参:无 - 出参:`void` - 返回说明:无返回值。 #### `makeArrowMesh(params: { length: number; shaftWidth: number; headWidth: number; headLength: number; }): THREE.Group` - 作用:执行 make Arrow Mesh 相关逻辑。 - 入参: | 参数名 | 类型 | 必填 | 说明 | | --- | --- | --- | --- | | `params` | `{ length: number; shaftWidth: number; headWidth: number; headLength: number; }` | 是 | 参数 `params`,类型为 `{ length: number; shaftWidth: number; headWidth: number; headLength: number; }`。 | - 出参:`THREE.Group` - 返回说明:返回 `THREE.Group`。 #### `orientArrowOnSection(arrow: THREE.Group, moveDir: THREE.Vector3, sectionNormal: THREE.Vector3): void` - 作用:执行 orient Arrow On Section 相关逻辑。 - 入参: | 参数名 | 类型 | 必填 | 说明 | | --- | --- | --- | --- | | `arrow` | `THREE.Group` | 是 | 参数 `arrow`,类型为 `THREE.Group`。 | | `moveDir` | `THREE.Vector3` | 是 | 参数 `moveDir`,类型为 `THREE.Vector3`。 | | `sectionNormal` | `THREE.Vector3` | 是 | 参数 `sectionNormal`,类型为 `THREE.Vector3`。 | - 出参:`void` - 返回说明:无返回值。 #### `buildVisualization(): void` - 作用:执行 build Visualization 相关逻辑。 - 入参:无 - 出参:`void` - 返回说明:无返回值。 ## 构造示例 - 来源:`packages/demo/src/disasterFormationPanel/GoldMineScene/MineSeismicPanel.vue` ```ts const section = bus.getSection(); faultSlip = new FaultSlip(section, {autoStart: true}); faultSlipSeismicWave = new SeismicWave({ emitterPositions: [new THREE.Vector3(0, 0, 0)], shape: 'sphere', autoStart: true }); hasFaultSlip.value = true; }; ``` - 来源:`packages/demo/src/disasterFormationPanel/OilGasScene/OilGasMineSeismicPanel.vue` ```ts const section = bus.getSection(); faultSlip = new FaultSlip(section, {autoStart: true}); faultSlipSeismicWave = new SeismicWave({ emitterPositions: [new THREE.Vector3(0, 0, 0)], shape: 'sphere', autoStart: true }); hasFaultSlip.value = true; }; ``` ## 函数示例 - 当前 Demo 中没有直接展示 `FaultSlip` 的公开方法调用。 ## Demo 参考 ### `FaultSlip` 以下示例文件中可以看到该 API 的实际调用方式: - `packages/demo/src/disasterFormationPanel/GoldMineScene/MineSeismicPanel.vue` - `packages/demo/src/disasterFormationPanel/OilGasScene/OilGasMineSeismicPanel.vue`