圆环缓冲几何体(TorusGeometry)

优质
小牛编辑
125浏览
2023-12-01

一个用于生成圆环几何体的类。

// iOS iframe auto-resize workaround if ( /(iPad|iPhone|iPod)/g.test( navigator.userAgent ) ) { const scene = document.getElementById( 'scene' ); scene.style.width = getComputedStyle( scene ).width; scene.style.height = getComputedStyle( scene ).height; scene.setAttribute( 'scrolling', 'no' ); }

代码示例

const geometry = new THREE.TorusGeometry( 10, 3, 16, 100 );
const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } );
const torus = new THREE.Mesh( geometry, material );
scene.add( torus );

构造器

TorusGeometry(radius : Float, tube : Float, radialSegments : Integer, tubularSegments : Integer, arc : Float)

radius - 圆环的半径,从圆环的中心到管道(横截面)的中心。默认值是1。
tube — 管道的半径,默认值为0.4。
radialSegments — 圆环的分段数,默认值为8。
tubularSegments — 管道的分段数,默认值为6。
arc — 圆环的圆心角(单位是弧度),默认值为Math.PI * 2。

属性

共有属性请参见其基类BufferGeometry

.parameters

一个包含着构造函数中每个参数的对象。在对象实例化之后,对该属性的任何修改都不会改变这个几何体。

方法(Methods)

共有方法请参见其基类BufferGeometry

源代码

src/geometries/TorusGeometry.js