Shape 形状

—> Path —> CurvePath —> Curve

运用路径来定义2D平面图形, 能在中间穿洞. 主要用在 ExtrudeGeometry, ShapeGeometry 中, 作为参数传入其中.

function Shape( points ) { } var shape = new THREE.Shape(); shape.quadraticCurveTo(3, 5, 9, 1); shape.quadraticCurveTo(11, -1, 12, 3); shape.quadraticCurveTo(13, 0, 12, -3); shape.quadraticCurveTo(11, 1, 9, -1); shape.quadraticCurveTo(3, -5, 0, 0); var eye = new THREE.Path(); eye.arc(2, 0, 0.5); shape.holes.push(eye); var geometry = new THREE.ShapeGeometry(shape), material = new THREE.MeshPhongMaterial({color: '#eecc99', side: THREE.DoubleSide}), fish = new THREE.Mesh(geometry, material); scene.add(fish);

Attributes

type : String

Default value : 'Shape'
Description : 类型

holes : Array

Default value : []
Description : 图形中的洞, Path 数组.

Methods

getPointsHoles( divisions ) : Array
divisions Integer 分段数

获取图形上的洞.

extractPoints( divisions ) : Object {shape:~, holes:~}
divisions Integer 分段数

提取图形中的点, 包括图形路径, 以及图形上的洞的点.