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

116 lines
3.0 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]
---
# ParametricWireframe
- 源文件:`packages/sdk/src/parametric/ParametricWireframe.ts`
- 文档位置:`packages/docs/api/parametric/ParametricWireframe.md`
## 接口:`IWireframeOptions`
- 作用:线框参数配置
### 字段
| 字段名 | 类型 | 必填 | 作用 |
| --- | --- | --- | --- |
| `color` | `number` | 否 | 线框颜色 |
| `linewidth` | `number` | 否 | 线宽 |
| `width` | `number` | 否 | 盒子宽度 |
| `height` | `number` | 否 | 盒子高度 |
| `depth` | `number` | 否 | 盒子深度 |
| `box` | `ParametricBox` | 否 | ParametricBox 实例(可选,如果提供则从中提取尺寸) |
## 类:`ParametricWireframe`
- 作用:参数化线框 显示盒子的12条边
- 继承/实现:`extends LineSegments<BufferGeometry, Material>implements IParametricGeometry`
### 构造函数
#### `new ParametricWireframe(options: IWireframeOptions = {})`
- 作用:创建参数化线框
- 入参:
| 参数名 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- |
| `options` | `IWireframeOptions` | 否 | - 线框配置选项 |
- 出参:`ParametricWireframe`
- 返回说明:返回当前类实例。
### 属性
| 属性名 | 可见性 | 类型 | 作用 |
| --- | --- | --- | --- |
| `options` | `public` | `Required<Omit<IWireframeOptions, 'box'>>` | 用于保存 `options` 对应的数据。 |
| `sourceBox` | `public` | `ParametricBox` | 用于保存 `sourceBox` 对应的数据。 |
### 方法
#### `createWireframeGeometry(width: number, height: number, depth: number): THREE.BufferGeometry<THREE.NormalBufferAttributes, THREE.BufferGeometryEventMap>`
- 作用:创建线框几何体 盒子有12条边 - 顶面4条边 - 底面4条边 - 连接顶底的4条垂直边
- 入参:
| 参数名 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- |
| `width` | `number` | 是 | 宽度参数。 |
| `height` | `number` | 是 | 高度参数。 |
| `depth` | `number` | 是 | 深度参数。 |
- 出参:`THREE.BufferGeometry<THREE.NormalBufferAttributes, THREE.BufferGeometryEventMap>`
- 返回说明:返回 `THREE.BufferGeometry<THREE.NormalBufferAttributes, THREE.BufferGeometryEventMap>`
#### `updateParameters(options: Partial<IWireframeOptions>): void`
- 作用:更新线框参数
- 入参:
| 参数名 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- |
| `options` | `Partial<IWireframeOptions>` | 是 | - 新的线框配置选项 |
- 出参:`void`
- 返回说明:无返回值。
#### `syncFromBox(): void`
- 作用:从关联的 ParametricBox 同步尺寸
- 入参:无
- 出参:`void`
- 返回说明:无返回值。
#### `updateGeometry(): void`
- 作用:更新几何体
- 入参:无
- 出参:`void`
- 返回说明:无返回值。
#### `dispose(): void`
- 作用:销毁资源
- 入参:无
- 出参:`void`
- 返回说明:无返回值。
## 构造示例
- 当前 Demo 中没有直接展示 `ParametricWireframe` 的构造调用。
## 函数示例
- 当前 Demo 中没有直接展示 `ParametricWireframe` 的公开方法调用。