[page:BufferGeometry] → [page:InstancedBufferGeometry] →

线段几何体([name])

一系列形成线段的顶点对。

在 [page:LineSegments2] 中用于描述形状。

导入

[name] 是一个附加组件,必须显式导入。 查看[link:#manual/introduction/Installation Installation / Addons]。

import { LineSegmentsGeometry } from 'three/addons/lines/LineSegmentsGeometry.js';

示例

[example:webgl_lines_fat_raycasting WebGL / lines / fat / raycasting ]

构造函数

[name]()

创建一个新的几何体。 调用 [page:LineSegmentsGeometry.setPositions setPositions] 来添加线段。

属性

共有属性,请参见基类 [page:InstancedBufferGeometry]。

[property:Boolean isLineSegmentsGeometry]

只读标志,用于检查给定对象是否为 [name] 类型。

方法

共有方法,请参见基类 [page:Mesh]。

[method:this fromEdgesGeometry]( [param:EdgesGeometry geometry] )

将边缘几何体的顶点位置复制到此几何体中。

[method:this fromLineSegments]( [param:LineSegments lineSegments] )

将 [page:LineSegments] 对象的顶点位置复制到此几何体中。 假定源几何体未使用索引。

[method:this fromMesh]( [param:Mesh mesh] )

将网格对象的顶点位置复制到此几何体中。

[method:this fromWireframeGeometry]( [param:WireframeGeometry geometry] )

将线框几何体的顶点位置复制到此几何体中。

[method:this setColors]( [param:Array array] )

替换每个顶点的颜色。 每六个值描述一个线段:`[r1, g1, b1, r2, g2, b2]`。 数组可以是 `Array` 或 `Float32Array` 类型。

[method:this setPositions]( [param:Array array] )

用新的顶点位置集替换现有顶点位置。 数组可以是 `Array` 或 `Float32Array` 类型。 数组长度必须是 6 的倍数。

另请参见 [page:LineSegmentsGeometry.positions positions]。

[method:undefined toJSON]()

未实现。

源代码

[link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/lines/LineSegmentsGeometry.js examples/jsm/lines/LineSegmentsGeometry.js]