deep-engine-demo/packages/docs/api/mesh/ClippingHelper.md
2026-04-19 18:46:28 +08:00

75 lines
2.3 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
outline: [2, 3]
---
# ClippingHelper
- 源文件:`packages/sdk/src/mesh/ClippingHelper.ts`
- 文档位置:`packages/docs/api/mesh/ClippingHelper.md`
## 类:`ClippingHelper`
- 作用:剖切平面辅助对象,用于可视化 {@link THREE.Plane} 实例。 ```js const plane = new THREE.Plane( new THREE.Vector3( 1, 1, 0.2 ), 3 ); const helper = new ClippingHelper( plane, 1, 1, 0xffff00 ); scene.add( helper ); ```
- 继承/实现:`extends THREE.Line`
### 构造函数
#### `new ClippingHelper(plane: THREE.Plane, width: number = 1, height: number = 1, hex: number | THREE.Color | string = 0xffff00)`
- 作用:构造一个新的剖切平面辅助对象。
- 入参:
| 参数名 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- |
| `plane` | `THREE.Plane` | 是 | - 要可视化的平面。 |
| `width` | `number` | 否 | - 辅助对象的宽度。 |
| `height` | `number` | 否 | - 辅助对象的高度。 |
| `hex` | `number \| THREE.Color \| string` | 否 | - 辅助对象的颜色。 |
- 出参:`ClippingHelper`
- 返回说明:返回当前类实例。
### 属性
| 属性名 | 可见性 | 类型 | 作用 |
| --- | --- | --- | --- |
| `plane` | `public` | `THREE.Plane` | 要可视化的平面。 |
| `width` | `public` | `number` | 辅助对象的宽度。 |
| `height` | `public` | `number` | 辅助对象的高度。 |
| `topRotateHandle` | `public` | `THREE.Sprite \| null` | 上方旋转手柄 Sprite绕局部 X 轴旋转) |
| `rightRotateHandle` | `public` | `THREE.Sprite \| null` | 右方旋转手柄 Sprite绕局部 Y 轴旋转) |
| `textureBasePath` | `public` | `string` | 纹理基础路径(由外部注入,通常为 Vite 的 base 路径) |
### 方法
#### `showRotateHandles(show: boolean): void`
- 作用:显示或隐藏旋转控制手柄。 首次调用 show=true 时会懒加载纹理并创建 Sprite。
- 入参:
| 参数名 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- |
| `show` | `boolean` | 是 | 是否显示 |
- 出参:`void`
- 返回说明:无返回值。
#### `dispose(): void`
- 作用:释放辅助对象占用的资源。
- 入参:无
- 出参:`void`
- 返回说明:无返回值。
## 构造示例
- 当前 Demo 中没有直接展示 `ClippingHelper` 的构造调用。
## 函数示例
- 当前 Demo 中没有直接展示 `ClippingHelper` 的公开方法调用。