LatheGeometry 旋转模型

—> Geometry

这是一个定义了一组 Vector2 的点集, 然后把这些点连成一条曲线, 再把这曲线饶 y 轴旋转而得到的模型. 怎么会取名 Lathe 的呢? 因为我们平时生活中的轴对称及旋转的物件, 都是用车床加工得来的.

function LatheGeometry( points, segments, phiStart, phiLength ) { } var path = new THREE.Path(); path.splineThru([new THREE.Vector2(0.6,4), new THREE.Vector2(0.6,0), new THREE.Vector2(1.2,-0.5), new THREE.Vector2(1.5,-0.8), new THREE.Vector2(2,-1), new THREE.Vector2(2.5,-1.5), new THREE.Vector2(2,-2), new THREE.Vector2(1.2,-2.5)]); var points = path.getPoints(); var geometry = new THREE.LatheGeometry(points, 24), material = new THREE.MeshBasicMaterial({color: 0x663399, side: THREE.DoubleSide}), circle = new THREE.Mesh( geometry, material ); scene.add( circle );

Parameters

points segments phiStart phiLength
Array (Vector2) 12 0 Math.PI * 2
Vector2类型的点数组 圆周分段数 开始角度 闭合角度

Methods 继承自 Geometry 并自动调用

fromBufferGeometry( new LatheBufferGeometry( points, segments, phiStart, phiLength ) )
mergeVertices( )

LatheBufferGeometry

function LatheBufferGeometry( points, segments, phiStart, phiLength ) { } var path = new THREE.Path(); path.splineThru([new THREE.Vector2(0.6,4), new THREE.Vector2(0.6,0), new THREE.Vector2(1.2,-0.5), new THREE.Vector2(1.5,-0.8), new THREE.Vector2(2,-1), new THREE.Vector2(2.5,-1.5), new THREE.Vector2(2,-2), new THREE.Vector2(1.2,-2.5)]); var points = path.getPoints(); var geometry = new THREE.LatheBufferGeometry(points, 24), material = new THREE.MeshBasicMaterial({color: 0x663399, side: THREE.DoubleSide}), circle = new THREE.Mesh( geometry, material ); scene.add( circle );

Methods 继承自 BufferGeometry 并自动调用

setIndex( )
addAttribute( )

图解API

纹理Texture来渲染旋转模型. 点开查看